Cleaned up

Cleaned up the Program.cs for the Cake Frosting project.  Added the working direcotry directive
This commit is contained in:
Christopher Whitley
2023-11-16 00:46:45 -05:00
parent 7e3a4a97bd
commit 189662f1db
+1 -43
View File
@@ -9,49 +9,7 @@ public static class Program
{
return new CakeHost()
.UseContext<BuildContext>()
.UseWorkingDirectory("../")
.Run(args);
}
}
public class BuildContext : FrostingContext
{
public bool Delay { get; set; }
public BuildContext(ICakeContext context)
: base(context)
{
Delay = context.Arguments.HasArgument("delay");
}
}
[TaskName("Hello")]
public sealed class HelloTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.Log.Information("Hello");
}
}
[TaskName("World")]
[IsDependentOn(typeof(HelloTask))]
public sealed class WorldTask : AsyncFrostingTask<BuildContext>
{
// Tasks can be asynchronous
public override async Task RunAsync(BuildContext context)
{
if (context.Delay)
{
context.Log.Information("Waiting...");
await Task.Delay(1500);
}
context.Log.Information("World");
}
}
[TaskName("Default")]
[IsDependentOn(typeof(WorldTask))]
public class DefaultTask : FrostingTask
{
}