Skip to content

Commit

Permalink
Use the Description for the README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Aug 19, 2024
1 parent 78f3443 commit 6d5cce3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions PackContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public class PackContext

public string LicensePath { get; }

public string ReadMePath { get; }

public string? RepositoryOwner { get; }

public string? RepositoryUrl { get; }
Expand All @@ -29,7 +27,6 @@ public PackContext(ICakeContext context)
CommandName = context.Argument("commandname", "X");
ExecutableName = context.Argument("executablename", "X");
LicensePath = context.Argument("licensepath", "");
ReadMePath = context.Argument("readmepath", "");
Version = context.Argument("version", "1.0.0");
RepositoryUrl = "X";
IsTag = false;
Expand Down
2 changes: 1 addition & 1 deletion Resources/MonoGame.Tool.X.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<PropertyGroup>
<Title>MonoGame build of {X} Tool</Title>
<Description>This package contains executables for {X} built for usage with MonoGame.</Description>
<Description>{Description}</Description>
</PropertyGroup>

<PropertyGroup>
Expand Down
12 changes: 7 additions & 5 deletions Tasks/PublishPackageTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ public override async Task RunAsync(BuildContext context)
if (licensePath.EndsWith(".txt")) licenseName += ".txt";
else if (licensePath.EndsWith(".md")) licenseName += ".md";

var readMePath = context.PackContext.ReadMePath;
var readMeName = "README";
var readMeName = "README.md";
var readMePath = $"{projectDir}/{readMeName}";

if (readMePath.EndsWith(".txt")) readMeName += ".txt";
else if (readMePath.EndsWith(".md")) readMeName += ".md";
var description = $"This package contains executables for {context.PackContext.ToolName} built for usage with MonoGame.";

var contentInclude = $"<None Include=\"binaries\\**\\*\" CopyToOutputDirectory=\"PreserveNewest\" />";

var projectData = await ReadEmbeddedResourceAsync("MonoGame.Tool.X.txt");
projectData = projectData.Replace("{X}", context.PackContext.ToolName)
.Replace("{Description}", description)
.Replace("{CommandName}", context.PackContext.CommandName)
.Replace("{LicensePath}", context.PackContext.LicensePath)
.Replace("{ReadMePath}", context.PackContext.ReadMePath)
.Replace("{ReadMePath}", readMeName)
.Replace("{LicenseName}", licenseName)
.Replace("{ReadMeName}", readMeName)
.Replace("{ContentInclude}", contentInclude);
Expand All @@ -88,6 +88,8 @@ public override async Task RunAsync(BuildContext context)
var programPath = $"{projectDir}/Program.cs";
await File.WriteAllTextAsync(programPath, programData);

await File.WriteAllTextAsync(readMePath, description);

await SaveEmbeddedResourceAsync("Icon.png", $"{projectDir}/Icon.png");

// Pack the project into a dotnet tool
Expand Down

0 comments on commit 6d5cce3

Please sign in to comment.