<commit_before>$psake.use_exit_on_error = $true
properties {
    $baseDir = (Split-Path -parent $psake.build_script_dir)
    $versionTag = git describe --abbrev=0 --tags
    $version = $versionTag + "."
    $version += (git log $($version + '..') --pretty=oneline | measure-object).Count
    $changeset=(git log -1 $($versionTag + '..') --pretty=format:%H)
    $nugetExe = "$env:ChocolateyInstall\ChocolateyInstall\nuget"
}

Task default -depends Build
Task Build -depends Test, Package
Task Deploy -depends Test, Package, Push-Nuget -description 'Versions, packages and pushes to Myget'
Task Package -depends Version-Module, Pack-Nuget, Unversion-Module -description 'Versions the psm1 and packs the module and example package'

Task Test {
    pushd "$baseDir"
    $pesterDir = (dir $env:ChocolateyInstall\lib\Pester*)
    if($pesterDir.length -gt 0) {$pesterDir = $pesterDir[-1]}
    exec {."$pesterDir\tools\bin\Pester.bat" $baseDir/Tests}
    popd
}

Task Version-Module -description 'Stamps the psm1 with the version and last changeset SHA' {
    (Get-Content "$baseDir\Helpers\boxstarter.helpers.psm1") | % {$_ -replace "\`$version\`$", "$version" } | % {$_ -replace "\`$sha\`$", "$changeset" } | Set-Content "$baseDir\helpers\boxstarter.helpers.psm1"
    (Get-Content "$baseDir\bootstrapper\boxstarter.psm1") | % {$_ -replace "\`$version\`$", "$version" } | % {$_ -replace "\`$sha\`$", "$changeset" } | Set-Content "$baseDir\bootstrapper\boxstarter.psm1"    
}

Task Unversion-Module -description 'Removes the versioning from the psm1' {
    (Get-Content "$baseDir\helpers\boxstarter.helpers.psm1") | % {$_ -replace "$version", "`$version`$" } | % {$_ -replace "$changeset", "`$sha`$" } | Set-Content "$baseDir\helpers\boxstarter.helpers.psm1"
    (Get-Content "$baseDir\bootstrapper\boxstarter.psm1") | % {$_ -replace "$version", "`$version`$" } | % {$_ -replace "$changeset", "`$sha`$" } | Set-Content "$baseDir\bootstrapper\boxstarter.psm1"
}

Task Pack-Nuget -description 'Packs the module and example package' {
    if (Test-Path "$baseDir\buildArtifacts") {
      Remove-Item "$baseDir\buildArtifacts" -Recurse -Force
    }
    if (Test-Path "$baseDir\buildPackages\*.nupkg") {
      Remove-Item "$baseDir\buildPackages\*.nupkg" -Force
    }
    mkdir "$baseDir\buildArtifacts"
    exec { .$nugetExe pack "$baseDir\BuildPackages\example\example.nuspec" -OutputDirectory "$baseDir\BuildPackages" -NoPackageAnalysis -version $version }
    exec { .$nugetExe pack "$baseDir\BuildPackages\example-light\example-light.nuspec" -OutputDirectory "$baseDir\BuildPackages" -NoPackageAnalysis -version $version }    
    exec { .$nugetExe pack "$baseDir\BuildPackages\test-package\test-package.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis }    
    exec { .$nugetExe pack "$baseDir\helpers\boxstarter.helpers.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis -version $version }
    exec { .$nugetExe pack "$baseDir\nuget\boxstarter.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis -version $version }
}

Task Push-Nuget -description 'Pushes the module to Myget feed' {
    $pkg = Get-Item -path $baseDir\buildPackages\example.*.*.*.nupkg
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildPackages\example-light.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.helpers.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
}

Task Push-Chocolatey -description 'Pushes the module to Chocolatey feed' {
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.*.*.*.nupkg   
    exec { cpush $pkg.FullName }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.helpers.*.*.*.nupkg   
    exec { cpush $pkg.FullName }
}<commit_msg>fix choco push<commit_after>$psake.use_exit_on_error = $true
properties {
    $baseDir = (Split-Path -parent $psake.build_script_dir)
    $versionTag = git describe --abbrev=0 --tags
    $version = $versionTag + "."
    $version += (git log $($version + '..') --pretty=oneline | measure-object).Count
    $changeset=(git log -1 $($versionTag + '..') --pretty=format:%H)
    $nugetExe = "$env:ChocolateyInstall\ChocolateyInstall\nuget"
}

Task default -depends Build
Task Build -depends Test, Package
Task Deploy -depends Test, Package, Push-Nuget -description 'Versions, packages and pushes to Myget'
Task Package -depends Version-Module, Pack-Nuget, Unversion-Module -description 'Versions the psm1 and packs the module and example package'

Task Test {
    pushd "$baseDir"
    $pesterDir = (dir $env:ChocolateyInstall\lib\Pester*)
    if($pesterDir.length -gt 0) {$pesterDir = $pesterDir[-1]}
    exec {."$pesterDir\tools\bin\Pester.bat" $baseDir/Tests}
    popd
}

Task Version-Module -description 'Stamps the psm1 with the version and last changeset SHA' {
    (Get-Content "$baseDir\Helpers\boxstarter.helpers.psm1") | % {$_ -replace "\`$version\`$", "$version" } | % {$_ -replace "\`$sha\`$", "$changeset" } | Set-Content "$baseDir\helpers\boxstarter.helpers.psm1"
    (Get-Content "$baseDir\bootstrapper\boxstarter.psm1") | % {$_ -replace "\`$version\`$", "$version" } | % {$_ -replace "\`$sha\`$", "$changeset" } | Set-Content "$baseDir\bootstrapper\boxstarter.psm1"    
}

Task Unversion-Module -description 'Removes the versioning from the psm1' {
    (Get-Content "$baseDir\helpers\boxstarter.helpers.psm1") | % {$_ -replace "$version", "`$version`$" } | % {$_ -replace "$changeset", "`$sha`$" } | Set-Content "$baseDir\helpers\boxstarter.helpers.psm1"
    (Get-Content "$baseDir\bootstrapper\boxstarter.psm1") | % {$_ -replace "$version", "`$version`$" } | % {$_ -replace "$changeset", "`$sha`$" } | Set-Content "$baseDir\bootstrapper\boxstarter.psm1"
}

Task Pack-Nuget -description 'Packs the module and example package' {
    if (Test-Path "$baseDir\buildArtifacts") {
      Remove-Item "$baseDir\buildArtifacts" -Recurse -Force
    }
    if (Test-Path "$baseDir\buildPackages\*.nupkg") {
      Remove-Item "$baseDir\buildPackages\*.nupkg" -Force
    }
    mkdir "$baseDir\buildArtifacts"
    exec { .$nugetExe pack "$baseDir\BuildPackages\example\example.nuspec" -OutputDirectory "$baseDir\BuildPackages" -NoPackageAnalysis -version $version }
    exec { .$nugetExe pack "$baseDir\BuildPackages\example-light\example-light.nuspec" -OutputDirectory "$baseDir\BuildPackages" -NoPackageAnalysis -version $version }    
    exec { .$nugetExe pack "$baseDir\BuildPackages\test-package\test-package.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis }    
    exec { .$nugetExe pack "$baseDir\helpers\boxstarter.helpers.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis -version $version }
    exec { .$nugetExe pack "$baseDir\nuget\boxstarter.nuspec" -OutputDirectory "$baseDir\buildArtifacts" -NoPackageAnalysis -version $version }
}

Task Push-Nuget -description 'Pushes the module to Myget feed' {
    $pkg = Get-Item -path $baseDir\buildPackages\example.*.*.*.nupkg
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildPackages\example-light.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.helpers.*.*.*.nupkg   
    exec { cpush $pkg.FullName -source "http://www.myget.org/F/boxstarter/api/v2/package" }
}

Task Push-Chocolatey -description 'Pushes the module to Chocolatey feed' {
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.0.*.*.nupkg   
    exec { cpush $pkg.FullName }
    $pkg = Get-Item -path $baseDir\buildArtifacts\boxstarter.helpers.*.*.*.nupkg   
    exec { cpush $pkg.FullName }
}
{'fraction_non_alphanumeric': 0.16325789664770665, 'fraction_numerical': 0.004719835410867724, 'mean_word_length': 3.945541591861161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7285379', 'n_tokens_mistral': 2891, 'n_tokens_neox': 2841, 'n_words': 560}