diff --git a/.gitignore b/.gitignore index f58686865..de408a2bf 100644 --- a/.gitignore +++ b/.gitignore @@ -238,3 +238,7 @@ _Pvt_Extensions *.ncrunchsolution *.txt + + +# CAKE - C# Make +/Tools/* \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 0e0b32a79..0b01b26d5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,88 +4,28 @@ os: Visual Studio 2017 environment: nodejs_version: "7.8.0" -# Install scripts. (runs after repo cloning) -#init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) install: # Get the latest stable version of Node.js or io.js - ps: Install-Product node $env:nodejs_version -before_build: -- ps: .\BuildTask.ps1 -env "live" -- cmd: cd src/ombi -- node --version -- appveyor-retry dotnet restore -- appveyor-retry npm install -g gulp -- appveyor-retry npm install -- gulp publish build_script: -- dotnet build -#- dotnet test ./Ombi.Core.Tests/Ombi.Core.Tests.csproj + - ps: ./build.ps1 + after_build: -- dotnet publish -c Release -r win10-x64 -- dotnet publish -c Release -r osx.10.12-x64 -- dotnet publish -c Release -r ubuntu.16.04-x64 -- dotnet publish -c Release -r debian.8-x64 -- dotnet publish -c Release -r centos.7-x64 -- dotnet publish "../Ombi.Updater" -c Release -r win10-x64 -- dotnet publish "../Ombi.Updater" -c Release -r osx.10.12-x64 -- dotnet publish "../Ombi.Updater" -c Release -r ubuntu.16.04-x64 -- dotnet publish "../Ombi.Updater" -c Release -r debian.8-x64 -- dotnet publish "../Ombi.Updater" -c Release -r centos.7-x64 -# Copy over the updater files so we can include them in the .zip -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater.dll" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater" - -#Copy the swagger files - -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Swagger.xml" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Swagger.xml" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Swagger.xml" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Swagger.xml" -- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Swagger.xml" - cmd: >- - dir %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish - - - dir %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64 - - - 7z a Ombi_windows.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish - - - 7z a Ombi_osx.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish - - - 7z a Ombi_ubuntu.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish - - - 7z a Ombi_debian.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish - - - 7z a Ombi_centos.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish - - appveyor PushArtifact Ombi_windows.zip + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcore1.1\windows.zip" - appveyor PushArtifact Ombi_osx.zip + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcore1.1\osx.tar.gz" - appveyor PushArtifact Ombi_ubuntu.zip + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcore1.1\ubuntu.tar.gz" - appveyor PushArtifact Ombi_debian.zip + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcore1.1\debian.tar.gz" - appveyor PushArtifact Ombi_centos.zip + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcore1.1\centos.tar.gz" @@ -100,5 +40,3 @@ deploy: on: branch: master -#on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor_old.yml b/appveyor_old.yml new file mode 100644 index 000000000..0e0b32a79 --- /dev/null +++ b/appveyor_old.yml @@ -0,0 +1,104 @@ +version: 3.0.{build} +configuration: Release +os: Visual Studio 2017 +environment: + nodejs_version: "7.8.0" + +# Install scripts. (runs after repo cloning) +#init: +# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version +before_build: +- ps: .\BuildTask.ps1 -env "live" +- cmd: cd src/ombi +- node --version +- appveyor-retry dotnet restore +- appveyor-retry npm install -g gulp +- appveyor-retry npm install +- gulp publish +build_script: +- dotnet build +#- dotnet test ./Ombi.Core.Tests/Ombi.Core.Tests.csproj +after_build: +- dotnet publish -c Release -r win10-x64 +- dotnet publish -c Release -r osx.10.12-x64 +- dotnet publish -c Release -r ubuntu.16.04-x64 +- dotnet publish -c Release -r debian.8-x64 +- dotnet publish -c Release -r centos.7-x64 +- dotnet publish "../Ombi.Updater" -c Release -r win10-x64 +- dotnet publish "../Ombi.Updater" -c Release -r osx.10.12-x64 +- dotnet publish "../Ombi.Updater" -c Release -r ubuntu.16.04-x64 +- dotnet publish "../Ombi.Updater" -c Release -r debian.8-x64 +- dotnet publish "../Ombi.Updater" -c Release -r centos.7-x64 +# Copy over the updater files so we can include them in the .zip +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater.dll" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Ombi.Updater" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater" + +#Copy the swagger files + +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Swagger.xml" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Swagger.xml" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish\Swagger.xml" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Swagger.xml" +- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\Swagger.xml" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Swagger.xml" +- cmd: >- + dir %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish + + + dir %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64 + + + 7z a Ombi_windows.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish + + + 7z a Ombi_osx.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish + + + 7z a Ombi_ubuntu.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.04-x64\publish + + + 7z a Ombi_debian.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish + + + 7z a Ombi_centos.zip %APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish + + + appveyor PushArtifact Ombi_windows.zip + + + appveyor PushArtifact Ombi_osx.zip + + + appveyor PushArtifact Ombi_ubuntu.zip + + + appveyor PushArtifact Ombi_debian.zip + + + appveyor PushArtifact Ombi_centos.zip + + + +#cache: +#- '%USERPROFILE%\.nuget\packages' +deploy: +- provider: GitHub + release: Ombi v$(appveyor_build_version) + auth_token: + secure: jDpp1/WUQl3uN41fNI3VeZoRZbDiDfs3GPQ1v+C5ZNE3cWdnUvuJfCCfUbYUV1Rp + draft: true + on: + branch: master + +#on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/build.cake b/build.cake new file mode 100644 index 000000000..c2387bf1a --- /dev/null +++ b/build.cake @@ -0,0 +1,191 @@ +#tool "xunit.runner.console" +#addin "Cake.Gulp" +#addin "Cake.Npm" +#addin "SharpZipLib" +#addin "Cake.Compression" + +////////////////////////////////////////////////////////////////////// +// ARGUMENTS +////////////////////////////////////////////////////////////////////// + +var target = Argument("target", "Default"); +var configuration = Argument("configuration", "Release"); + +////////////////////////////////////////////////////////////////////// +// PREPARATION +////////////////////////////////////////////////////////////////////// + +var buildDir = "./src/Ombi/bin/" + configuration; +var nodeModulesDir ="./src/Ombi/node_modules/"; +var wwwRootDistDir = "./src/Ombi/wwwroot/dist/"; +var projDir = "./src/"; // Project Directory +var webProjDir = "./src/Ombi"; +var csProj = "./src/Ombi/Ombi.csproj"; // Path to the project.csproj +var solutionFile = "Ombi.sln"; // Solution file if needed + +var buildSettings = new DotNetCoreBuildSettings +{ + Framework = "netcoreapp1.1", + Configuration = "Release", + OutputDirectory = Directory(buildDir), + VersionSuffix = GetVersion(), +}; + +var publishSettings = new DotNetCorePublishSettings +{ + Framework = "netcoreapp1.1", + Configuration = "Release", + OutputDirectory = Directory(buildDir), + VersionSuffix = GetVersion(), +}; + +var artifactsFolder = buildDir + "/netcoreapp1.1/"; +var windowsArtifactsFolder = artifactsFolder + "win10-x64/published"; +var osxArtifactsFolder = artifactsFolder + "osx.10.12-x64/published"; +var ubuntuArtifactsFolder = artifactsFolder + "ubuntu.16.04-x64/published"; +var debianArtifactsFolder = artifactsFolder + "debian.8-x64/published"; +var centosArtifactsFolder = artifactsFolder + "centos.7-x64/published"; + + +////////////////////////////////////////////////////////////////////// +// Helper +////////////////////////////////////////////////////////////////////// + +public string GetVersion() +{ + if (AppVeyor.IsRunningOnAppVeyor) { + // Update the version + return AppVeyor.Environment.Build.Version; + //AppVeyor.Environment.Repository.Branch; + } + return "3.0.100"; +} + +////////////////////////////////////////////////////////////////////// +// TASKS +////////////////////////////////////////////////////////////////////// + +Task("Clean") + .Does(() => +{ + CleanDirectory(buildDir); + CleanDirectory(nodeModulesDir); + CleanDirectory(wwwRootDistDir); +}); + +Task("Restore") + .IsDependentOn("Clean") + .IsDependentOn("NPM") + .Does(() => +{ + DotNetCoreRestore(projDir); +}); + +Task("NPM") +.Does(() => { +var settings = new NpmInstallSettings { + LogLevel = NpmLogLevel.Verbose, + WorkingDirectory = webProjDir, + Production = true + }; + + NpmInstall(settings); + + var runScriptSettings = new NpmRunScriptSettings { + ScriptName="publish", + WorkingDirectory = webProjDir, + }; + + NpmRunScript(runScriptSettings); +}); + + +Task("Build") + .IsDependentOn("Restore") + .Does(() => +{ + DotNetCoreBuild(csProj, buildSettings); +}); + +Task("Package") + .Does(() => +{ + Zip(windowsArtifactsFolder +"/",artifactsFolder + "windows.zip"); + GZipCompress(osxArtifactsFolder, artifactsFolder + "osx.tar.gz"); + GZipCompress(ubuntuArtifactsFolder, artifactsFolder + "ubuntu.tar.gz"); + GZipCompress(debianArtifactsFolder, artifactsFolder + "debian.tar.gz"); + GZipCompress(centosArtifactsFolder, artifactsFolder + "centos.tar.gz"); +}); + +Task("Publish") + .IsDependentOn("Build") + .IsDependentOn("Publish-Windows") + .IsDependentOn("Publish-OSX").IsDependentOn("Publish-Ubuntu").IsDependentOn("Publish-Debian").IsDependentOn("Publish-Centos") + .IsDependentOn("Package"); + +Task("Publish-Windows") + .Does(() => +{ + publishSettings.Runtime = "win10-x64"; + publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/win10-x64/published"); + + DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings); + DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings); +}); + +Task("Publish-OSX") + .Does(() => +{ + publishSettings.Runtime = "osx.10.12-x64"; + publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/osx.10.12-x64/published"); + + DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings); + DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings); +}); + +Task("Publish-Ubuntu") + .Does(() => +{ + publishSettings.Runtime = "ubuntu.16.04-x64"; + publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/ubuntu.16.04-x64/published"); + + DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings); + DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings); +}); +Task("Publish-Debian") + .Does(() => +{ + publishSettings.Runtime = "debian.8-x64"; + publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/debian.8-x64/published"); + + DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings); + DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings); +}); +Task("Publish-Centos") + .Does(() => +{ + publishSettings.Runtime = "centos.7-x64"; + publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/centos.7-x64/published"); + + DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings); + DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings); +}); + +Task("Run-Unit-Tests") + .IsDependentOn("Publish") + .Does(() => +{ +}); + +////////////////////////////////////////////////////////////////////// +// TASK TARGETS +////////////////////////////////////////////////////////////////////// + +Task("Default") + .IsDependentOn("Run-Unit-Tests"); + +////////////////////////////////////////////////////////////////////// +// EXECUTION +////////////////////////////////////////////////////////////////////// + +RunTarget(target); diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..3a8ef5c4c --- /dev/null +++ b/build.ps1 @@ -0,0 +1,189 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. +.PARAMETER WhatIf +Performs a dry run of the build script. +No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +http://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "build.cake", + [string]$Target = "Default", + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [Alias("DryRun","Noop")] + [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null +function MD5HashFile([string] $filePath) +{ + if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) + { + return $null + } + + [System.IO.Stream] $file = $null; + [System.Security.Cryptography.MD5] $md5 = $null; + try + { + $md5 = [System.Security.Cryptography.MD5]::Create() + $file = [System.IO.File]::OpenRead($filePath) + return [System.BitConverter]::ToString($md5.ComputeHash($file)) + } + finally + { + if ($file -ne $null) + { + $file.Dispose() + } + } +} + +Write-Host "Preparing to run build script..." + +if(!$PSScriptRoot){ + $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +} + +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" +} + +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" +} + +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + + # Check for changes in packages.config and remove installed tools if true. + [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + Write-Verbose -Message "Missing or changed package.config hash..." + Remove-Item * -Recurse -Exclude packages.config,nuget.exe + } + + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occured while restoring NuGet tools." + } + else + { + $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" + } + Write-Verbose -Message ($NuGetOutput | out-string) + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + +# Start Cake +Write-Host "Running build script..." +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..6e8f207c8 --- /dev/null +++ b/build.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum + +# Define md5sum or md5 depending on Linux/OSX +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi + +# Define default arguments. +SCRIPT="build.cake" +TARGET="Default" +CONFIGURATION="Release" +VERBOSITY="verbose" +DRYRUN= +SHOW_VERSION=false +SCRIPT_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + -t|--target) TARGET="$2"; shift ;; + -c|--configuration) CONFIGURATION="$2"; shift ;; + -v|--verbosity) VERBOSITY="$2"; shift ;; + -d|--dryrun) DRYRUN="-dryrun" ;; + --version) SHOW_VERSION=true ;; + --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; + *) SCRIPT_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occured while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then + find . -type d ! -name . | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet packages." + exit 1 +fi + +$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5 + +popd >/dev/null + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +if $SHOW_VERSION; then + exec mono "$CAKE_EXE" -version +else + exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" +fi \ No newline at end of file diff --git a/src/Ombi.sln b/src/Ombi.sln index 41c80454f..15098fe95 100644 --- a/src/Ombi.sln +++ b/src/Ombi.sln @@ -8,7 +8,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D30CCF8-A115-4EB7-A34D-07780D752789}" ProjectSection(SolutionItems) = preProject ..\appveyor.yml = ..\appveyor.yml + ..\build.cake = ..\build.cake ..\BuildTask.ps1 = ..\BuildTask.ps1 + ..\CHANGELOG.md = ..\CHANGELOG.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Core", "Ombi.Core\Ombi.Core.csproj", "{F56E79C7-791D-4668-A0EC-29E3BBC8D24B}" @@ -69,7 +71,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Service", "Ombi.Ap EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.FanartTv", "Ombi.Api.FanartTv\Ombi.Api.FanartTv.csproj", "{FD947E63-A0D2-4878-8378-2005D5E9AB8A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Api.Pushbullet", "Ombi.Api.Pushbullet\Ombi.Api.Pushbullet.csproj", "{E237CDF6-D044-437D-B157-E9A3CC0BCF53}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Pushbullet", "Ombi.Api.Pushbullet\Ombi.Api.Pushbullet.csproj", "{E237CDF6-D044-437D-B157-E9A3CC0BCF53}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index bf24935db..4d49a53ab 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -4,8 +4,6 @@ netcoreapp1.1 win10-x64;osx.10.12-x64;ubuntu.16.04-x64;debian.8-x64;centos.7-x64; True - 3.0.0 - diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 246b91f58..cfbf50ba7 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -194,7 +194,7 @@ namespace Ombi app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions { #if !DEBUG - Authority = $"http://localhost:{port.Value}", + Authority = $"http://{url.Value}:{port.Value}", #else Authority = $"http://localhost:52038/", #endif diff --git a/src/Ombi/package.json b/src/Ombi/package.json index 684db0560..3eaecd91d 100644 --- a/src/Ombi/package.json +++ b/src/Ombi/package.json @@ -3,7 +3,7 @@ "private": true, "version": "1.0.0", "scripts": { - "test": "gulp test" + "publish": "gulp publish" }, "dependencies": { "@angular/animations": "4.1.3",