Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Updating templating scripts to improve Frosting templates
Browse files Browse the repository at this point in the history
  • Loading branch information
agc93 committed Aug 14, 2017
1 parent 2f1d2b6 commit 2293a61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .templates
Submodule .templates added at 1667e9
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ if ($Target) { $cakeArguments += "-target=$Target" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($BuildTemplates) { $cakeArguments = @("templates.cake", "-target=Build-Templates")}
if ($BuildTemplates) { $cakeArguments = @("templates.cake", "-target=Build-Templates", "-experimental")}
if ($DryRun) { $cakeArguments += "-dryrun" }
if ($Experimental) { $cakeArguments += "-experimental" }
if ($Mono) { $cakeArguments += "-mono" }
Expand Down
11 changes: 8 additions & 3 deletions templates.cake
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ var model = new {
new {
name = "Default",
skipRun = true,
dependencies = new[] { "Build" }
runBody = $"// If you don't inherit from FrostingTask<MySettings>{Environment.NewLine} // the standard ICakeContext will be provided.{Environment.NewLine}",
dependencies = new[] { "<%= taskName %>" }
},
new {
name = "<%= taskName %>",
skipRun = false,
dependencies = new string[0] // this is needed for anonymous types to not bork out. Templates don't *need* this property
runBody = "", // this is needed for anonymous types to not bork out. Templates don't *need* this property
dependencies = new string[0] // as above
}
}
}
Expand Down Expand Up @@ -96,11 +98,14 @@ Task("Render-Frosting-Templates")
var program = RenderTemplateFromFile("./.templates/template/frosting/Program.cs.hbs", model);
WriteTemplateToFile(program, "./generators/frosting/templates/program.cs");
Information("Rendering the Task templates");
var tasksTemplate = RenderTemplateFromFile("./.templates/template/frosting/Tasks/Tasks.cs.hbs", model);
WriteTemplateToFile(tasksTemplate, "./generators/frosting/templates/task.cs");
/* The loop below will generate single-file task templates only. See Pantry README for more info.
foreach (var task in model.cake.frosting.tasks) {
Information("Rendering the template for Task '{0}'", task.name ?? "unknown");
var taskTemplate = RenderTemplateFromFile("./.templates/template/frosting/Tasks/Task.cs.hbs", task);
WriteTemplateToFile(taskTemplate, "./generators/frosting/templates/" + (task.name.Contains("<%") ? "task.cs" : (task.name + ".cs")));
}
} */
});

Task("Build-Templates")
Expand Down

0 comments on commit 2293a61

Please sign in to comment.