From 90ddf24cf3997d5db8bcf3bad6ef095f63c39f7e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 22 Mar 2019 08:19:43 +0000 Subject: [PATCH] Display the correct version on generated wiki pages. --- .../UtilityCommands/ExtractSettingsDocsCommand.cs | 9 +++++++-- .../UtilityCommands/ExtractTraitDocsCommand.cs | 8 ++++++-- .../UtilityCommands/ExtractWeaponDocsCommand.cs | 8 ++++++-- packaging/update-wiki.sh | 8 ++++---- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs index 4af333aec1..f57619e474 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs @@ -23,14 +23,19 @@ namespace OpenRA.Mods.Common.UtilityCommands return true; } - [Desc("Generate settings documentation in markdown format.")] + [Desc("[VERSION]", "Generate settings documentation in markdown format.")] void IUtilityCommand.Run(Utility utility, string[] args) { Game.ModData = utility.ModData; + + var version = utility.ModData.Manifest.Metadata.Version; + if (args.Length > 1) + version = args[1]; + Console.WriteLine( "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 " + - "automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version); + "automatically generated for version {0} of OpenRA.", version); Console.WriteLine(); Console.WriteLine("All settings can be changed by starting the game via a command-line parameter like `Game.Mod=ra`."); Console.WriteLine(); diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs index 44995d685c..0860a7aca6 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs @@ -25,16 +25,20 @@ namespace OpenRA.Mods.Common.UtilityCommands return true; } - [Desc("Generate trait documentation in MarkDown format.")] + [Desc("[VERSION]", "Generate trait documentation in MarkDown format.")] void IUtilityCommand.Run(Utility utility, string[] args) { // HACK: The engine code assumes that Game.modData is set. Game.ModData = utility.ModData; + var version = utility.ModData.Manifest.Metadata.Version; + if (args.Length > 1) + version = args[1]; + Console.WriteLine( "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 " + - "automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version); + "automatically generated for version {0} of OpenRA.", version); Console.WriteLine(); var toc = new StringBuilder(); diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs index faaa06c9c9..1d2d96098f 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs @@ -26,17 +26,21 @@ namespace OpenRA.Mods.Common.UtilityCommands return true; } - [Desc("Generate weaponry documentation in MarkDown format.")] + [Desc("[VERSION]", "Generate weaponry documentation in MarkDown format.")] void IUtilityCommand.Run(Utility utility, string[] args) { // HACK: The engine code assumes that Game.modData is set. Game.ModData = utility.ModData; + var version = utility.ModData.Manifest.Metadata.Version; + if (args.Length > 1) + version = args[1]; + Console.WriteLine( "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. " + "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(); var toc = new StringBuilder(); diff --git a/packaging/update-wiki.sh b/packaging/update-wiki.sh index 087c2bd587..894b2f76e0 100755 --- a/packaging/update-wiki.sh +++ b/packaging/update-wiki.sh @@ -27,10 +27,10 @@ chmod 0600 "$SSH_KEY" rm -rf "$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 --weapon-docs > "${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 --settings-docs > "${HOME}/openra-wiki/Settings${TAG}.md" +mono --debug ../OpenRA.Utility.exe all --docs "$1" > "${HOME}/openra-wiki/Traits${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 "$1" > "${HOME}/openra-wiki/Lua API${TAG}.md" +mono --debug ../OpenRA.Utility.exe all --settings-docs "$1" > "${HOME}/openra-wiki/Settings${TAG}.md" pushd "$HOME/openra-wiki" || exit 1 git config --local user.email "orabot@users.noreply.github.com"