Skip to content

Commit

Permalink
added an automatic substitution for rake task prefixes. Closes FubuMv…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Dec 4, 2013
1 parent a84b911 commit 4d05963
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/FubuCsProjFile.Testing/Templating/ProjectPlanTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public void short_name_is_set_automatically()
.ShouldEqual("Diagnostics");
}

[Test]
public void rake_task_prefix_is_set_by_short_name()
{
new ProjectPlan("FubuMVC.Diagnostics")
.Substitutions.ValueFor(ProjectPlan.RAKE_TASK_PREFIX)
.ShouldEqual("diagnostics");
}

[Test]
public void short_name_is_set_automatically_2()
{
Expand Down
8 changes: 7 additions & 1 deletion src/FubuCsProjFile/Templating/Runtime/ProjectPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class ProjectPlan : ITemplateStep
public const string SHORT_NAME = "%SHORT_NAME%";
public const string PROJECT_PATH = "%PROJECT_PATH%";
public const string PROJECT_FOLDER = "%PROJECT_FOLDER%";
public const string RAKE_TASK_PREFIX = "%RAKE_TASK_PREFIX%";

public static readonly string TemplateFile = "csproj.xml";

private readonly string _projectName;
Expand All @@ -28,7 +30,11 @@ public ProjectPlan(string projectName)
_projectName = projectName;

_substitutions.Set(ASSEMBLY_NAME, projectName);
_substitutions.Set(SHORT_NAME, projectName.Split('.').Last());
var shortName = projectName.Split('.').Last();
_substitutions.Set(SHORT_NAME, shortName);

_substitutions.Set(RAKE_TASK_PREFIX, shortName.ToLower());


DotNetVersion = FubuCsProjFile.DotNetVersion.V40;
}
Expand Down

0 comments on commit 4d05963

Please sign in to comment.