Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Deprecate Cake.SimpleVersion - Update documentation to use SimpleVersion.Tool #103

Merged
merged 5 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If applicable, add screenshots to help explain your problem.

**Environment**
- OS: [e.g. Windows]
- Implementation: [e.g. Commandline, Cake, Libraries]
- Implementation: [e.g. Commandline, Dotnet Tool, Libraries]
- Version [e.g. 0.1.0]

**Additional context**
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ packages
bin
obj
integration/temp
log.txt
/docs/api/*.yml
/docs/api/.manifest
coverage.json
dotnet-install.ps1
/docs/api/.manifest
7 changes: 0 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,4 @@
<ItemGroup Label="Shared Assets">
<AdditionalFiles Include="$(MSBuildThisFileDirectory)shared/stylecop.json" Link="stylecop.json" />
</ItemGroup>

<PropertyGroup>
<SkipDefaultEditorConfigAsAdditionalFile>true</SkipDefaultEditorConfigAsAdditionalFile>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory).editorconfig" />
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project>

<!-- Ensure the targets for Central package management are imported -->
<Import Project="Sdk.targets" Sdk="Microsoft.Build.CentralPackageVersions"/>

<ItemDefinitionGroup>
<NeedsGeneration>
<GeneratedFileName>%(Filename).Generated.cs</GeneratedFileName>
Expand Down
10 changes: 4 additions & 6 deletions Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
Centrally managed packages for all projects in the solution
-->
<ItemGroup Label="Source library packages">
<PackageReference Update="Cake.Core" Version="0.34.*" />
<PackageReference Update="LibGit2Sharp" Version="0.25.3" />
<PackageReference Update="LibGit2Sharp.NativeBinaries" Version="1.0.235" />
<PackageReference Update="System.Text.Json" Version="4.6.*" />
<PackageReference Update="LibGit2Sharp" Version="0.26.*" />
<PackageReference Update="System.Text.Json" Version="4.7.*" />

</ItemGroup>

Expand All @@ -28,7 +26,7 @@

<ItemGroup Label="Test only tooling"
Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<GlobalPackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.*" />
<GlobalPackageReference Include="coverlet.msbuild" Version="2.7.*" />
<GlobalPackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.*" />
<GlobalPackageReference Include="coverlet.msbuild" Version="2.*" />
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions SimpleVersion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleVersion.Core.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleVersion.Abstractions.Tests", "test\SimpleVersion.Abstractions.Tests\SimpleVersion.Abstractions.Tests.csproj", "{D95890EA-093F-4FAD-8E30-E372DD946F32}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleVersion.Cake", "src\SimpleVersion.Cake\SimpleVersion.Cake.csproj", "{3A9E63F3-574A-4FB9-B00D-685AE077E0BF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{385532A7-26BE-4596-9EEE-E7C3984643ED}"
ProjectSection(SolutionItems) = preProject
shared\logo.png = shared\logo.png
Expand Down Expand Up @@ -71,10 +69,6 @@ Global
{D95890EA-093F-4FAD-8E30-E372DD946F32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D95890EA-093F-4FAD-8E30-E372DD946F32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D95890EA-093F-4FAD-8E30-E372DD946F32}.Release|Any CPU.Build.0 = Release|Any CPU
{3A9E63F3-574A-4FB9-B00D-685AE077E0BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A9E63F3-574A-4FB9-B00D-685AE077E0BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A9E63F3-574A-4FB9-B00D-685AE077E0BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A9E63F3-574A-4FB9-B00D-685AE077E0BF}.Release|Any CPU.Build.0 = Release|Any CPU
{283AA9B6-B543-43C9-B512-BA54B36799B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{283AA9B6-B543-43C9-B512-BA54B36799B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{283AA9B6-B543-43C9-B512-BA54B36799B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -88,7 +82,6 @@ Global
{C3908FD1-A959-4687-9221-C058698B126A} = {D5992CB5-3542-41C8-BE85-F52699729C57}
{C367CC5A-5ACC-442A-8885-ED9A94A9A43E} = {9EEF54AE-EEE2-4817-B0D0-AFAE3F52C231}
{D95890EA-093F-4FAD-8E30-E372DD946F32} = {9EEF54AE-EEE2-4817-B0D0-AFAE3F52C231}
{3A9E63F3-574A-4FB9-B00D-685AE077E0BF} = {D5992CB5-3542-41C8-BE85-F52699729C57}
{283AA9B6-B543-43C9-B512-BA54B36799B4} = {D5992CB5-3542-41C8-BE85-F52699729C57}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
70 changes: 55 additions & 15 deletions docs/articles/intro.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Introduction
============

SimpleVersion is available as a cross-platform dotnet tool, a netstandard Cake
addin, or as a collection of libraries for direct consumption in a project.
SimpleVersion is available as a cross-platform dotnet tool and core libraries for direct consumption in a project.

To get a better understanding of the values returned from invoking SimpleVersion
see the [results documentation][results].
Expand All @@ -11,7 +10,7 @@ Dotnet Tool
-----------------

The latest version of the dotnet tool can be found on nuget.org.
You can install SimpleVersion.Tool the [dotnet cli]:
You can install `SimpleVersion.Tool` the [dotnet cli]:

```posh
# Installs the latest version as a global tool
Expand All @@ -25,36 +24,51 @@ PS c:\MyRepo> simpleversion
PS c:\> simpleversion ./MyRepo
```

Cake Addin
----------
Usage in Cake
-------------

The `Cake.SimpleVersion` addin can be used in a Cake build script to invoke
SimpleVersion.
The dotnet tool can be integrated into a Cake build script. This makes use
of the [Cake.DotNetTool.Module] to enable installing `SimpleVersion.Tool`.
> You will need to run `.\build.ps1 --bootstrap` prior to running `.\build.ps1` to ensure correct installation of the tool.

A simple `build.cake` can invoke the `SimpleVersion`:

```c#
// Include the Cake addin
#addin nuget:?package=Cake.SimpleVersion&prerelease
// Install dotnet core tool module
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0
// Install SimpleVersion dotnet tool
#tool dotnet:?package=SimpleVersion.Tool&version=0.3.0
// Install newtonsoft to parse result
#addin nuget:?package=Newtonsoft.Json&version=12.0.3
// Import newtonsoft namespace for parsing
using Newtonsoft.Json.Linq;

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////

var target = Argument("target", "Default");
var versionFormat = Argument("versionFormat", "Semver1");

// Call SimpleVersion to get version information
var versionInfo = SimpleVersion();

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Build")
.Does(() =>
{
// Display version - Access formats dictionary or other properties
Information($"My {versionFormat} is: {versionInfo.Formats[versionFormat]}");
// Call SimpleVersion to get version information
StartProcess(
Context.Tools.Resolve("simpleversion.exe"),
new ProcessSettings{ RedirectStandardOutput = true },
out var simpleVersionOut // capture output for parsing
);

// Parse json result
dynamic simpleVersion = JObject.Parse(string.Join("", simpleVersionOut));

// Display version - Access formats dictionary or other properties
Information(simpleVersion.Formats[versionFormat]);
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -70,7 +84,33 @@ Task("Default")

RunTarget(target);
```
Which can then be invoked as:

```posh
▶ .\build.ps1 --bootstrap; .\build.ps1
Preparing to run build script...
Running build script...
Preparing to run build script...
Running build script...

========================================
Build
========================================
0.3.0-alpha1-0002-c6c70600

========================================
Default
========================================

Task Duration
--------------------------------------------------
Build 00:00:00.3256116
--------------------------------------------------
Total: 00:00:00.3304598
```
> You change the arguments passed to `SimpleVersion` using the [ProcessSettings] class.

[Results]: ./results.md
[dotnet cli]: https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools
[dotnet cli]: https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools
[Cake.DotNetTool.Module]: https://www.gep13.co.uk/blog/introducing-cake.dotnettool.module
[ProcessSettings]: https://cakebuild.net/api/Cake.Core.IO/ProcessSettings/
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System;

namespace SimpleVersion.Abstractions.Exceptions
namespace SimpleVersion.Exceptions
{
/// <summary>
/// Represents a Git error within the application.
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleVersion.Abstractions/IEnvironment.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

namespace SimpleVersion.Abstractions
namespace SimpleVersion
{
/// <summary>
/// Contract for accessing environment variables.
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleVersion.Abstractions/IVersionCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using SimpleVersion.Model;

namespace SimpleVersion.Abstractions
namespace SimpleVersion
{
/// <summary>
/// Contract for the calculation process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using SimpleVersion.Model;

namespace SimpleVersion.Abstractions.Pipeline
namespace SimpleVersion.Pipeline
{
/// <summary>
/// Encapsulates state during version calculation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

namespace SimpleVersion.Abstractions.Pipeline
namespace SimpleVersion.Pipeline
{
/// <summary>
/// Contract for a processor step during version calculation.
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleVersion.Abstractions/Rules/ITokenRule.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

using System.Collections.Generic;
using SimpleVersion.Abstractions.Pipeline;
using SimpleVersion.Pipeline;

namespace SimpleVersion.Abstractions.Rules
namespace SimpleVersion.Rules
{
/// <summary>
/// Contract for a rule which applies for a specific token.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Microsoft.Build.CentralPackageVersions" />

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>SimpleVersion</RootNamespace>
</PropertyGroup>

</Project>
36 changes: 0 additions & 36 deletions src/SimpleVersion.Cake/CakeAliases.cs

This file was deleted.

32 changes: 0 additions & 32 deletions src/SimpleVersion.Cake/SimpleVersion.Cake.csproj

This file was deleted.

Binary file removed src/SimpleVersion.Cake/logo.png
Binary file not shown.
4 changes: 2 additions & 2 deletions src/SimpleVersion.Core/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SimpleVersion
/// Simple exception handling asserts.
/// </summary>
[ExcludeFromCodeCoverage]
public static class Assert
internal static class Assert
{
/// <summary>
/// Asserts the given argument value is not null.
Expand All @@ -21,7 +21,7 @@ public static class Assert
/// <exception cref="ArgumentNullException">Thrown if the given value is null.</exception>
/// <returns>The value if not null.</returns>
[DebuggerStepThrough]
public static T ArgumentNotNull<T>(T value, string name)
internal static T ArgumentNotNull<T>(T value, string name)
{
if (value == null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

using System.Text.RegularExpressions;
using SimpleVersion.Abstractions;
using SimpleVersion.Abstractions.Pipeline;
using SimpleVersion.Extensions;

namespace SimpleVersion.Pipeline
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

using SimpleVersion.Abstractions.Pipeline;
using SimpleVersion.Abstractions.Rules;
using SimpleVersion.Rules;

namespace SimpleVersion.Pipeline.Formatting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

using SimpleVersion.Abstractions.Pipeline;
using SimpleVersion.Abstractions.Rules;
using SimpleVersion.Rules;

namespace SimpleVersion.Pipeline.Formatting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed under the MIT license. See https://kieranties.mit-license.org/ for full license information.

using System;
using SimpleVersion.Abstractions.Pipeline;
using SimpleVersion.Rules;

namespace SimpleVersion.Pipeline.Formatting
Expand Down
Loading