Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinmoris committed Jan 22, 2018
2 parents 0c74843 + 69a6400 commit e52972b
Show file tree
Hide file tree
Showing 36 changed files with 5,604 additions and 16 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Giraffe web application template for the `dotnet new` command.
- [Optional parameters](#optional-parameters)
- [--ViewEngine](#--viewengine)
- [--IncludeTests](#--includetests)
- [--UsePaket](#--usepaket)
- [Updating the template](#updating-the-template)
- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)
- [More information](#more-information)
Expand Down Expand Up @@ -49,6 +50,7 @@ The Giraffe template supports three different view engines:
- `giraffe` (default)
- `razor`
- `dotliquid`
- `none`

You can optionally specify the `--ViewEngine` parameter (short `-V`) to pass in one of the supported values:

Expand Down Expand Up @@ -78,6 +80,20 @@ This parameter can also be combined with other parameters:
dotnet new giraffe --ViewEngine razor --IncludeTests
```

### --UsePaket

If you prefer [Paket](https://fsprojects.github.io/) for managing your project dependencies then you can specify `--UsePaket` (`-U` for short):

```
dotnet new giraffe --UsePaket
```

This will exclude the package references from the *fsproj* file and include the needed *paket.dependencies* and *paket.references* files.

> If you do not run *build.bat* (or *build.sh* on **nix) before running `dotnet restore` you need to manually run `./.paket/paket.exe install` (or `mono ./.paket/paket.exe install`).
See the [Paket documentation](https://fsprojects.github.io/) for more details.

## Updating the template

Whenever there is a new version of the Giraffe template you can update it by re-running the [instructions from the installation](#installation).
Expand Down Expand Up @@ -106,4 +122,4 @@ For more information about Giraffe, how to set up a development environment, con

## License

[Apache 2.0](https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.DotLiquid/master/LICENSE)
[Apache 2.0](https://raw.githubusercontent.com/giraffe-fsharp/giraffe-template/master/LICENSE)
11 changes: 11 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Release Notes
=============

## 0.12.0

#### New features

- Added `none` as a new option to the `--ViewEngine` parameter, which will create a Giraffe web application without any view engine (Web API only).
- Added a new parameter called `--UsePaket` which will use Paket instead of NuGet as the package manager for the Giraffe web application.

#### Enhancements

- Updated the default Giraffe template to the latest version of Giraffe and made use of the new HTML attributes from the `GiraffeViewEngine`.

## 0.11.0

#### New features
Expand Down
62 changes: 62 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ function Invoke-Cmd ($cmd)
if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return }
}

function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }
function dotnet-build ($project, $argv) { Invoke-Cmd "dotnet build $project $argv" }
function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" }
function dotnet-test ($project, $argv) { Invoke-Cmd "dotnet test $project $argv" }
function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" }

function Test-Version ($project)
{
if ($env:APPVEYOR_REPO_TAG -eq $true)
Expand Down Expand Up @@ -55,6 +61,18 @@ function Update-AppVeyorBuildVersion ($project)
}
}

function Remove-BuildArtifacts
{
Write-Host "Deleting build artifacts..." -ForegroundColor Magenta

Get-ChildItem -Include "bin", "obj" -Recurse -Directory `
| ForEach-Object {
Write-Host "Removing folder $_" -ForegroundColor DarkGray
Remove-Item $_ -Recurse -Force }

Remove-Item -Path "giraffe-template.*.nupkg" -Force
}

# ----------------------------------------------
# Main
# ----------------------------------------------
Expand All @@ -66,4 +84,48 @@ Test-Version $nuspec

Write-Host "Building giraffe-template package..." -ForegroundColor Magenta

Remove-BuildArtifacts

# Test Giraffe template
$giraffeApp = "src/content/Giraffe/src/AppNamePlaceholder/AppNamePlaceholder.fsproj"
$giraffeTests = "src/content/Giraffe/tests/AppNamePlaceholder.Tests/AppNamePlaceholder.Tests.fsproj"

dotnet-restore $giraffeApp
dotnet-build $giraffeApp
dotnet-restore $giraffeTests
dotnet-build $giraffeTests
dotnet-test $giraffeTests

# Test Razor template
$razorApp = "src/content/Razor/src/AppNamePlaceholder/AppNamePlaceholder.fsproj"
$razorTests = "src/content/Razor/tests/AppNamePlaceholder.Tests/AppNamePlaceholder.Tests.fsproj"

dotnet-restore $razorApp
dotnet-build $razorApp
dotnet-restore $razorTests
dotnet-build $razorTests
dotnet-test $razorTests

# Test DotLiquid template
$dotLiquidApp = "src/content/DotLiquid/src/AppNamePlaceholder/AppNamePlaceholder.fsproj"
$dotLiquidTests = "src/content/DotLiquid/tests/AppNamePlaceholder.Tests/AppNamePlaceholder.Tests.fsproj"

dotnet-restore $dotLiquidApp
dotnet-build $dotLiquidApp
dotnet-restore $dotLiquidTests
dotnet-build $dotLiquidTests
dotnet-test $dotLiquidTests

# Test None template
$noneApp = "src/content/None/src/AppNamePlaceholder/AppNamePlaceholder.fsproj"
$noneTests = "src/content/None/tests/AppNamePlaceholder.Tests/AppNamePlaceholder.Tests.fsproj"

dotnet-restore $noneApp
dotnet-build $noneApp
dotnet-restore $noneTests
dotnet-build $noneTests
dotnet-test $noneTests

# Create template NuGet package
Remove-BuildArtifacts
Invoke-Cmd "nuget pack src/giraffe-template.nuspec"
43 changes: 43 additions & 0 deletions src/content/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@
{
"choice": "dotliquid",
"description": "DotLiquid template engine"
},
{
"choice": "none",
"description": "No template engine (API only)"
}
]
},
"IncludeTests": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "false"
},
"UsePaket": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "false"
}
},
"sources": [
Expand All @@ -43,6 +52,10 @@
{
"condition": "(!IncludeTests)",
"exclude": [ "**/AppNamePlaceholder.Tests/**/*" ]
},
{
"condition": "(!UsePaket)",
"exclude": [ "**/paket.*" ]
}
]
},
Expand All @@ -54,13 +67,43 @@
{
"condition": "(!IncludeTests)",
"exclude": [ "**/AppNamePlaceholder.Tests/**/*" ]
},
{
"condition": "(!UsePaket)",
"exclude": [ "**/paket.*" ]
}
]
},
{
"source": "./DotLiquid/",
"target": "./",
"condition": "(ViewEngine == \"dotliquid\")",
"modifiers": [
{
"condition": "(!IncludeTests)",
"exclude": [ "**/AppNamePlaceholder.Tests/**/*" ]
},
{
"condition": "(!UsePaket)",
"exclude": [ "**/paket.*" ]
}
]
},
{
"source": "./Paket/",
"target": "./",
"condition": "(UsePaket)",
"modifiers": [
{
"condition": "(!IncludeTests)",
"exclude": [ "**/AppNamePlaceholder.Tests/**/*" ]
}
]
},
{
"source": "./None/",
"target": "./",
"condition": "(ViewEngine == \"none\")",
"modifiers": [
{
"condition": "(!IncludeTests)",
Expand Down
21 changes: 21 additions & 0 deletions src/content/DotLiquid/paket.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
storage: none
source https://api.nuget.org/v3/index.json

clitool dotnet-xunit
clitool Microsoft.DotNet.Watcher.Tools
nuget Microsoft.AspNetCore.Cors
nuget Microsoft.AspNetCore.Hosting
nuget Microsoft.AspNetCore.Diagnostics
nuget Microsoft.AspNetCore.Server.Kestrel
nuget Microsoft.AspNetCore.Server.IISIntegration
nuget Microsoft.AspNetCore.StaticFiles
nuget Microsoft.Extensions.Logging.Console
nuget Microsoft.Extensions.Logging.Debug
nuget Microsoft.AspNetCore.Authentication.Cookies
nuget Microsoft.Extensions.DependencyInjection
nuget Giraffe
nuget Microsoft.NET.Test.Sdk
nuget xunit
nuget xunit.runner.visualstudio
nuget Microsoft.AspNetCore.TestHost
nuget Giraffe.DotLiquid
Loading

0 comments on commit e52972b

Please sign in to comment.