Display the correct version on generated wiki pages.

This commit is contained in:
Paul Chote
2019-03-22 08:19:43 +00:00
committed by reaperrr
parent d7ff894346
commit 90ddf24cf3
4 changed files with 23 additions and 10 deletions

View File

@@ -23,14 +23,19 @@ namespace OpenRA.Mods.Common.UtilityCommands
return true; return true;
} }
[Desc("Generate settings documentation in markdown format.")] [Desc("[VERSION]", "Generate settings documentation in markdown format.")]
void IUtilityCommand.Run(Utility utility, string[] args) void IUtilityCommand.Run(Utility utility, string[] args)
{ {
Game.ModData = utility.ModData; Game.ModData = utility.ModData;
var version = utility.ModData.Manifest.Metadata.Version;
if (args.Length > 1)
version = args[1];
Console.WriteLine( Console.WriteLine(
"This documentation displays annotated settings with default values and description. " + "This documentation displays annotated settings with default values and description. " +
"Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " + "Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version); "automatically generated for version {0} of OpenRA.", version);
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("All settings can be changed by starting the game via a command-line parameter like `Game.Mod=ra`."); Console.WriteLine("All settings can be changed by starting the game via a command-line parameter like `Game.Mod=ra`.");
Console.WriteLine(); Console.WriteLine();

View File

@@ -25,16 +25,20 @@ namespace OpenRA.Mods.Common.UtilityCommands
return true; return true;
} }
[Desc("Generate trait documentation in MarkDown format.")] [Desc("[VERSION]", "Generate trait documentation in MarkDown format.")]
void IUtilityCommand.Run(Utility utility, string[] args) void IUtilityCommand.Run(Utility utility, string[] args)
{ {
// HACK: The engine code assumes that Game.modData is set. // HACK: The engine code assumes that Game.modData is set.
Game.ModData = utility.ModData; Game.ModData = utility.ModData;
var version = utility.ModData.Manifest.Metadata.Version;
if (args.Length > 1)
version = args[1];
Console.WriteLine( Console.WriteLine(
"This documentation is aimed at modders. It displays all traits with default values and developer commentary. " + "This documentation is aimed at modders. It displays all traits with default values and developer commentary. " +
"Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " + "Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version); "automatically generated for version {0} of OpenRA.", version);
Console.WriteLine(); Console.WriteLine();
var toc = new StringBuilder(); var toc = new StringBuilder();

View File

@@ -26,17 +26,21 @@ namespace OpenRA.Mods.Common.UtilityCommands
return true; return true;
} }
[Desc("Generate weaponry documentation in MarkDown format.")] [Desc("[VERSION]", "Generate weaponry documentation in MarkDown format.")]
void IUtilityCommand.Run(Utility utility, string[] args) void IUtilityCommand.Run(Utility utility, string[] args)
{ {
// HACK: The engine code assumes that Game.modData is set. // HACK: The engine code assumes that Game.modData is set.
Game.ModData = utility.ModData; Game.ModData = utility.ModData;
var version = utility.ModData.Manifest.Metadata.Version;
if (args.Length > 1)
version = args[1];
Console.WriteLine( Console.WriteLine(
"This documentation is aimed at modders. It displays a template for weapon definitions " + "This documentation is aimed at modders. It displays a template for weapon definitions " +
"as well as its contained types (warheads and projectiles) with default values and developer commentary. " + "as well as its contained types (warheads and projectiles) with default values and developer commentary. " +
"Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " + "Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version); "automatically generated for version {0} of OpenRA.", version);
Console.WriteLine(); Console.WriteLine();
var toc = new StringBuilder(); var toc = new StringBuilder();

View File

@@ -27,10 +27,10 @@ chmod 0600 "$SSH_KEY"
rm -rf "$HOME/openra-wiki" rm -rf "$HOME/openra-wiki"
git clone git@github.com:OpenRA/OpenRA.wiki.git "$HOME/openra-wiki" git clone git@github.com:OpenRA/OpenRA.wiki.git "$HOME/openra-wiki"
mono --debug ../OpenRA.Utility.exe all --docs > "${HOME}/openra-wiki/Traits${TAG}.md" mono --debug ../OpenRA.Utility.exe all --docs "$1" > "${HOME}/openra-wiki/Traits${TAG}.md"
mono --debug ../OpenRA.Utility.exe all --weapon-docs > "${HOME}/openra-wiki/Weapons${TAG}.md" mono --debug ../OpenRA.Utility.exe all --weapon-docs "$1" > "${HOME}/openra-wiki/Weapons${TAG}.md"
mono --debug ../OpenRA.Utility.exe all --lua-docs > "${HOME}/openra-wiki/Lua API${TAG}.md" mono --debug ../OpenRA.Utility.exe all --lua-docs "$1" > "${HOME}/openra-wiki/Lua API${TAG}.md"
mono --debug ../OpenRA.Utility.exe all --settings-docs > "${HOME}/openra-wiki/Settings${TAG}.md" mono --debug ../OpenRA.Utility.exe all --settings-docs "$1" > "${HOME}/openra-wiki/Settings${TAG}.md"
pushd "$HOME/openra-wiki" || exit 1 pushd "$HOME/openra-wiki" || exit 1
git config --local user.email "orabot@users.noreply.github.com" git config --local user.email "orabot@users.noreply.github.com"