Initial import

This commit is contained in:
Adam Patridge 2017-06-15 12:42:45 -06:00
parent e05a7cfae2
commit 7894853f73
6 changed files with 171 additions and 0 deletions

27
Cake.ArgumentHelpers.sln Normal file
View file

@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.ArgumentHelpers", "Cake.ArgumentHelpers\Cake.ArgumentHelpers.csproj", "{9C50A7C4-E00D-4851-8311-81135D062C77}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA17B50A-988B-47C1-9840-DC7347D88259}"
ProjectSection(SolutionItems) = preProject
Package.nuspec = Package.nuspec
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C50A7C4-E00D-4851-8311-81135D062C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C50A7C4-E00D-4851-8311-81135D062C77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C50A7C4-E00D-4851-8311-81135D062C77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C50A7C4-E00D-4851-8311-81135D062C77}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,21 @@
using System;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Common;
namespace Cake.ArgumentHelpers
{
public static class ArgumentOrEnvironmentVariableAlias
{
/// <summary>
/// Get a bool variable from various script inputs: first via Argument, then falling back on EnvironmentVariable, finally falling back on a default.
/// </summary>
/// <param name="environmentNamePrefix">An optional prefix used to qualify the same variable name when present in EnvironmentVariable form (e.g., "MySetting" command-line argument vs. "MyTool_MySetting" environment variable).</param>
/// <returns>Value found or default, first checked in command-line argument, then environment variable.</returns>
[CakeMethodAlias]
public static bool ArgumentOrEnvironmentVariable(this ICakeContext context, string name, string environmentNamePrefix, bool defaultValue)
{
return ArgumentAliases.Argument(context, name, EnvironmentAliases.EnvironmentVariable(context, (environmentNamePrefix ?? "") + name) ?? defaultValue.ToString()).Equals("true", StringComparison.OrdinalIgnoreCase);
}
}
}

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9C50A7C4-E00D-4851-8311-81135D062C77}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cake.ArgumentHelpers</RootNamespace>
<AssemblyName>Cake.ArgumentHelpers</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Cake.ArgumentHelpers.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cake.Common, Version=0.20.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Common.0.20.0\lib\net45\Cake.Common.dll</HintPath>
</Reference>
<Reference Include="Cake.Core, Version=0.20.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.20.0\lib\net45\Cake.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArgumentOrEnvironmentVariableAlias.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cake.ArgumentHelpers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cake.ArgumentHelpers")]
[assembly: AssemblyCopyright("Copyright 2017 © Adam Patridge")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9c50a7c4-e00d-4851-8311-81135d062c77")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake.Common" version="0.20.0" targetFramework="net452" />
<package id="Cake.Core" version="0.20.0" targetFramework="net452" />
</packages>

24
Package.nuspec Normal file
View file

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Cake.ArgumentHelpers</id>
<version>0.0.3</version>
<authors>Adam Patridge</authors>
<owners>Adam Patridge</owners>
<licenseUrl>https://github.com/patridge/Cake.ArgumentHelpers/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/patridge/Cake.ArgumentHelpers</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Cake add-on trying to make it easier to handle various inputs from arguments and environment variable.</description>
<releaseNotes>Initial release</releaseNotes>
<copyright>Copyright (c) Adam Patridge 2017</copyright>
<tags>Cake Script Build</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<file src="./Cake.ArgumentHelpers/bin/Release/Cake.ArgumentHelpers.dll" target="lib\net45" />
<file src="./Cake.ArgumentHelpers/bin/Release/Cake.ArgumentHelpers.xml" target="lib\net45" />
</files>
</package>