From 73db58b9c8d74604b1c597ea0229e64a3439aae2 Mon Sep 17 00:00:00 2001
From: Gary Ewan Park <gep13@gep13.co.uk>
Date: Tue, 22 Aug 2023 10:27:47 +0100
Subject: [PATCH 1/2] Delete gitversion.yml

---
 .github/workflows/gitversion.yml | 27 ---------------------------
 1 file changed, 27 deletions(-)
 delete mode 100644 .github/workflows/gitversion.yml

diff --git a/.github/workflows/gitversion.yml b/.github/workflows/gitversion.yml
deleted file mode 100644
index cd8456d..0000000
--- a/.github/workflows/gitversion.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: CI
-
-on: [push]
-
-jobs:
-  build:
-
-    runs-on: ubuntu-latest
-
-    steps:
-    - uses: actions/checkout@v1
-    - name: Fetch tags and master for GitVersion
-      run: |
-          git fetch --tags
-          git branch --create-reflog master origin/master
-    - name: Install GitVersion
-      uses: gittools/use-gitversion/setup@v0.2
-      with:
-          versionSpec: '5.1.x'
-    - name: Use GitVersion
-      id: gitversion # step id used as reference for output values
-      uses: gittools/use-gitversion/execute@v0.2
-    - run: |
-        echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
-        echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
-        echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
-        echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"

From 8ebe6ab187ae93f0d6db28fa29b2c8d4e92565af Mon Sep 17 00:00:00 2001
From: Gary Ewan Park <gep13@gep13.co.uk>
Date: Mon, 3 Feb 2025 10:33:54 +0000
Subject: [PATCH 2/2] Add basic files to get build working

This will allow testing with some changes that are coming down the pipe.
---
 .gitignore            |  60 ++++++++++
 build.bat             |  11 ++
 build.ps1             | 249 ++++++++++++++++++++++++++++++++++++++++++
 cake.config           |  14 +++
 chocolatey.snk        | Bin 0 -> 596 bytes
 recipe.cake           |  30 +++++
 tools/packages.config |   4 +
 7 files changed, 368 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 build.bat
 create mode 100644 build.ps1
 create mode 100644 cake.config
 create mode 100644 chocolatey.snk
 create mode 100644 recipe.cake
 create mode 100644 tools/packages.config

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c3f596f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,60 @@
+.svn
+.hg
+build_output
+code_drop
+[Bb]in
+obj
+src/packages
+lib/chocolatey/*.exe
+lib/chocolatey/*.dll
+lib/chocolatey/*.xml
+lib/chocolatey/*.pdb
+
+.editorconfig
+
+*.suo
+*.sln.docstates
+*.user
+*.csproj.user
+*.[rR]esharper.user
+*.DotSettings.user
+*.resharper
+_ReSharper*
+*.cache
+*~
+*.swp
+*.bak
+*.orig
+*.log
+*.pidb
+*userprefs
+*.nupkg
+!src/chocolatey.tests.integration/Resources/*.nupkg
+
+TestResult.xml
+submit.xml
+SolutionVersion.cs
+SolutionVersion.vb
+
+.DS_Store
+*.db
+src/_dotCover*/
+src/_dotTrace*/
+src/chocolatey.sln.GhostDoc.xml
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+
+# Rider
+.idea/
+
+# Build related
+tools/**
+!tools/packages.config
+!tools/Addins/packages.config
+!tools/Modules/packages.config
+BuildArtifacts/
+code_drop/
+
+# Chocolatey License (This covers all filenames used for test licenses)
+*chocolatey.license.xml
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..8a69bbd
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,11 @@
+@echo off
+set psscript="%~dp0build.ps1"
+echo ==================================================
+echo ============= WRAP POWERSHELL SCRIPT =============
+echo ==================================================
+
+echo calling %psscript% with args %*
+PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%psscript%' %*"
+set buildstatus=%ERRORLEVEL%
+echo ==================================================
+exit /b %buildstatus%
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
new file mode 100644
index 0000000..f20b355
--- /dev/null
+++ b/build.ps1
@@ -0,0 +1,249 @@
+##########################################################################
+# 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 ShowDescription
+Shows description about tasks.
+.PARAMETER DryRun
+Performs a dry run.
+.PARAMETER SkipToolPackageRestore
+Skips restoring of packages.
+.PARAMETER ScriptArgs
+Remaining arguments are added here.
+
+.LINK
+https://cakebuild.net
+
+#>
+
+[CmdletBinding()]
+Param(
+    [string]$Script = "recipe.cake",
+    [string]$Target,
+    [string]$Configuration,
+    [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
+    [string]$Verbosity,
+    [switch]$ShowDescription,
+    [Alias("WhatIf", "Noop")]
+    [switch]$DryRun,
+    [switch]$SkipToolPackageRestore,
+    [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
+    [string[]]$ScriptArgs
+)
+
+# Attempt to set highest encryption available for SecurityProtocol.
+# PowerShell will not set this by default (until maybe .NET 4.6.x). This
+# will typically produce a message for PowerShell v2 (just an info
+# message though)
+try
+{
+    # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192)
+    # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
+    # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
+    # installed (.NET 4.5 is an in-place upgrade).
+    [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192
+} catch {
+    Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
+}
+
+[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()
+        }
+    }
+}
+
+function GetProxyEnabledWebClient
+{
+    $wc = New-Object System.Net.WebClient
+    $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
+    $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+    $wc.Proxy = $proxy
+    return $wc
+}
+
+Write-Host "Preparing to run build script..."
+
+if(!$PSScriptRoot){
+    $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
+}
+
+$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
+$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
+$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
+$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"
+$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
+$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
+
+# 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 {
+        $wc = GetProxyEnabledWebClient
+        $wc.DownloadFile("https://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 {
+        $wc = GetProxyEnabledWebClient
+        $wc.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..."
+        Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
+        Remove-Item -Recurse
+    }
+
+    Write-Verbose -Message "Restoring tools from NuGet..."
+    $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
+
+    if ($LASTEXITCODE -ne 0) {
+        Throw "An error occurred while restoring NuGet tools."
+    }
+    else
+    {
+        $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
+    }
+    Write-Verbose -Message ($NuGetOutput | out-string)
+
+    Pop-Location
+}
+
+# Restore addins from NuGet
+if (Test-Path $ADDINS_PACKAGES_CONFIG) {
+    Push-Location
+    Set-Location $ADDINS_DIR
+
+    Write-Verbose -Message "Restoring addins from NuGet..."
+    $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
+
+    if ($LASTEXITCODE -ne 0) {
+        Throw "An error occurred while restoring NuGet addins."
+    }
+
+    Write-Verbose -Message ($NuGetOutput | out-string)
+
+    Pop-Location
+}
+
+# Restore modules from NuGet
+if (Test-Path $MODULES_PACKAGES_CONFIG) {
+    Push-Location
+    Set-Location $MODULES_DIR
+
+    Write-Verbose -Message "Restoring modules from NuGet..."
+    $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
+
+    if ($LASTEXITCODE -ne 0) {
+        Throw "An error occurred while restoring NuGet modules."
+    }
+
+    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"
+}
+
+
+
+# Build Cake arguments
+$cakeArguments = @("$Script");
+if ($Target) { $cakeArguments += "-target=$Target" }
+if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
+if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
+if ($ShowDescription) { $cakeArguments += "-showdescription" }
+if ($DryRun) { $cakeArguments += "-dryrun" }
+$cakeArguments += $ScriptArgs
+
+# Start Cake
+Write-Host "Running build script..."
+
+& "$CAKE_EXE" ./recipe.cake --bootstrap
+if ($LASTEXITCODE -eq 0)
+{
+    & "$CAKE_EXE" $cakeArguments
+}
+
+exit $LASTEXITCODE
\ No newline at end of file
diff --git a/cake.config b/cake.config
new file mode 100644
index 0000000..4db963c
--- /dev/null
+++ b/cake.config
@@ -0,0 +1,14 @@
+; This is the default configuration file for Cake.
+; This file was downloaded from https://github.com/cake-build/resources
+
+[Nuget]
+UseInProcessClient=true
+LoadDependencies=false
+
+[Paths]
+Tools=./tools
+Addins=./tools/Addins
+Modules=./tools/Modules
+
+[Settings]
+SkipVerification=true
\ No newline at end of file
diff --git a/chocolatey.snk b/chocolatey.snk
new file mode 100644
index 0000000000000000000000000000000000000000..ed3455d270a47659ddf14b0ca5a843815ddbe7d3
GIT binary patch
diff --git a/recipe.cake b/recipe.cake
new file mode 100644
index 0000000..7d95b04
--- /dev/null
+++ b/recipe.cake
@@ -0,0 +1,30 @@
+#load nuget:?package=Chocolatey.Cake.Recipe&version=0.28.4
+
+///////////////////////////////////////////////////////////////////////////////
+// RECIPE SCRIPT
+///////////////////////////////////////////////////////////////////////////////
+
+Environment.SetVariableNames();
+
+BuildParameters.SetParameters(context: Context,
+                            buildSystem: BuildSystem,
+                            sourceDirectoryPath: "./src",
+                            solutionFilePath: "./src/fakerepository.sln",
+                            solutionDirectoryPath: "./src/fakerepository",
+                            resharperSettingsFileName: "fakerepository.sln.DotSettings",
+                            title: "Fake Repository",
+                            repositoryOwner: "gittools",
+                            repositoryName: "fakerepository",
+                            productName: "Fake Project",
+                            productDescription: "The Ultimate Fake Repository.",
+                            productCopyright: string.Format("Copyright © 2025 - {0} gep13.", DateTime.Now.Year),
+                            shouldStrongNameSignDependentAssemblies: true,
+                            strongNameDependentAssembliesInputPath: string.Format("{0}{1}", ((FilePath)("./src")).FullPath, "\\packages\\RestSharp*"),
+                            treatWarningsAsErrors: false,
+                            shouldRunILMerge: false);
+
+ToolSettings.SetToolSettings(context: Context);
+
+BuildParameters.PrintParameters(Context);
+
+Build.Run();
diff --git a/tools/packages.config b/tools/packages.config
new file mode 100644
index 0000000..ef49ed4
--- /dev/null
+++ b/tools/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+	<package id="Cake" version="0.38.5" />
+</packages>
\ No newline at end of file
