diff --git a/Beverage/Beverage.csproj b/Beverage/Beverage.csproj new file mode 100644 index 0000000..5035016 --- /dev/null +++ b/Beverage/Beverage.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.1 + + + + + + + diff --git a/Beverage/Commands/BlackRussian.cs b/Beverage/Commands/BlackRussian.cs new file mode 100644 index 0000000..a5adab5 --- /dev/null +++ b/Beverage/Commands/BlackRussian.cs @@ -0,0 +1,29 @@ +using System; +using GoCommando; + +namespace Beverage.Commands +{ + [Command("black-russian", group: "duderino")] + [Description("Mixes a White Russian, pouring in milk till full")] + public class BlackRussian : ICommand + { + [Parameter("vodka")] + [Description("How many cl of vodka?")] + public double Vodka { get; set; } + + [Parameter("kahlua")] + [Description("How many cl of Kahlua?")] + public double Kahlua { get; set; } + + [Parameter("lukewarm", optional: true)] + [Description("Avoid refrigerated ingredients?")] + public bool LukeWarm { get; set; } + + public void Run() + { + Console.WriteLine($"Making a {(LukeWarm ? "luke-warm" : "")} beverage" + + $" with {Vodka:0.#} cl of vodka" + + $" and {Kahlua:0.#} cl of Kahlua"); + } + } +} \ No newline at end of file diff --git a/Beverage/Commands/Martini.cs b/Beverage/Commands/Martini.cs new file mode 100644 index 0000000..8c6cbf4 --- /dev/null +++ b/Beverage/Commands/Martini.cs @@ -0,0 +1,14 @@ +using GoCommando; + +namespace Beverage.Commands +{ + [Command("martini", group: "simple")] + [Description("It's just Martini.")] + public class Martini : ICommand + { + public void Run() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Beverage/Commands/WhiteRussian.cs b/Beverage/Commands/WhiteRussian.cs new file mode 100644 index 0000000..9ae6c48 --- /dev/null +++ b/Beverage/Commands/WhiteRussian.cs @@ -0,0 +1,29 @@ +using System; +using GoCommando; + +namespace Beverage.Commands +{ + [Command("white-russian", group: "duderino")] + [Description("Mixes a White Russian, pouring in milk till full")] + public class WhiteRussian : ICommand + { + [Parameter("vodka")] + [Description("How many cl of vodka?")] + public double Vodka { get; set; } + + [Parameter("kahlua")] + [Description("How many cl of Kahlua?")] + public double Kahlua { get; set; } + + [Parameter("lukewarm", optional: true)] + [Description("Avoid refrigerated ingredients?")] + public bool LukeWarm { get; set; } + + public void Run() + { + Console.WriteLine($"Making a {(LukeWarm ? "luke-warm" : "")} beverage" + + $" with {Vodka:0.#} cl of vodka" + + $" and {Kahlua:0.#} cl of Kahlua"); + } + } +} \ No newline at end of file diff --git a/Beverage/Program.cs b/Beverage/Program.cs new file mode 100644 index 0000000..95b3983 --- /dev/null +++ b/Beverage/Program.cs @@ -0,0 +1,18 @@ +using GoCommando; + +namespace Beverage +{ + [Banner(@"------------------------------ +Beverage Utility + +Copyright (c) 2015 El Duderino +------------------------------")] + [SupportImpersonation] + class Program + { + static void Main() + { + Go.Run(); + } + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6adc174 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.0.1 +* Test release + diff --git a/GoCommando.sln b/GoCommando.sln index 030255c..64f69d9 100644 --- a/GoCommando.sln +++ b/GoCommando.sln @@ -4,15 +4,18 @@ VisualStudioVersion = 16.0.30330.147 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stuff", "stuff", "{4777EF91-8FBF-42DC-A31F-2025CC5841F8}" ProjectSection(SolutionItems) = preProject + CHANGELOG.md = CHANGELOG.md Package.nuspec = Package.nuspec README.md = README.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{94F2785A-49E5-447F-BAFF-BE8F783EC71F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoCommando", "GoCommando\GoCommando.csproj", "{91A9A887-0298-4B72-9D24-C2438F469192}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoCommando", "GoCommando\GoCommando.csproj", "{91A9A887-0298-4B72-9D24-C2438F469192}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoCommando.Tests", "GoCommando.Tests\GoCommando.Tests.csproj", "{FBD7AE5E-C842-448B-9A6B-81513E60F357}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoCommando.Tests", "GoCommando.Tests\GoCommando.Tests.csproj", "{FBD7AE5E-C842-448B-9A6B-81513E60F357}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Beverage", "Beverage\Beverage.csproj", "{D7C8D131-E81A-4846-A9EE-9D42A667CA32}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -28,10 +31,17 @@ Global {FBD7AE5E-C842-448B-9A6B-81513E60F357}.Debug|Any CPU.Build.0 = Debug|Any CPU {FBD7AE5E-C842-448B-9A6B-81513E60F357}.Release|Any CPU.ActiveCfg = Release|Any CPU {FBD7AE5E-C842-448B-9A6B-81513E60F357}.Release|Any CPU.Build.0 = Release|Any CPU + {D7C8D131-E81A-4846-A9EE-9D42A667CA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7C8D131-E81A-4846-A9EE-9D42A667CA32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7C8D131-E81A-4846-A9EE-9D42A667CA32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7C8D131-E81A-4846-A9EE-9D42A667CA32}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D7C8D131-E81A-4846-A9EE-9D42A667CA32} = {94F2785A-49E5-447F-BAFF-BE8F783EC71F} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F99A8DD1-DE53-43D3-A0E0-BE222C826E90} EndGlobalSection diff --git a/scripts/build.cmd b/scripts/build.cmd new file mode 100644 index 0000000..c2da324 --- /dev/null +++ b/scripts/build.cmd @@ -0,0 +1,46 @@ +@echo off + +set scriptsdir=%~dp0 +set root=%scriptsdir%\.. +set project=%1 +set version=%2 + +if "%project%"=="" ( + echo Please invoke the build script with a project name as its first argument. + echo. + goto exit_fail +) + +if "%version%"=="" ( + echo Please invoke the build script with a version as its second argument. + echo. + goto exit_fail +) + +set Version=%version% + +pushd %root% + +dotnet restore +if %ERRORLEVEL% neq 0 ( + popd + goto exit_fail +) + +dotnet build "%root%\%project%" -c Release +if %ERRORLEVEL% neq 0 ( + popd + goto exit_fail +) + +popd + + + + + + +goto exit_success +:exit_fail +exit /b 1 +:exit_success \ No newline at end of file diff --git a/scripts/patch_assemblyinfo.cmd b/scripts/patch_assemblyinfo.cmd new file mode 100644 index 0000000..c7e5bd3 --- /dev/null +++ b/scripts/patch_assemblyinfo.cmd @@ -0,0 +1,12 @@ +@echo off + +set reporoot=%~dp0\.. +set aversion=%reporoot%\tools\aversion\aversion +set projectdir=%1 + +if "%version%"=="" ( + "%aversion%" patch -ver 1.0.0 -in %projectdir%\Properties\AssemblyInfo.cs -out %projectdir%\Properties\AssemblyInfo_Patch.cs -token $version$ +) else ( + "%aversion%" patch -ver %version% -in %projectdir%\Properties\AssemblyInfo.cs -out %projectdir%\Properties\AssemblyInfo_Patch.cs -token $version$ +) + diff --git a/scripts/push.cmd b/scripts/push.cmd new file mode 100644 index 0000000..2cb4ccc --- /dev/null +++ b/scripts/push.cmd @@ -0,0 +1,44 @@ +@echo off + +set version=%1 + +if "%version%"=="" ( + echo Please remember to specify which version to push as an argument. + goto exit_fail +) + +set reporoot=%~dp0\.. +set destination=%reporoot%\deploy + +if not exist "%destination%" ( + echo Could not find %destination% + echo. + echo Did you remember to build the packages before running this script? +) + +set nuget=%reporoot%\tools\NuGet\NuGet.exe + +if not exist "%nuget%" ( + echo Could not find NuGet here: + echo. + echo "%nuget%" + echo. + goto exit_fail +) + + +"%nuget%" push "%destination%\*.%version%.nupkg" -Source https://www.nuget.org/api/v2/package +if %ERRORLEVEL% neq 0 ( + echo NuGet push failed. + goto exit_fail +) + + + + + + +goto exit_success +:exit_fail +exit /b 1 +:exit_success diff --git a/scripts/release.cmd b/scripts/release.cmd new file mode 100644 index 0000000..4247bce --- /dev/null +++ b/scripts/release.cmd @@ -0,0 +1,53 @@ +@echo off + +set scriptsdir=%~dp0 +set root=%scriptsdir%\.. +set deploydir=%root%\deploy +set project=%1 +set version=%2 + +if "%project%"=="" ( + echo Please invoke the build script with a project name as its first argument. + echo. + goto exit_fail +) + +if "%version%"=="" ( + echo Please invoke the build script with a version as its second argument. + echo. + goto exit_fail +) + +set Version=%version% + +if exist "%deploydir%" ( + rd "%deploydir%" /s/q +) + +pushd %root% + +dotnet restore +if %ERRORLEVEL% neq 0 ( + popd + goto exit_fail +) + +dotnet pack "%root%/%project%" -c Release -o "%deploydir%" /p:PackageVersion=%version% +if %ERRORLEVEL% neq 0 ( + popd + goto exit_fail +) + +call scripts\push.cmd "%version%" + +popd + + + + + + +goto exit_success +:exit_fail +exit /b 1 +:exit_success \ No newline at end of file