diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a606972 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,83 @@ +name: .NET Core +on: + push: + pull_request: + release: + types: + - published +env: + PROJECT_NAME: Giraffe.DotLiquid + GITHUB_SOURCE: https://nuget.pkg.github.com/giraffe-fsharp/ + GITHUB_USER: dustinmoris + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NUGET_KEY: ${{ secrets.NUGET_KEY }} +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.301 + - name: Restore + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test + run: dotnet test --configuration Release + - name: Pack + if: matrix.os == 'ubuntu-latest' + run: dotnet pack --configuration Release --no-restore --verbosity normal --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.*proj + - name: Upload Artifact + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v2 + with: + name: nupkg + path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg + prerelease: + needs: build + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v1 + with: + name: nupkg + - name: Push Pre-Release NuGet + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_SOURCE + done + shell: bash + deploy: + needs: build + if: github.event_name == 'release' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.301 + - name: Create Release NuGet package + run: | + arrTag=(${GITHUB_REF//\// }) + VERSION="${arrTag[2]}" + echo Version: $VERSION + VERSION="${VERSION//v}" + echo Clean Version: $VERSION + dotnet pack --configuration Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj + - name: Push to GitHub Feed + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_SOURCE + done + shell: bash + - name: Push to NuGet Feed + run: dotnet nuget push nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_KEY \ No newline at end of file diff --git a/.psscripts/build-functions.ps1 b/.psscripts/build-functions.ps1 deleted file mode 100644 index 8479181..0000000 --- a/.psscripts/build-functions.ps1 +++ /dev/null @@ -1,427 +0,0 @@ -# ---------------------------------------------- -# Generic functions -# ---------------------------------------------- - -function Test-IsMonoInstalled -{ - <# - .DESCRIPTION - Checks to see whether the current environment has the Mono framework installed. - - .EXAMPLE - if (Test-IsMonoInstalled) { Write-Host "Mono is available." } - #> - - try - { - $result = Invoke-Cmd "mono --version" -Silent - return $result.StartsWith("Mono JIT compiler version") - } - catch { return false } -} - -function Get-UbuntuVersion -{ - <# - .DESCRIPTION - Gets the Ubuntu version. - - .EXAMPLE - $ubuntuVersion = Get-UbuntuVersion - #> - - $version = Invoke-Cmd "lsb_release -r -s" -Silent - return $version -} - -function Invoke-UnsafeCmd ( - [string] $Cmd, - [switch] $Silent) -{ - <# - .DESCRIPTION - Runs a shell or bash command, but doesn't throw an error if the command didn't exit with 0. - - .PARAMETER cmd - The command to be executed. - - .EXAMPLE - Invoke-Cmd -Cmd "dotnet new classlib" - - .NOTES - Use this PowerShell command to execute any CLI commands which might not exit with 0 on a success. - #> - - if (!($Silent.IsPresent)) { Write-Host $cmd -ForegroundColor DarkCyan } - if ($IsWindows) { $cmd = "cmd.exe /C $cmd" } - Invoke-Expression -Command $cmd -} - -function Invoke-Cmd ( - [string] $Cmd, - [switch] $Silent) -{ - <# - .DESCRIPTION - Runs a shell or bash command and throws an error if the command didn't exit with 0. - - .PARAMETER cmd - The command to be executed. - - .EXAMPLE - Invoke-Cmd -Cmd "dotnet new classlib" - - .NOTES - Use this PowerShell command to execute any dotnet CLI commands in order to ensure that they behave the same way in the case of an error across different environments (Windows, OSX and Linux). - #> - - if ($Silent.IsPresent) { Invoke-UnsafeCmd $cmd -Silent } else { Invoke-UnsafeCmd $cmd } - if ($LastExitCode -ne 0) { - Write-Host "An error occured when executing '$Cmd'." - Write-Error "An error occured when executing '$Cmd'." - return - } -} - -function Remove-OldBuildArtifacts -{ - <# - .DESCRIPTION - Deletes all the bin and obj folders from the current- and all sub directories. - #> - - Write-Host "Deleting old build artifacts..." -ForegroundColor Magenta - - Get-ChildItem -Include "bin", "obj" -Recurse -Directory ` - | ForEach-Object { - Write-Host "Removing folder $_" -ForegroundColor DarkGray - Remove-Item $_ -Recurse -Force } -} - -function Get-ProjectVersion ($projFile) -{ - <# - .DESCRIPTION - Gets the value of a .NET Core *.csproj, *.fsproj or *.vbproj file. - - .PARAMETER cmd - The relative or absolute path to the .NET Core project file. - #> - - [xml]$xml = Get-Content $projFile - [string] $version = $xml.Project.PropertyGroup.Version - $version -} - -function Get-NuspecVersion ($nuspecFile) -{ - <# - .DESCRIPTION - Gets the value of a .nuspec file. - - .PARAMETER cmd - The relative or absolute path to the .nuspec file. - #> - - [xml] $xml = Get-Content $nuspecFile - [string] $version = $xml.package.metadata.version - $version -} - -function Test-CompareVersions ($version, [string]$gitTag) -{ - Write-Host "Matching version against git tag..." -ForegroundColor Magenta - Write-Host "Project version: $version" -ForegroundColor Cyan - Write-Host "Git tag version: $gitTag" -ForegroundColor Cyan - - if (!$gitTag.EndsWith($version)) - { - Write-Error "Version and Git tag do not match." - } -} - -function Add-ToPathVariable ($path) -{ - if ($IsWindows) - { - $updatedPath = "$path;$env:Path" - [Environment]::SetEnvironmentVariable("Path", $updatedPath, "Process") - [Environment]::SetEnvironmentVariable("Path", $updatedPath, "User") - [Environment]::SetEnvironmentVariable("Path", $updatedPath, "Machine") - } - else - { - $updatedPath = "$path`:$env:PATH" - [Environment]::SetEnvironmentVariable("PATH", $updatedPath, "Process") - [Environment]::SetEnvironmentVariable("PATH", $updatedPath, "User") - [Environment]::SetEnvironmentVariable("PATH", $updatedPath, "Machine") - } -} - -function Get-ProjectName ($proj) -{ - [System.IO.Path]::GetFileNameWithoutExtension($proj) -} - -# ---------------------------------------------- -# .NET Core functions -# ---------------------------------------------- - -function Get-TargetFrameworks ($projFile) -{ - <# - .DESCRIPTION - Returns all target frameworks set up inside a specific .NET Core project file. - - .PARAMETER projFile - The full or relative path to a .NET Core project file (*.csproj, *.fsproj, *.vbproj). - - .EXAMPLE - Get-TargetFrameworks "MyProject.csproj" - - .NOTES - This function will always return an array of target frameworks, even if only a single target framework was found in the project file. - #> - - [xml]$proj = Get-Content $projFile - - if ($null -ne $proj.Project.PropertyGroup.TargetFrameworks) { - ($proj.Project.PropertyGroup.TargetFrameworks).Split(";") - } - else { @($proj.Project.PropertyGroup.TargetFramework) } -} - -function Get-NetCoreTargetFrameworks ($projFile) -{ - <# - .DESCRIPTION - Returns a single .NET Core framework which could be found among all configured target frameworks of a given .NET Core project file. - - .PARAMETER projFile - The full or relative path to a .NET Core project file (*.csproj, *.fsproj, *.vbproj). - - .EXAMPLE - Get-NetCoreTargetFrameworks "MyProject.csproj" - - .NOTES - This function will always return the only netstandard*/netcoreapp* target framework which is set up as a target framework. - #> - - Get-TargetFrameworks $projFile | Where-Object { $_ -like "netstandard*" -or $_ -like "netcoreapp*" } -} - -function Invoke-DotNetCli ($cmd, $proj, $argv) -{ - # Currently dotnet test does not work for net461 on Linux/Mac - # See: https://github.com/Microsoft/vstest/issues/1318 - - if((!($IsWindows) -and !(Test-IsMonoInstalled)) ` - -or (!($IsWindows) -and ($cmd -eq "test"))) - { - $netCoreFrameworks = Get-NetCoreTargetFrameworks($proj) - - foreach($fw in $netCoreFrameworks) { - $fwArgv = "-f $fw " + $argv - Invoke-Cmd "dotnet $cmd $proj $fwArgv" - } - } - else - { - Invoke-Cmd "dotnet $cmd $proj $argv" - } -} - -function dotnet-info { Invoke-Cmd "dotnet --info" -Silent } -function dotnet-version { Invoke-Cmd "dotnet --version" -Silent } -function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" } -function dotnet-build ($project, $argv) { Invoke-DotNetCli -Cmd "build" -Proj $project -Argv $argv } -function dotnet-test ($project, $argv) { Invoke-DotNetCli -Cmd "test" -Proj $project -Argv $argv } -function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" } -function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" } -function dotnet-publish ($project, $argv) { Invoke-Cmd "dotnet publish $project $argv" } - -function Get-DotNetRuntimeVersion -{ - <# - .DESCRIPTION - Runs the dotnet --info command and extracts the .NET Core Runtime version number. - - .NOTES - The .NET Core Runtime version can sometimes be useful for other dotnet CLI commands (e.g. dotnet xunit -fxversion ".NET Core Runtime version"). - #> - - $info = dotnet-info - [System.Array]::Reverse($info) - $version = $info | Where-Object { $_.Contains("Version") } | Select-Object -First 1 - $version.Split(":")[1].Trim() -} - -function Write-DotnetCoreVersions -{ - <# - .DESCRIPTION - Writes the .NET Core SDK and Runtime version to the current host. - #> - - $sdkVersion = dotnet-version - $runtimeVersion = Get-DotNetRuntimeVersion - Write-Host ".NET Core SDK version: $sdkVersion" -ForegroundColor Cyan - Write-Host ".NET Core Runtime version: $runtimeVersion" -ForegroundColor Cyan -} - -function Get-DesiredSdk -{ - <# - .DESCRIPTION - Gets the desired .NET Core SDK version from the global.json file. - #> - - Get-Content "global.json" ` - | ConvertFrom-Json ` - | ForEach-Object { $_.sdk.version.ToString() } -} - -function Get-NetCoreSdkFromWeb ($version) -{ - <# - .DESCRIPTION - Downloads the desired .NET Core SDK version from the internet and saves it under a temporary file name which will be returned by the function. - - .PARAMETER version - The SDK version which should be downloaded. - #> - - Write-Host "Downloading .NET Core SDK $version..." - - $os = - if ($IsWindows) { "windows" } - elseif ($IsLinux) { "linux" } - elseif ($IsMacOS) { "macos" } - else { Write-Error "Unknown OS, which is not supported by .NET Core." } - - $ext = if ($IsWindows) { ".zip" } else { ".tar.gz" } - - $uri = "https://www.microsoft.com/net/download/thank-you/dotnet-sdk-$version-$os-x64-binaries" - Write-Host "Finding download link..." - - $response = Invoke-WebRequest -Uri $uri - - $downloadLink = - $response.Links ` - | Where-Object { $_.onclick -eq "recordManualDownload()" } ` - | Select-Object -Expand href - - Write-Host "Creating temporary file..." - - $tempFile = [System.IO.Path]::GetTempFileName() + $ext - - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($downloadLink, $tempFile) - - Write-Host "Download finished. SDK has been saved to '$tempFile'." - - return $tempFile -} - -function Install-NetCoreSdkFromArchive ($sdkPackagePath) -{ - <# - .DESCRIPTION - Extracts the zip archive which contains the .NET Core SDK and installs it in the current working directory under .dotnetsdk. - - .PARAMETER version - The zip archive which contains the .NET Core SDK. - #> - - if ($IsWindows) - { - $dotnetInstallDir = [System.IO.Path]::Combine($pwd, ".dotnetsdk") - - if (!(Test-Path $dotnetInstallDir)) - { - New-Item $dotnetInstallDir -ItemType Directory -Force | Out-Null - Write-Host "Created folder '$dotnetInstallDir'." - } - - Expand-Archive -LiteralPath $sdkPackagePath -DestinationPath $dotnetInstallDir -Force - Write-Host "Extracted '$sdkPackagePath' to folder '$dotnetInstallDir'." - - [Environment]::SetEnvironmentVariable("DOTNET_ROOT", $dotnetInstallDir, "Process") - Write-Host "DOTNET_ROOT environment variable has been set to $dotnetInstallDir." - } - else - { - $dotnetInstallDir = "$env:HOME/.dotnetsdk" - - if (!(Test-Path $dotnetInstallDir)) - { - Invoke-Cmd "mkdir -p $dotnetInstallDir" - Write-Host "Created folder '$dotnetInstallDir'." - } - - Invoke-Cmd "tar -xf $sdkPackagePath -C $dotnetInstallDir" - Write-Host "Extracted '$sdkPackagePath' to folder '$dotnetInstallDir'." - } - - Add-ToPathVariable $dotnetInstallDir - Write-Host "Added '$dotnetInstallDir' to the PATH environment variable:" - Write-Host $env:PATH -} - -function Install-NetCoreSdkForUbuntu ($ubuntuVersion, $sdkVersion) -{ - Invoke-Cmd "wget -q https://packages.microsoft.com/config/ubuntu/$ubuntuVersion/packages-microsoft-prod.deb" - Invoke-Cmd "sudo dpkg -i packages-microsoft-prod.deb" - Invoke-Cmd "sudo apt-get install apt-transport-https" - Invoke-Cmd "sudo apt-get update" - Invoke-Cmd "sudo apt-get -y install dotnet-sdk-$sdkVersion" -} - -# ---------------------------------------------- -# AppVeyor functions -# ---------------------------------------------- - -function Test-IsAppVeyorBuild { return ($env:APPVEYOR -eq $true) } -function Test-IsAppVeyorBuildTriggeredByGitTag { return ($env:APPVEYOR_REPO_TAG -eq $true) } -function Get-AppVeyorGitTag { return $env:APPVEYOR_REPO_TAG_NAME } - -function Update-AppVeyorBuildVersion ($version) -{ - if (Test-IsAppVeyorBuild) - { - Write-Host "Updating AppVeyor build version..." -ForegroundColor Magenta - $buildVersion = "$version-$env:APPVEYOR_BUILD_NUMBER" - Write-Host "Setting AppVeyor build version to $buildVersion." - Update-AppveyorBuild -Version $buildVersion - } -} - -# ---------------------------------------------- -# Host Writing functions -# ---------------------------------------------- - -function Write-BuildHeader ($projectTitle) -{ - $header = " $projectTitle "; - $bar = "" - for ($i = 0; $i -lt $header.Length; $i++) { $bar += "-" } - - Write-Host "" - Write-Host $bar -ForegroundColor DarkYellow - Write-Host $header -ForegroundColor DarkYellow - Write-Host $bar -ForegroundColor DarkYellow - Write-Host "" -} - -function Write-SuccessFooter ($msg) -{ - $footer = " $msg "; - $bar = "" - for ($i = 0; $i -lt $footer.Length; $i++) { $bar += "-" } - - Write-Host "" - Write-Host $bar -ForegroundColor Green - Write-Host $footer -ForegroundColor Green - Write-Host $bar -ForegroundColor Green - Write-Host "" -} \ No newline at end of file diff --git a/.psscripts/install-dotnet.ps1 b/.psscripts/install-dotnet.ps1 deleted file mode 100644 index f128b2f..0000000 --- a/.psscripts/install-dotnet.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -# ---------------------------------------------- -# Install .NET Core SDK -# ---------------------------------------------- - -param -( - [string] $SdkVersions -) - -$ErrorActionPreference = "Stop" - -Import-module "$PSScriptRoot\build-functions.ps1" -Force - -# Get desired SDKs from argument -$desiredSDKs = $SdkVersions.Split(",") | % { $_.Trim() } - -foreach($desiredSDK in $desiredSDKs) -{ - Write-Host "Attempting to download and install the .NET SDK $desiredSDK..." - $sdkZipPath = Get-NetCoreSdkFromWeb $desiredSDK - Install-NetCoreSdkFromArchive $sdkZipPath -} - -Write-Host ".NET SDK installations complete." -ForegroundColor Green -dotnet-info -dotnet-version \ No newline at end of file diff --git a/.psscripts/nuget-updates.ps1 b/.psscripts/nuget-updates.ps1 deleted file mode 100644 index 0707067..0000000 --- a/.psscripts/nuget-updates.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -# ---------------------------------------------- -# Helper script to find NuGet package upgrades -# ---------------------------------------------- - -function Get-NuGetPackageInfo ($nugetPackageId, $currentVersion) -{ - $url = "https://api-v2v3search-0.nuget.org/query?q=$nugetPackageId&prerelease=false" - $result = Invoke-RestMethod -Uri $url -Method Get - $packageInfo = $result.data | Where-Object { $_.id -eq $nugetPackageId } - $latestVersion = $packageInfo.version - $upgradeAvailable = - $currentVersion ` - -and $latestVersion ` - -and !$latestVersion.StartsWith($currentVersion.Replace("*", "")) - - [PSCustomObject]@{ - PackageName = $nugetPackageId; - Current = $currentVersion; - Latest = $latestVersion; - UpgradeAvailable = $upgradeAvailable - } -} - -filter Highlight-Upgrades -{ - $lines = $_.Split([Environment]::NewLine) - foreach ($line in $lines) { - if ($line.Trim().EndsWith("True")) { - Write-Host $line -ForegroundColor DarkGreen - } else { - Write-Host $line -ForegroundColor Gray - } - } -} - -Write-Host "" -Write-Host "" -Write-Host "--------------------------------------------------" -ForegroundColor DarkYellow -Write-Host " Scanning all projects for NuGet package upgrades " -ForegroundColor DarkYellow -Write-Host "--------------------------------------------------" -ForegroundColor DarkYellow -Write-Host "" - -$projects = Get-ChildItem "$PSScriptRoot\..\**\*.*proj" -Recurse | % { $_.FullName } - -foreach ($project in $projects) -{ - $projName = Split-Path $project -Leaf - Write-Host $projName -ForegroundColor Magenta - - [xml]$proj = Get-Content $project - $references = $proj.Project.ItemGroup.PackageReference | Where-Object { $_.Include -ne $null } - $packages = @() - - foreach ($reference in $references) - { - $id = $reference.Include - $version = $reference.Version - $packages += Get-NuGetPackageInfo $id $version - } - - $packages ` - | Format-Table -Property PackageName, Current, Latest, UpgradeAvailable -AutoSize ` - | Out-String ` - | Highlight-Upgrades -} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..d2ecab7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at giraffe@dusted.codes. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/Giraffe.DotLiquid.sln b/Giraffe.DotLiquid.sln index 16717fa..561399c 100644 --- a/Giraffe.DotLiquid.sln +++ b/Giraffe.DotLiquid.sln @@ -11,41 +11,24 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Giraffe.DotLiquid", "src\Gi EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Giraffe.DotLiquid.Tests", "tests\Giraffe.DotLiquid.Tests\Giraffe.DotLiquid.Tests.fsproj", "{162F3108-0AD8-407D-BEEB-94EBF2707EC4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_build", "_build", "{B362010D-E317-47C6-BA46-31016723777B}" -ProjectSection(SolutionItems) = preProject - appveyor.yml = appveyor.yml - build.ps1 = build.ps1 - build.sh = build.sh - global.json = global.json - NuGet.config = NuGet.config -EndProjectSection +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{CF839AC5-2584-4687-B4F4-4F642E94FAED}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_psscripts", "_psscripts", "{7F02897F-CEA5-4D3C-B6D9-651B94370478}" -ProjectSection(SolutionItems) = preProject - .psscripts\build-functions.ps1 = .psscripts\build-functions.ps1 - .psscripts\install-dotnet.ps1 = .psscripts\install-dotnet.ps1 - .psscripts\nuget-updates.ps1 = .psscripts\nuget-updates.ps1 -EndProjectSection +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GiraffeDotLiquidSample", "samples\GiraffeDotLiquidSample\GiraffeDotLiquidSample.fsproj", "{9F506AB3-B845-41D9-9848-E8D1FE9EA31E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_git", "_git", "{D53D0BA5-D997-45FB-88C8-B6CC16E35E64}" -ProjectSection(SolutionItems) = preProject - .gitattributes = .gitattributes - .gitignore = .gitignore -EndProjectSection +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GiraffeDotLiquidSample.Tests", "samples\GiraffeDotLiquidSample.Tests\GiraffeDotLiquidSample.Tests.fsproj", "{CF0C48C0-856C-4B0A-9CCC-C07907A0C3F5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_docs", "_docs", "{04A2F6C3-8483-4903-95F6-95658837AED4}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_root", "_root", "{EDB2B769-9DCD-4AAB-BC60-1E5268327DF6}" ProjectSection(SolutionItems) = preProject - LICENSE = LICENSE - README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md + README.md = README.md + NuGet.config = NuGet.config + LICENSE = LICENSE + giraffe-64x64.png = giraffe-64x64.png + CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md + .gitignore = .gitignore + .gitattributes = .gitattributes EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{CF839AC5-2584-4687-B4F4-4F642E94FAED}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GiraffeDotLiquidSample", "samples\GiraffeDotLiquidSample\GiraffeDotLiquidSample.fsproj", "{9F506AB3-B845-41D9-9848-E8D1FE9EA31E}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "GiraffeDotLiquidSample.Tests", "samples\GiraffeDotLiquidSample.Tests\GiraffeDotLiquidSample.Tests.fsproj", "{CF0C48C0-856C-4B0A-9CCC-C07907A0C3F5}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 86d5ca6..9852938 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,10 @@ Release Notes ============= +## 2.0.0 + +- Removed support for all .NET framework monikers except `netcoreapp3.1` (in preparation for .NET 5) + ## 1.3.0 Upgraded to Giraffe `4.0.0` and the latest ASP.NET Core dependencies, which are all .NET Core 3.0 compatible. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 965c99a..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 0.1.0-{build} -image: - - Visual Studio 2019 - - Ubuntu -environment: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -init: - - git config --global core.autocrlf true -install: - - ps: .\.psscripts\install-dotnet.ps1 -SdkVersions "3.0.100, 2.2.402" -build: off -build_script: - - ps: .\build.ps1 -Release -Pack -test: off -artifacts: - - path: '**\Giraffe.*.nupkg' - name: Giraffe NuGet packages -nuget: - account_feed: false - project_feed: true -deploy: - provider: NuGet - api_key: - secure: +XDgIu4Tmln7LKedNmQgMFnyKTxxuCKFRK3V5oKEfwZiakPXRd5C7OueEGBL50oh - skip_symbols: false - artifact: /.*\.nupkg/ - on: - appveyor_repo_tag: true \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 8ea9076..0000000 --- a/build.ps1 +++ /dev/null @@ -1,83 +0,0 @@ -# ---------------------------------------------- -# Build script -# ---------------------------------------------- - -param -( - [switch] $Release, - [switch] $ExcludeTests, - [switch] $ExcludeSamples, - [switch] $Pack, - [switch] $Run, - [switch] $ClearOnly -) - -# ---------------------------------------------- -# Main -# ---------------------------------------------- - -$ErrorActionPreference = "Stop" - -Import-module "$PSScriptRoot/.psscripts/build-functions.ps1" -Force - -Write-BuildHeader "Starting Giraffe.DotLiquid build script" - -if ($ClearOnly.IsPresent) -{ - Remove-OldBuildArtifacts - return -} - -$giraffeDotLiquid = ".\src\Giraffe.DotLiquid\Giraffe.DotLiquid.fsproj" -$giraffeDotLiquidTests = ".\tests\Giraffe.DotLiquid.Tests\Giraffe.DotLiquid.Tests.fsproj" -$sampleApp = ".\samples\GiraffeDotLiquidSample\GiraffeDotLiquidSample.fsproj" -$sampleAppTests = ".\samples\GiraffeDotLiquidSample.Tests\GiraffeDotLiquidSample.Tests.fsproj" - -$version = Get-ProjectVersion $giraffeDotLiquid -Update-AppVeyorBuildVersion $version - -if (Test-IsAppVeyorBuildTriggeredByGitTag) -{ - $gitTag = Get-AppVeyorGitTag - Test-CompareVersions $version $gitTag -} - -Write-DotnetCoreVersions -Remove-OldBuildArtifacts - -$configuration = if ($Release.IsPresent) { "Release" } else { "Debug" } - -Write-Host "Building Giraffe.DotLiquid..." -ForegroundColor Magenta -dotnet-build $giraffeDotLiquid "-c $configuration" - -if (!$ExcludeTests.IsPresent -and !$Run.IsPresent) -{ - Write-Host "Building and running tests..." -ForegroundColor Magenta - - dotnet-build $giraffeDotLiquidTests - dotnet-test $giraffeDotLiquidTests -} - -if (!$ExcludeSamples.IsPresent -and !$Run.IsPresent) -{ - Write-Host "Building and testing samples..." -ForegroundColor Magenta - dotnet-build $sampleApp - dotnet-build $sampleAppTests - dotnet-test $sampleAppTests -} - -if ($Run.IsPresent) -{ - Write-Host "Launching sample application..." -ForegroundColor Magenta - dotnet-build $sampleApp - dotnet-run $sampleApp -} - -if ($Pack.IsPresent) -{ - Write-Host "Packaging Giraffe.DotLiquid NuGet package..." -ForegroundColor Magenta - - dotnet-pack $giraffeDotLiquid "-c $configuration" -} - -Write-SuccessFooter "Giraffe.DotLiquid build completed successfully!" \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index b8e46ef..0000000 --- a/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/ -pwsh ./build.ps1 \ No newline at end of file diff --git a/giraffe-64x64.png b/giraffe-64x64.png new file mode 100644 index 0000000..40ed5e3 Binary files /dev/null and b/giraffe-64x64.png differ diff --git a/global.json b/global.json deleted file mode 100644 index 10fb3ad..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "tests" ], - "sdk": { - "version": "3.0.100" - } -} \ No newline at end of file diff --git a/samples/GiraffeDotLiquidSample.Tests/GiraffeDotLiquidSample.Tests.fsproj b/samples/GiraffeDotLiquidSample.Tests/GiraffeDotLiquidSample.Tests.fsproj index 0828d2d..d802f9b 100644 --- a/samples/GiraffeDotLiquidSample.Tests/GiraffeDotLiquidSample.Tests.fsproj +++ b/samples/GiraffeDotLiquidSample.Tests/GiraffeDotLiquidSample.Tests.fsproj @@ -1,14 +1,14 @@ - netcoreapp3.0 + netcoreapp3.1 GiraffeDotLiquidSample.Tests true - - + + diff --git a/samples/GiraffeDotLiquidSample/GiraffeDotLiquidSample.fsproj b/samples/GiraffeDotLiquidSample/GiraffeDotLiquidSample.fsproj index 4ca6bfe..0c36791 100644 --- a/samples/GiraffeDotLiquidSample/GiraffeDotLiquidSample.fsproj +++ b/samples/GiraffeDotLiquidSample/GiraffeDotLiquidSample.fsproj @@ -1,16 +1,12 @@ - netcoreapp3.0 + netcoreapp3.1 GiraffeDotLiquidSample false $(MSBuildThisFileDirectory) - - - - diff --git a/src/Giraffe.DotLiquid/Giraffe.DotLiquid.fsproj b/src/Giraffe.DotLiquid/Giraffe.DotLiquid.fsproj index 5038f54..c5a66d7 100755 --- a/src/Giraffe.DotLiquid/Giraffe.DotLiquid.fsproj +++ b/src/Giraffe.DotLiquid/Giraffe.DotLiquid.fsproj @@ -1,16 +1,14 @@  - Giraffe.DotLiquid - 1.3.0 - + Giraffe.DotLiquid DotLiquid templating engine http handlers for the Giraffe web framework. - Copyright 2018 Dustin Moris Gorski + Copyright 2020 Dustin Moris Gorski Dustin Moris Gorski and contributors en-GB - netstandard2.0;net461 + netcoreapp3.1 portable Library true @@ -21,7 +19,7 @@ Giraffe.DotLiquid Giraffe;DotLiquid;ASP.NET Core;Lambda;FSharp;Functional;Http;Web;Framework;Micro;Service https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.DotLiquid/master/RELEASE_NOTES.md - https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/master/giraffe-64x64.png + giraffe-64x64.png https://github.com/giraffe-fsharp/Giraffe.DotLiquid Apache-2.0 true @@ -31,19 +29,22 @@ true true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb FS2003;FS0044 - - - + + true + $(PackageIconUrl) + + + + + - - - + + diff --git a/tests/Giraffe.DotLiquid.Tests/Giraffe.DotLiquid.Tests.fsproj b/tests/Giraffe.DotLiquid.Tests/Giraffe.DotLiquid.Tests.fsproj index b4d655f..934dda1 100644 --- a/tests/Giraffe.DotLiquid.Tests/Giraffe.DotLiquid.Tests.fsproj +++ b/tests/Giraffe.DotLiquid.Tests/Giraffe.DotLiquid.Tests.fsproj @@ -1,27 +1,21 @@ - netcoreapp3.0;netcoreapp2.1;net461 + netcoreapp3.1 Giraffe.DotLiquid.Tests - + - - - - - - + + + + + - - - - - - + diff --git a/tests/Giraffe.DotLiquid.Tests/TokenRouterTests.fs b/tests/Giraffe.DotLiquid.Tests/TokenRouterTests.fs index c807337..5837e5f 100644 --- a/tests/Giraffe.DotLiquid.Tests/TokenRouterTests.fs +++ b/tests/Giraffe.DotLiquid.Tests/TokenRouterTests.fs @@ -6,7 +6,6 @@ open System.Threading.Tasks open Microsoft.AspNetCore.Http open FSharp.Control.Tasks.V2 open Giraffe -open Giraffe.TokenRouter open Xunit open NSubstitute @@ -60,13 +59,14 @@ let ``GET "/dotLiquid" returns rendered html view`` () = let obj = { Foo = "John"; Bar = "Doe"; Age = 30 } let app = - router notFound [ - GET [ - route "/" => text "Hello World" - route "/dotLiquid" => dotLiquid "text/html" dotLiquidTemplate obj ] - POST [ - route "/post/1" => text "1" ] - ] + choose [ + GET >=> choose [ + route "/" >=> text "Hello World" + route "/dotLiquid" >=> dotLiquid "text/html" dotLiquidTemplate obj ] + POST>=> choose [ + route "/post/1" >=> text "1" ] + notFound + ] ctx.Request.Method.ReturnsForAnyArgs "GET" |> ignore ctx.Request.Path.ReturnsForAnyArgs (PathString("/dotLiquid")) |> ignore