Skip to content
Permalink
Browse files

Initial commit

  • Loading branch information...
nalla committed Jul 21, 2017
0 parents commit d19379b2370199ea7094e0931d54d50501c4b1c3
@@ -0,0 +1,20 @@
root = true

[*]
end_of_line = crlf
insert_final_newline = true

[*.cs]
indent_style = tab
indent_size = 4
charset = utf-8

[*.cake]
indent_style = tab
indent_size = 2
charset = utf-8

[*.{config,xml,xaml,csproj,proj}]
indent_style = space
indent_size = 2
charset = utf-8
@@ -0,0 +1,19 @@
* text=auto

*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
@@ -0,0 +1,62 @@
# Misc folders
[Bb]in/
[Oo]bj/
[Pp]ackages/
/artifacts/

# Cake related
/tools/

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
*.sln.ide/
*.userprefs
*.GhostDoc.xml

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml
_NCrunch_*

# Windows
Thumbs.db

# NUnit
TestResult.xml
21 LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 engelbert strauss GmbH & Co. KG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,50 @@
Usage
=====

In order to use this _Cake_ addin you need to add it to your `build.cake`
file in the following way

```c#
#addin Cake.Endpoint
```

After that the following _Cake_ aliases are available to you.

EndpointCreate
--------------

Copies files and directories defined within endpoint definition.

```c#
Task( "Create" )
.Does( () =>
{
EndpointCreate( new Endpoint()[] );
} );
```

Providing an endpoint

An endpoint should be provided within the solution through an
`endpoints.json` file. The file can be deserialized using the _Cake.Json_
addin in following way:

```c#
var endpoint = DeserializeJsonFromFile<Endpoint>( "./endpoint.json" );
```

[Example endpoint file](./docs/Endpoints_example.json)

Development
===========

Just execute the following commands after you have commited your work.

```PowerShell
$> git tag <semver>
$> .\build.ps1 -target pack
$> git push origin master --tags
```

Then publish the resulting `.\Cake.Endpoint.<semver>.nupkg` on
[nuget.org](https://www.nuget.org)
@@ -0,0 +1,152 @@
///////////////////////////////////////////////////////////////////////////
// This is the main build file.
//
// The following targets are the prefered entrypoints:
// * Build
// * Test
// * Publish
//
// You can call these targets by using the bootstrapper powershell script
// next to this file: .\build.ps1 -target <target>
///////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////
// Load additional cake addins
///////////////////////////////////////////////////////////////////////////
#addin Cake.Git

///////////////////////////////////////////////////////////////////////////
// Load additional tools
///////////////////////////////////////////////////////////////////////////
#tool "nuget:?package=xunit.runner.console"
#tool "nuget:?package=GitVersion.CommandLine"

///////////////////////////////////////////////////////////////////////////
// Commandline argument handling
///////////////////////////////////////////////////////////////////////////
string target = Argument( "target", "Default" );
string configuration = Argument( "configuration", "Release" );

///////////////////////////////////////////////////////////////////////////
// Constants, initial variables
///////////////////////////////////////////////////////////////////////////
string projectName = "Cake.Endpoint";
string testProjectName = "Cake.Endpoint.Tests";
FilePath project = "./src/" + projectName + "/" + projectName + ".csproj";
FilePath testProject = "./src/" + testProjectName + "/" + testProjectName + ".csproj";
DirectoryPath artifacts = "./artifacts";
GitVersion version = GitVersion();

///////////////////////////////////////////////////////////////////////////
// Helper: GetReleaseNotes
//
// Parses the git commits since the last tag to render some release notes
// that will be taken into account when publishing the repository.
///////////////////////////////////////////////////////////////////////////
string[] GetReleaseNotes()
{
IEnumerable<string> changes;
string tag;

try
{
tag = GitDescribe( ".", "HEAD~1", false, GitDescribeStrategy.All, 0 );
}
catch( Exception e)
{
return new string[0];
}

string commitRange = tag + "..HEAD";

StartProcess( "git", new ProcessSettings
{
RedirectStandardOutput = true,
Silent = true,
Arguments = "log " + commitRange + " --no-merges --format=\"[%h] %s\""
}, out changes );

return changes.ToArray();
}

///////////////////////////////////////////////////////////////////////////
// Task: Clean
///////////////////////////////////////////////////////////////////////////
Task( "Clean" )
.Does( () =>
{
CleanDirectories( "./src/**/bin/" + configuration );
CleanDirectories( "./src/**/obj" );
CleanDirectory( artifacts );
} );

///////////////////////////////////////////////////////////////////////////
// Task: Restore
///////////////////////////////////////////////////////////////////////////
Task( "Restore" )
.Does( () =>
{
DotNetCoreRestore( project.FullPath);
DotNetCoreRestore( testProject.FullPath );
} );

///////////////////////////////////////////////////////////////////////////
// Task: Build
///////////////////////////////////////////////////////////////////////////
Task( "Build" )
.IsDependentOn( "Clean" )
.IsDependentOn( "Restore" )
.Does( () =>
{
DotNetCoreBuild( project.FullPath, new DotNetCoreBuildSettings{
Configuration = configuration
} );
} );

///////////////////////////////////////////////////////////////////////////
// Task: Test
///////////////////////////////////////////////////////////////////////////
Task( "Test" )
.IsDependentOn( "Clean" )
.IsDependentOn( "Build" )
.Does( () =>
{
DotNetCoreTest( testProject.FullPath );
} );

///////////////////////////////////////////////////////////////////////////
// Task: Pack
///////////////////////////////////////////////////////////////////////////
Task( "Pack" )
.IsDependentOn( "Clean" )
.IsDependentOn( "Build" )
.IsDependentOn( "Test" )
.Does ( () =>
{
var nugetDirectory = artifacts.Combine( "nuget" );

EnsureDirectoryExists( nugetDirectory );

DotNetCorePack( project.FullPath, new DotNetCorePackSettings {
IncludeSymbols = true,
NoBuild = true,
OutputDirectory = nugetDirectory,
ArgumentCustomization = args =>
{
return args
.Append( "/p:PackageVersion=" + version.NuGetVersion )
.AppendQuoted( "/p:PackageReleaseNotes=" + string.Join( "\n", GetReleaseNotes() ) );
}
} );
} );

///////////////////////////////////////////////////////////////////////////
// Task: Default
///////////////////////////////////////////////////////////////////////////
Task( "Default" )
.IsDependentOn( "Build" );

///////////////////////////////////////////////////////////////////////////
// Script Execution
///////////////////////////////////////////////////////////////////////////
RunTarget( target );

0 comments on commit d19379b

Please sign in to comment.
You can’t perform that action at this time.