Skip to content

Commit

Permalink
add things
Browse files Browse the repository at this point in the history
  • Loading branch information
mookid8000 committed Aug 7, 2020
1 parent f907665 commit efba30a
Show file tree
Hide file tree
Showing 11 changed files with 274 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Beverage/Beverage.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GoCommando\GoCommando.csproj" />
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions Beverage/Commands/BlackRussian.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
14 changes: 14 additions & 0 deletions Beverage/Commands/Martini.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
29 changes: 29 additions & 0 deletions Beverage/Commands/WhiteRussian.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
18 changes: 18 additions & 0 deletions Beverage/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using GoCommando;

namespace Beverage
{
[Banner(@"------------------------------
Beverage Utility
Copyright (c) 2015 El Duderino
------------------------------")]
[SupportImpersonation]
class Program
{
static void Main()
{
Go.Run();
}
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.0.1
* Test release

14 changes: 12 additions & 2 deletions GoCommando.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
46 changes: 46 additions & 0 deletions scripts/build.cmd
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions scripts/patch_assemblyinfo.cmd
Original file line number Diff line number Diff line change
@@ -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$
)

44 changes: 44 additions & 0 deletions scripts/push.cmd
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions scripts/release.cmd
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit efba30a

Please sign in to comment.