<commit_before><#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.

.PARAMETER Target
The build script target to run.
#>

[CmdletBinding()]
Param(
    [string]$Target,
    [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
    [string[]]$ScriptArgs
)

$CakeVersion = "0.30.0"

# create cake directory
$CakeDirPath = Join-Path $PSScriptRoot "cake"
New-Item -Path $CakeDirPath -Type Directory -ErrorAction SilentlyContinue | Out-Null

# create packages.config
$PackagesConfigPath = Join-Path $CakeDirPath "packages.config"
[System.IO.File]::WriteAllLines($PackagesConfigPath, @(
    "<?xml version=`"1.0`" encoding=`"utf-8`"?>",
    "<packages>",
    "`t<package id=`"Cake`" version=`"$CakeVersion`" />",
    "</packages>"))

# download nuget.exe if not in path and not already downloaded
$NuGetExe = Get-Command "nuget.exe" -ErrorAction SilentlyContinue
If ($NuGetExe -ne $null) {
    $NuGetExePath = $NuGetExe.Path
}
Else {
    $NuGetExePath = Join-Path $CakeDirPath "nuget.exe"
    If (!(Test-Path $NuGetExePath)) {
        Invoke-WebRequest -Uri http://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NuGetExePath
    }
}

# use NuGet to download Cake
Push-Location $CakeDirPath
Invoke-Expression "&`"$NuGetExePath`" install -OutputDirectory ."
If ($LASTEXITCODE -ne 0) {
    Throw "An error occurred while restoring NuGet tools."
}
Pop-Location

# run Cake with specified arguments
$CakeExePath = Join-Path $CakeDirPath "Cake.$CakeVersion/Cake.exe"
$ExtraArgs = ""<commit_msg>Only download Cake if necessary.<commit_after><#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.

.PARAMETER Target
The build script target to run.
#>

[CmdletBinding()]
Param(
    [string]$Target,
    [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
    [string[]]$ScriptArgs
)

$CakeVersion = "0.30.0"

# create cake directory
$CakeDirPath = Join-Path $PSScriptRoot "cake"
New-Item -Path $CakeDirPath -Type Directory -ErrorAction SilentlyContinue | Out-Null

# download nuget.exe if not in path and not already downloaded
$NuGetExe = Get-Command "nuget.exe" -ErrorAction SilentlyContinue
If ($NuGetExe -ne $null) {
    $NuGetExePath = $NuGetExe.Path
}
Else {
    $NuGetExePath = Join-Path $CakeDirPath "nuget.exe"
    If (!(Test-Path $NuGetExePath)) {
        Invoke-WebRequest -Uri http://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NuGetExePath
    }
}

# download Cake if necessary
$CakeExePath = Join-Path $CakeDirPath "Cake.$CakeVersion/Cake.exe"
If (!(Test-Path $CakeExePath)) {
    # create packages.config
    $PackagesConfigPath = Join-Path $CakeDirPath "packages.config"
    [System.IO.File]::WriteAllLines($PackagesConfigPath, @(
        "<?xml version=`"1.0`" encoding=`"utf-8`"?>",
        "<packages>",
        "`t<package id=`"Cake`" version=`"$CakeVersion`" />",
        "</packages>"))

    # use NuGet to download Cake
    Push-Location $CakeDirPath
    Invoke-Expression "&`"$NuGetExePath`" install -OutputDirectory ."
    If ($LASTEXITCODE -ne 0) {
        Throw "An error occurred while restoring NuGet tools."
    }
    Pop-Location
}

# run Cake with specified arguments
$ExtraArgs = ""
{'fraction_non_alphanumeric': 0.13946957878315133, 'fraction_numerical': 0.006864274570982839, 'mean_word_length': 4.230016313213703, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 2, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3242725', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1096, 'n_words': 261}