conversations
listlengths 2
3
| source
stringclasses 1
value | stack
stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to push nuget package to nuget\n"
},
{
"from": "gpt",
"value": "param([string]$apikey) \n$pkg = ls .\\XUnitRemote\\bin\\Debug\\*.nupkg | sort-object | select-object -last 1\n./nuget.exe push $pkg.FullName -ApiKey $apikey \n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add some new PowerShell aliases.\n"
},
{
"from": "human",
"value": "# Use the Git and posh-git from GitHub for Windows.\n# See <http://stackoverflow.com/a/12524788>\n. (Resolve-Path \"$env:LOCALAPPDATA\\GitHub\\shell.ps1\")\n. $env:github_posh_git\\profile.example.ps1\n\nImport-Module PSReadLine\nSet-PSReadlineOption -EditMode Emacs\n\n# Shortcut for running chef-client. '-A' makes chef-client fail out if\n# not run as administrator.\nfunction converge {\n\tchef-client -A\n}\n\nfunction which ([string]$cmd) {\n\t# Use Definition instead of Path to work better with Cmdlets\n\t(Get-Command $cmd).Definition\n}\n\n# Matches aliases in dotfiles\nNew-Alias ccopy clip\nNew-Alias cpaste paste\n"
},
{
"from": "gpt",
"value": "# Use the Git and posh-git from GitHub for Windows.\n# See <http://stackoverflow.com/a/12524788>\n. (Resolve-Path \"$env:LOCALAPPDATA\\GitHub\\shell.ps1\")\n. $env:github_posh_git\\profile.example.ps1\n\nImport-Module PSReadLine\nSet-PSReadlineOption -EditMode Emacs\n\n# Shortcut for running chef-client. '-A' makes chef-client fail out if\n# not run as administrator.\nfunction converge {\n\tchef-client -A\n}\n\nfunction which ([string]$cmd) {\n\t# Use Definition instead of Path to work better with Cmdlets\n\t(Get-Command $cmd).Definition\n}\n\n# Matches aliases in dotfiles\nNew-Alias ccopy clip\nNew-Alias cpaste paste\nNew-Alias c Set-Location\nNew-Alias l Get-ChildItem\nfunction u () {\n\t Set-Location ..\n}\nNew-Alias py python\nNew-Alias ipy ipython\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Revert changes to es start script\n"
},
{
"from": "human",
"value": "$es_version = \"5.0.0\"\nIf ($env:ES_VERSION) {\n $es_version = $env:ES_VERSION\n}\n\nIf ($env:JAVA_HOME -eq $null -or !(Test-Path -Path $env:JAVA_HOME)) {\n Write-Error \"Please ensure the latest version of java is installed and the JAVA_HOME environmental variable has been set.\"\n Return\n}\n\nPush-Location $PSScriptRoot\n\nIf (!(Test-Path -Path \"elasticsearch-$es_version\") -And !(Test-Path -Path \"elasticsearch-$es_version.zip\")) {\n Invoke-WebRequest \"https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$es_version.zip\" -OutFile \"elasticsearch-$es_version.zip\"\n}\n\nIf ((Test-Path -Path \"elasticsearch-$es_version.zip\") -And !(Test-Path -Path \"elasticsearch-$es_version\")) {\n Add-Type -assembly \"system.io.compression.filesystem\"\n [io.compression.zipfile]::ExtractToDirectory(\"$PSScriptRoot\\elasticsearch-$es_version.zip\", $PSScriptRoot)\n cp .\\elasticsearch.yml .\\elasticsearch-$es_version\\config -Force\n rm elasticsearch-$es_version.zip\n}\n\n&\"$(Get-Location)\\elasticsearch-$es_version\\bin\\elasticsearch.bat\"\n\nPop-Location\n"
},
{
"from": "gpt",
"value": "$es_version = \"5.0.0\"\nIf ($env:ES_VERSION) {\n $es_version = $env:ES_VERSION\n}\n\nIf ($env:JAVA_HOME -eq $null -or !(Test-Path -Path $env:JAVA_HOME)) {\n Write-Error \"Please ensure the latest version of java is installed and the JAVA_HOME environmental variable has been set.\"\n Return\n}\n\nPush-Location $PSScriptRoot\n\nIf (!(Test-Path -Path \"elasticsearch-$es_version\") -And !(Test-Path -Path \"elasticsearch-$es_version.zip\")) {\n Invoke-WebRequest \"https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$es_version.zip\" -OutFile \"elasticsearch-$es_version.zip\"\n}\n\nIf ((Test-Path -Path \"elasticsearch-$es_version.zip\") -And !(Test-Path -Path \"elasticsearch-$es_version\")) {\n Add-Type -assembly \"system.io.compression.filesystem\"\n [io.compression.zipfile]::ExtractToDirectory(\"$PSScriptRoot\\elasticsearch-$es_version.zip\", $PSScriptRoot)\n cp .\\elasticsearch.yml .\\elasticsearch-$es_version\\config -Force\n rm elasticsearch-$es_version.zip\n}\n\nStart-Process -NoNewWindow \"$(Get-Location)\\elasticsearch-$es_version\\bin\\elasticsearch.bat\"\n\nPop-Location\n\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Allow packaging only recently modified Quarks\n"
},
{
"from": "human",
"value": "Include-PluginScripts\r\n\r\ntask SetVersion\r\n\r\ntask Pack {\r\n\tNew-Item $artifactsPath -Type directory -Force | Out-Null\r\n\tGet-ChildItem $basePath\\$projectName\\*.nuspec -Recurse | %{ exec { & NuGet pack $_.FullName -OutputDirectory $artifactsPath } }\r\n}\r\n\r\ntask . Clean, Compile, Test, Pack"
},
{
"from": "gpt",
"value": "Include-PluginScripts\r\n\r\nfunction Pack-Nuspecs ($dateModified) {\r\n\tNew-Item $artifactsPath -Type directory -Force | Out-Null\r\n\t$nuspecs = Get-ChildItem $basePath\\$projectName\\*.nuspec -Recurse\r\n\tif ($dateModified) {\r\n\t\t$nuspecs = $nuspecs | Where { $_.LastWriteTime -gt $dateModified }\r\n\t}\r\n\t$nuspecs | %{ exec { & NuGet pack $_.FullName -OutputDirectory $artifactsPath } }\r\n}\r\n\r\ntask Pack {\r\n\tPack-Nuspecs\r\n}\r\n\r\ntask PackRecentlyModified {\r\n\tPack-Nuspecs (Get-Date).AddDays(-1)\r\n}\r\n\r\ntask . Clean, Compile, Test, PackRecentlyModified"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Enable strict mode for the module\n"
},
{
"from": "human",
"value": "# Import all scripts as functions\n$Scripts = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Scripts') -File\nforeach ($Script in $Scripts) {\n New-Item -Path ('Function:\\{0}' -f $Script.BaseName) -Value (Get-Content -Path $Script.FullName -Raw)\n}\n"
},
{
"from": "gpt",
"value": "# See the help for Set-StrictMode for the full details on what this enables.\nSet-StrictMode -Version 2.0\n\n# Import all scripts as functions\n$Scripts = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Scripts') -File\nforeach ($Script in $Scripts) {\n New-Item -Path ('Function:\\{0}' -f $Script.BaseName) -Value (Get-Content -Path $Script.FullName -Raw)\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add Get/Set ExecutionPolicy cmdlets back to module\n\nWithout these declared in the Unix module manifest,\nthe related tests fail as the cmdlets cannot be found.\nThis is a regression.\n"
},
{
"from": "human",
"value": "@{\nGUID=\"A94C8C7E-9810-47C0-B8AF-65089C13A35A\"\nAuthor=\"Microsoft Corporation\"\nCompanyName=\"Microsoft Corporation\"\nCopyright=\" Microsoft Corporation. All rights reserved.\"\nModuleVersion=\"3.0.0.0\"\nPowerShellVersion=\"3.0\"\nAliasesToExport = @()\nFunctionsToExport = @()\nCmdletsToExport=\"Get-Credential\", \"ConvertFrom-SecureString\", \"ConvertTo-SecureString\"\nNestedModules=\"Microsoft.PowerShell.Security.dll\"\nHelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=390786'\n}\n"
},
{
"from": "gpt",
"value": "@{\nGUID=\"A94C8C7E-9810-47C0-B8AF-65089C13A35A\"\nAuthor=\"Microsoft Corporation\"\nCompanyName=\"Microsoft Corporation\"\nCopyright=\" Microsoft Corporation. All rights reserved.\"\nModuleVersion=\"3.0.0.0\"\nPowerShellVersion=\"3.0\"\nAliasesToExport = @()\nFunctionsToExport = @()\nCmdletsToExport=\"Get-Credential\", \"Get-ExecutionPolicy\", \"Set-ExecutionPolicy\", \"ConvertFrom-SecureString\", \"ConvertTo-SecureString\"\nNestedModules=\"Microsoft.PowerShell.Security.dll\"\nHelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=390786'\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Make User parameter optional in Get-NonInheritedACLs\n"
},
{
"from": "human",
"value": "# Retrieve files with a minimum number of hard links\nFunction Get-MultipleHardLinks {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [IO.DirectoryInfo]$Path,\n\n [ValidateScript({$_ -gt 1})]\n [Int]$MinimumHardLinks=2,\n\n [Switch]$Recurse\n )\n\n $Files = Get-ChildItem -Path $Path -File -Recurse:$Recurse | Where-Object {\n $_.LinkType -eq 'HardLink' -and $_.Target.Count -ge ($MinimumHardLinks - 1)\n } | Add-Member -MemberType ScriptProperty -Name LinkCount -Value { $this.Target.Count + 1 } -Force\n\n return $Files\n}\n\nFunction Get-NonInheritedACLs {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()]\n [String]$Path,\n\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()]\n [String]$User\n )\n\n $ACLMatches = @()\n $Directories = Get-ChildItem -Path $Path -Directory -Recurse\n\n foreach ($Directory in $Directories) {\n $ACL = Get-ACL -Path $Directory.FullName\n $ACLNonInherited = $ACL.Access | Where-Object { $_.IsInherited -eq $false }\n\n if ($ACLNonInherited.IdentityReference -contains $User) {\n $ACLMatches += $Directory\n }\n }\n\n return $ACLMatches\n}\n"
},
{
"from": "gpt",
"value": "# Retrieve files with a minimum number of hard links\nFunction Get-MultipleHardLinks {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [IO.DirectoryInfo]$Path,\n\n [ValidateScript({$_ -gt 1})]\n [Int]$MinimumHardLinks=2,\n\n [Switch]$Recurse\n )\n\n $Files = Get-ChildItem -Path $Path -File -Recurse:$Recurse | Where-Object {\n $_.LinkType -eq 'HardLink' -and $_.Target.Count -ge ($MinimumHardLinks - 1)\n } | Add-Member -MemberType ScriptProperty -Name LinkCount -Value { $this.Target.Count + 1 } -Force\n\n return $Files\n}\n\n# Retrieve directories with non-inherited ACLs\nFunction Get-NonInheritedACLs {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [IO.DirectoryInfo]$Path,\n\n [ValidateNotNullOrEmpty()]\n [String]$User,\n\n [Switch]$Recurse\n )\n\n $Directories = Get-ChildItem -Path $Path -Directory -Recurse:$Recurse\n\n $ACLMatches = @()\n foreach ($Directory in $Directories) {\n $ACL = Get-ACL -Path $Directory.FullName\n $ACLNonInherited = $ACL.Access | Where-Object { $_.IsInherited -eq $false }\n\n if (!$ACLNonInherited) {\n continue\n }\n\n if ($PSBoundParameters.ContainsKey('User')) {\n if ($ACLNonInherited.IdentityReference -notcontains $User) {\n continue\n }\n }\n\n $ACLMatches += $Directory\n }\n\n return $ACLMatches\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add an Appveyor forwarding script, still waiting to see if it can be improved\n"
},
{
"from": "gpt",
"value": "$VAR=Invoke-WebRequest https://raw.github.com/ndmitchell/neil/master/misc/appveyor.ps1\n$TEMP=New-TemporaryFile\n$FILE=$TEMP.FullName + \".ps1\"\n$VAR.Content | Out-File $FILE\n& $FILE weeder $args\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Move our output files to out too\n"
},
{
"from": "human",
"value": "$baseDir = Resolve-Path \"$PSScriptRoot/..\"\n$outDir = \"$baseDir\\out\"\n$msbuildExe = \"C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\MsBuild.exe\"\n$nugetExe = \"$baseDir\\.nuget\\NuGet.exe\"\n\n$configsToBuild = {\"Release\", \"MonoRelease\"}\n\nif ($env:APPVEYOR) {\n $testExe = \"xunit.console.clr4\"\n $testFlags = '/appveyor'\n} else {\n $testExe = \"$baseDir\\tools\\xunit\\xunit.console.clr4.exe\"\n $testFlags = ''\n}\n\ngit clean -xdf\n& \"$nugetExe\" restore \"$baseDir\\Bugsnag.sln\"\n\nforeach-object $configsToBuild | % { & $msbuildExe \"$baseDir/Bugsnag.sln\" \"/p:Configuration=$_\" }\n\n$filesToTest = ls -r \"$baseDir\\test\\bin\\**\\Bugsnag.Test.dll\"\necho $filesToTest | % { & $testExe \"$_\" $testFlags }\n\nmkdir -p $outDir\n\n& $nugetExe pack $baseDir\\Bugsnag.nuspec -OutputDirectory $outDir\n& $nugetExe pack $baseDir\\BugsnagMono.nuspec -OutputDirectory $outDir"
},
{
"from": "gpt",
"value": "$baseDir = Resolve-Path \"$PSScriptRoot\"\n$outDir = \"$baseDir\\out\"\n$msbuildExe = \"C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\MsBuild.exe\"\n$nugetExe = \"$baseDir\\.nuget\\NuGet.exe\"\n\n$configsToBuild = {\"Release\", \"MonoRelease\"}\n\nif ($env:APPVEYOR) {\n $testExe = \"xunit.console.clr4\"\n $testFlags = '/appveyor'\n} else {\n $testExe = \"$baseDir\\tools\\xunit\\xunit.console.clr4.exe\"\n $testFlags = ''\n}\n\ngit clean -xdf\n& \"$nugetExe\" restore \"$baseDir\\Bugsnag.sln\"\n\nforeach-object $configsToBuild | % { & $msbuildExe \"$baseDir/Bugsnag.sln\" \"/p:Configuration=$_\" }\n\n$filesToTest = ls -r \"$baseDir\\test\\bin\\**\\Bugsnag.Test.dll\"\necho $filesToTest | % { & $testExe \"$_\" $testFlags }\n\nmkdir -Path $outDir\n\n& \"$nugetExe\" pack $baseDir\\Bugsnag.nuspec -OutputDirectory $outDir\n& \"$nugetExe\" pack $baseDir\\BugsnagMono.nuspec -OutputDirectory $outDir\nmv \"$baseDir\\src\\Bugsnag\\bin\\Release\\*\" $outDir\nls \"$baseDir\\src\\Bugsnag\\bin\\MonoRelease\\*\" | %{\n\t$monoName = \"mono-\" + $_.Name \n\tmv $_ \"$outDir\\$monoName\"\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Correct branch detection in build script\n"
},
{
"from": "human",
"value": "Push-Location $PSScriptRoot\n\nif(Test-Path .\\artifacts) { Remove-Item .\\artifacts -Force -Recurse }\n\n& dotnet restore --no-cache\n\n$branch = $(git symbolic-ref --short -q HEAD)\n$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = \"local\" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];\n$suffix = @{ $true = \"\"; $false = \"$branch-$revision\"}[$branch -eq \"master\" -and $revision -ne \"local\"]\n\nforeach ($src in ls src/Serilog.*) {\n Push-Location $src\n\n & dotnet pack -c Release -o ..\\..\\.\\artifacts --version-suffix=$suffix\n if($LASTEXITCODE -ne 0) { exit 1 } \n\n Pop-Location\n}\n\nforeach ($test in ls test/Serilog.*.Tests) {\n Push-Location $test\n\n & dotnet test -c Release\n if($LASTEXITCODE -ne 0) { exit 2 }\n\n Pop-Location\n}\n\nPop-Location\n"
},
{
"from": "gpt",
"value": "Push-Location $PSScriptRoot\n\nif(Test-Path .\\artifacts) { Remove-Item .\\artifacts -Force -Recurse }\n\n& dotnet restore --no-cache\n\n$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];\n$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = \"local\" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];\n$suffix = @{ $true = \"\"; $false = \"$branch-$revision\"}[$branch -eq \"master\" -and $revision -ne \"local\"]\n\nforeach ($src in ls src/Serilog.*) {\n Push-Location $src\n\n & dotnet pack -c Release -o ..\\..\\.\\artifacts --version-suffix=$suffix\n if($LASTEXITCODE -ne 0) { exit 1 } \n\n Pop-Location\n}\n\nforeach ($test in ls test/Serilog.*.Tests) {\n Push-Location $test\n\n & dotnet test -c Release\n if($LASTEXITCODE -ne 0) { exit 2 }\n\n Pop-Location\n}\n\nPop-Location\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Determine status behaviour based on PS version\n"
},
{
"from": "human",
"value": "Param(\n [Parameter(Mandatory=$true)]\n [string]$VmId\n)\n\n# Include the following modules\n$Dir = Split-Path $script:MyInvocation.MyCommand.Path\n. ([System.IO.Path]::Combine($Dir, \"utils\\write_messages.ps1\"))\n\n# Get the VM with the given name\ntry {\n $VM = Get-VM -Id $VmId -ErrorAction \"Stop\"\n $State = $VM.state\n $Status = $VM.status\n} catch [Microsoft.HyperV.PowerShell.VirtualizationException] {\n $State = \"not_created\"\n $Status = $State\n}\n\n$resultHash = @{\n state = \"$State\"\n status = \"$Status\"\n}\n$result = ConvertTo-Json $resultHash\nWrite-Output-Message $result\n"
},
{
"from": "gpt",
"value": "Param(\n [Parameter(Mandatory=$true)]\n [string]$VmId\n)\n\n# Include the following modules\n$Dir = Split-Path $script:MyInvocation.MyCommand.Path\n. ([System.IO.Path]::Combine($Dir, \"utils\\write_messages.ps1\"))\n\n\nif($PSVersionTable.PSVersion.Major -le 4) {\n $ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException]\n} else {\n $ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationException]\n}\n\ntry {\n $VM = Get-VM -Id $VmId -ErrorAction \"Stop\"\n $State = $VM.state\n $Status = $VM.status\n} catch $ExceptionType {\n $State = \"not_created\"\n $Status = $State\n}\n\n$resultHash = @{\n state = \"$State\"\n status = \"$Status\"\n}\n$result = ConvertTo-Json $resultHash\nWrite-Output-Message $result\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Create a script to restore the release files\n"
},
{
"from": "gpt",
"value": "New-Item Releases -type directory -force\n\n$wc = New-Object System.Net.WebClient\n\n$wc.DownloadFile(\"https://s3.amazonaws.com/espera/Releases/Dev/RELEASES\", \".\\Releases/RELEASES\");\n\nGet-Content \".\\Releases\\RELEASES\" | ForEach-Object {\n $_ -match \".* (.*) .*\" >$null\n $filename = $matches[1]\n\n $wc.DownloadFile(\"https://s3.amazonaws.com/espera/Releases/Dev/\" + $filename, \".\\Releases/\" + $filename);\n\n \"Downloaded \" + $filename\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use more conservative TLS settings to work on older .NET versions\n"
},
{
"from": "human",
"value": "# Powershell supports only TLS 1.0 by default. Add support for TLS 1.2 and TLS 1.3\n[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12,Tls13'\n\n# Define script root for PowerShell 2.0\n$ScriptRoot = Split-Path $script:MyInvocation.MyCommand.Path\n\n# Download the upstream bootstrap script\n(New-Object System.Net.WebClient).DownloadFile('https://winbootstrap.saltproject.io', \"${ScriptRoot}\\bootstrap_salt_upstream.ps1\")\n\n# Run the upstream bootstrap script with passthrough arguments\n& \"${ScriptRoot}\\bootstrap_salt_upstream.ps1\" @args\n"
},
{
"from": "gpt",
"value": "# Powershell supports only TLS 1.0 by default. Add support for TLS 1.2\n[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'\n\n# Define script root for PowerShell 2.0\n$ScriptRoot = Split-Path $script:MyInvocation.MyCommand.Path\n\n# Download the upstream bootstrap script\n(New-Object System.Net.WebClient).DownloadFile('https://winbootstrap.saltproject.io', \"${ScriptRoot}\\bootstrap_salt_upstream.ps1\")\n\n# Run the upstream bootstrap script with passthrough arguments\n& \"${ScriptRoot}\\bootstrap_salt_upstream.ps1\" @args\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add another cosmos db tool for vscode"
},
{
"from": "human",
"value": "###\n### Install Visual Studio Code via Chocolatey and my preferred extensions\n###\n\n$Extensions = @(\n 'ms-dotnettools.csharp',\n 'github.codespaces',\n 'ms-vscode.powershell',\n 'ms-azuretools.vscode-docker',\n 'eamodio.gitlens',\n 'ms-mssql.mssql',\n 'esbenp.prettier-vscode',\n 'ms-azuretools.vscode-cosmosdb'\n)\n\nchoco install vscode\n\nforeach($Extension in $Extensions)\n{\n Write-Output \"Installing VSCode Extension $Extension\"\n\n & \"C:\\Program Files\\Microsoft VS Code\\bin\\code.cmd\" --install-extension $Extension\n}\n"
},
{
"from": "gpt",
"value": "###\n### Install Visual Studio Code via Chocolatey and my preferred extensions\n###\n\n$Extensions = @(\n 'ms-dotnettools.csharp',\n 'github.codespaces',\n 'ms-vscode.powershell',\n 'ms-azuretools.vscode-docker',\n 'eamodio.gitlens',\n 'ms-mssql.mssql',\n 'esbenp.prettier-vscode',\n 'ms-azuretools.vscode-cosmosdb',\n 'savranweb.cosmosdbsqlapi'\n)\n\nchoco install vscode\n\nforeach($Extension in $Extensions)\n{\n Write-Output \"Installing VSCode Extension $Extension\"\n\n & \"C:\\Program Files\\Microsoft VS Code\\bin\\code.cmd\" --install-extension $Extension\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add build script for release configuration\n"
},
{
"from": "gpt",
"value": "$solutionfile = \"..\\AppFabric.Admin.sln\"\n$msbuild = $env:windir + \"\\Microsoft.NET\\Framework64\\v4.0.30319\\msbuild.exe\"\n$msbuildargs = $solutionfile + \" /t:rebuild /property:Configuration=Release /fl /flp:logfile=releasebuild.log\"\nStart-Process $msbuild $msbuildargs\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix twine call on Appveyor\n\nSigned-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>\n"
},
{
"from": "human",
"value": "trap { Write-Error $_; Exit 1 }\n\npip install twine\ntwine upload dist/*\n"
},
{
"from": "gpt",
"value": "trap { Write-Error $_; Exit 1 }\n\npython -m pip install --disable-pip-version-check twine\npython -m twine upload --verbose dist/*\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use elseif for edit command\n"
},
{
"from": "human",
"value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\nif (Get-Command \"atom\" -ErrorAction SilentlyContinue) {\n Set-Alias edit atom\n}\nif (Get-Command \"code\" -ErrorAction SilentlyContinue) {\n Set-Alias edit code\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n"
},
{
"from": "gpt",
"value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Get-Command \"code\" -ErrorAction SilentlyContinue) {\n function edit {\n Start-Process code -WindowStyle Minimized $args\n }\n} elseif (Get-Command \"atom\" -ErrorAction SilentlyContinue) {\n Set-Alias edit atom\n} elseif (Test-Path 'C:\\Program Files\\Sublime Text 3') {\n Set-Alias edit 'C:\\Program Files\\Sublime Text 3\\sublime_text'\n}\n\n[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add new tests for Get-WinEvent\n"
},
{
"from": "human",
"value": "Describe 'Get-WinEvent' -Tags \"CI\" {\n\n # Get-WinEvent works only on windows\n It 'can query a System log' -Skip:(-not $IsWindows) {\n Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null\n }\n}\n"
},
{
"from": "gpt",
"value": "Describe 'Get-WinEvent' -Tags \"CI\" {\n BeforeAll {\n if ( ! $IsWindows )\n {\n $origDefaults = $PSDefaultParameterValues.Clone()\n $PSDefaultParameterValues['it:skip'] = $true\n }\n }\n AfterAll {\n if ( ! $IsWindows ){\n $global:PSDefaultParameterValues = $origDefaults\n }\n }\n Context \"Get-WinEvent ListProvider parameter\" {\n It 'Get-WinEvent can list the providers' {\n $result = Get-WinEvent -listprovider * -erroraction ignore\n $result | should not BeNullOrEmpty\n }\n It 'Get-WinEvent can get a provider by name' {\n $providers = Get-WinEvent -listprovider * -erroraction ignore\n $result = Get-WinEvent -listprovider ($providers[0].name)\n $result | should not BeNullOrEmpty\n }\n\n }\n Context \"Get-WinEvent can retrieve events\" {\n # for this set of tests we need to have a provider which has multiple events\n BeforeAll {\n $foundEvents = $false\n $providers = Get-WinEvent -listprovider * -erroraction ignore\n foreach($provider in $providers) {\n $events = Get-WinEvent -provider $provider.name -erroraction ignore\n if ( $events.Count -gt 2 ) {\n $providerForTests = $provider\n $foundEvents = $true\n break\n }\n }\n }\n It 'Get-WinEvent can get events from a provider' {\n # we sample the first 20 results, as this could be very large\n $results = Get-WinEvent -provider $providerForTests.Name -max 20\n foreach($event in $results ) {\n $event.providername | should be $providerForTests.name\n }\n }\n It 'Get-WinEvent can get events via logname' {\n $results = get-winevent -logname $providerForTests.LogLinks.LogName -MaxEvents 10 \n $results | should not BeNullOrEmpty\n }\n It 'Get-WinEvent can use the simplest of filters' {\n $filter = @{ ProviderName = $providerForTests.Name }\n $testEvents = Get-WinEvent -filterhashtable $filter\n $testEvents.Count | should be $events.Count\n }\n It 'Get-WinEvent can use a filter which includes two items' {\n $filter = @{ ProviderName = $providerForTests.Name; Id = $events[0].Id}\n $results = Get-WinEvent -filterHashtable $filter\n $results | Should not BeNullOrEmpty\n }\n }\n # Get-WinEvent works only on windows\n It 'can query a System log' {\n Get-WinEvent -LogName System -MaxEvents 1 | Should Not BeNullOrEmpty\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add testcase: install vm by iso\n"
},
{
"from": "gpt",
"value": "###############################################################################\n##\n## Description:\n## Check vm, because vm is already installed by iso, so only check vm exists\n## Return passed, case is passed; return failed, case is failed\n##\n###############################################################################\n##\n## Revision:\n## v1.0 - hhei - 2/21/2017 - Check vm.\n##\n###############################################################################\n\n<#\n.Synopsis\n reboot in vm.\n\n.Description\n Check reboot in vm.\n\n.Parameter vmName\n Name of the test VM.\n\n.Parameter testParams\n Semicolon separated list of test parameters.\n#>\n\nparam([String] $vmName, [String] $hvServer, [String] $testParams)\n#\n# Checking the input arguments\n#\nif (-not $vmName)\n{\n \"Error: VM name cannot be null!\"\n exit\n}\n\nif (-not $hvServer)\n{\n \"Error: hvServer cannot be null!\"\n exit\n}\n\nif (-not $testParams)\n{\n Throw \"Error: No test parameters specified\"\n}\n\n#\n# Display the test parameters so they are captured in the log file\n#\n\"TestParams : '${testParams}'\"\n\n#\n# Parse the test parameters\n#\n$rootDir = $null\n$sshKey = $null\n$ipv4 = $null\n\n$params = $testParams.Split(\";\")\nforeach ($p in $params)\n{\n $fields = $p.Split(\"=\")\n switch ($fields[0].Trim())\n {\n \"sshKey\" { $sshKey = $fields[1].Trim() }\n \"rootDir\" { $rootDir = $fields[1].Trim() }\n \"ipv4\" { $ipv4 = $fields[1].Trim() }\n default {}\n }\n}\n\nif (-not $rootDir)\n{\n \"Warn : no rootdir was specified\"\n}\nelse\n{\n if ( (Test-Path -Path \"${rootDir}\") )\n {\n cd $rootDir\n }\n else\n {\n \"Warn : rootdir '${rootDir}' does not exist\"\n }\n}\n\n#\n# Source the tcutils.ps1 file\n#\n. .\\setupscripts\\tcutils.ps1\n\nPowerCLIImport\nConnectToVIServer $env:ENVVISIPADDR `\n $env:ENVVISUSERNAME `\n $env:ENVVISPASSWORD `\n $env:ENVVISPROTOCOL\n\n$result = $Failed\n$vmOut = Get-VMHost -Name $hvServer | Get-VM -Name $vmName\nif (-not $vmOut)\n{\n Write-Error -Message \"go_vm_install_by_iso: Unable to create VM object for VM $vmName\" -Category ObjectNotFound -ErrorAction SilentlyContinue\n}\nelse\n{\n \"Info : Find $vmName\"\n $result = $Passed\n}\n\nDisconnectWithVIServer\nreturn $result\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add temp script to create commonly used boxes\n"
},
{
"from": "gpt",
"value": "Measure-Command { \n\tMeasure-Command { make virtualbox/eval-win10x64-enterprise }\n\tMeasure-Command { make virtualbox/eval-win10x86-enterprise }\n\tMeasure-Command { make virtualbox/eval-win2008r2-datacenter }\n\tMeasure-Command { make virtualbox/eval-win2008r2-standard }\n\tMeasure-Command { make virtualbox/eval-win2012-standard }\n\tMeasure-Command { make virtualbox/eval-win2012r2-datacenter }\n\tMeasure-Command { make virtualbox/eval-win2012r2-standard }\n\tMeasure-Command { make virtualbox/eval-win7x64-enterprise }\n\tMeasure-Command { make virtualbox/eval-win7x86-enterprise }\n\tMeasure-Command { make virtualbox/eval-win81x64-enterprise }\n\tMeasure-Command { make virtualbox/eval-win81x86-enterprise }\n\tMeasure-Command { make virtualbox/eval-win8x64-enterprise }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Edit from Staxx on my phone via github.com!"
},
{
"from": "human",
"value": "$vsixpublish = Get-ChildItem -File .\\packages -recurse | \n Where-Object { $_.Name -eq \"VsixPublisher.exe\" } | \n Sort-Object -Descending -Property CreationTime | \n Select-Object -First 1 -ExpandProperty FullName\n\n. $vsixpublish login -publisherName alexdresko -personalAccessToken $env:homeseertemplatespublish\n\n$overview = (Get-Item .\\Templates\\HomeSeerTemplates\\overview.md).FullName\n$manifest = (Get-Item .\\Templates\\HomeSeerTemplates\\publish-manifest.json).FullName\n$vsix = (Get-Item .\\Templates\\HomeSeerTemplates\\bin\\Release\\HomeSeerTemplates.vsix).FullName\nWrite-Host \"vsix: $vsix\"\nWrite-Host \"manifest: $manifest\"\nWrite-Host \"overview: $overview\"\n\n# . $vsixpublish deleteExtension -extensionName \"HomeSeerTemplates\" -publisherName \"thealexdresko\"\n\n. $vsixpublish publish -payload \"$vsix\" -publishManifest \"$manifest\"\n"
},
{
"from": "gpt",
"value": "$vsixpublish = Get-ChildItem -File .\\packages -recurse | \n Where-Object { $_.Name -eq \"VsixPublisher.exe\" } | \n Sort-Object -Descending -Property CreationTime | \n Select-Object -First 1 -ExpandProperty FullName\n\n. $vsixpublish login -publisherName thealexdresko -personalAccessToken $env:homeseertemplatespublish\n\n$overview = (Get-Item .\\Templates\\HomeSeerTemplates\\overview.md).FullName\n$manifest = (Get-Item .\\Templates\\HomeSeerTemplates\\publish-manifest.json).FullName\n$vsix = (Get-Item .\\Templates\\HomeSeerTemplates\\bin\\Release\\HomeSeerTemplates.vsix).FullName\nWrite-Host \"vsix: $vsix\"\nWrite-Host \"manifest: $manifest\"\nWrite-Host \"overview: $overview\"\n\n# . $vsixpublish deleteExtension -extensionName \"HomeSeerTemplates\" -publisherName \"thealexdresko\"\n\n. $vsixpublish publish -payload \"$vsix\" -publishManifest \"$manifest\"\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix libs not available when running from outside project root\n"
},
{
"from": "human",
"value": "param($Command, [bool]$OpenInBrowser = $false)\n\n. \"./Sabnzbd-Lib.ps1\"\n\nswitch($Command) {\n\n \"\" {\n start_sabnzbd $OpenInBrowser\n }\n\n \"start\" {\n start_sabnzbd $OpenInBrowser\n }\n\n \"build\" {\n docker_build\n }\n\n \"stop\" {\n docker_stop\n }\n\n default {\n \"command $command not supported\"\n exit 1\n }\n\n}\n"
},
{
"from": "gpt",
"value": "param($Command, [bool]$OpenInBrowser = $false)\n\n. \"$psscriptroot/Sabnzbd-Lib.ps1\"\n\nswitch($Command) {\n\n \"\" {\n start_sabnzbd $OpenInBrowser\n }\n\n \"start\" {\n start_sabnzbd $OpenInBrowser\n }\n\n \"build\" {\n docker_build\n }\n\n \"stop\" {\n docker_stop\n }\n\n default {\n \"command $command not supported\"\n exit 1\n }\n\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix typo in setting managed flag\n"
},
{
"from": "human",
"value": "[CmdletBinding(DefaultParameterSetName = 'None')]\nparam\n(\n [String] [Parameter(Mandatory = $true)]\n $folder,\n\n [String] [Parameter(Mandatory = $true)]\n $zipFile\n)\n\n$ErrorActionPreference = \"Stop\"\n\n$taskMetadata = ConvertFrom-Json -InputObject $(Get-Content $PSScriptRoot\\task.json -raw)\nWrite-Host \"Task version is: $($taskMetadata.version)\"\n\nWrite-Host \"folder is: $folder\"\nWrite-Host \"zipFile is: $zipFile\"\n\n.\\tools\\SolutionPackager.exe /action:Extract /zipfile:\"$zipFile\" /folder:\"$folder\"\n\n$solutionXmlPath = \"$folder\\Other\\Solution.xml\"\n[xml] $solutionXml = Get-Content $solutionXmlPath\n$node = $solutionXml.SelectSingleNode(\"ImportExportXml/SolutionManifest/Version\")\n$node.'#text' = \"2\"\n$solutionXml.Save($solutionXmlPath)"
},
{
"from": "gpt",
"value": "[CmdletBinding(DefaultParameterSetName = 'None')]\nparam\n(\n [String] [Parameter(Mandatory = $true)]\n $folder,\n\n [String] [Parameter(Mandatory = $true)]\n $zipFile\n)\n\n$ErrorActionPreference = \"Stop\"\n\n$taskMetadata = ConvertFrom-Json -InputObject $(Get-Content $PSScriptRoot\\task.json -raw)\nWrite-Host \"Task version is: $($taskMetadata.version)\"\n\nWrite-Host \"folder is: $folder\"\nWrite-Host \"zipFile is: $zipFile\"\n\n.\\tools\\SolutionPackager.exe /action:Extract /zipfile:\"$zipFile\" /folder:\"$folder\"\n\n$solutionXmlPath = \"$PSScriptRoot\\$folder\\Other\\Solution.xml\"\n[xml] $solutionXml = Get-Content $solutionXmlPath\n$node = $solutionXml.SelectSingleNode(\"ImportExportXml/SolutionManifest/Managed\")\n$node.'#text' = \"2\"\n$solutionXml.Save($solutionXmlPath)"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix manifest encoding to UTF8\n"
},
{
"from": "human",
"value": "#requires -v 3\n\n$masterUrl=\"https://raw.githubusercontent.com/reyerstudio/devstrap/master\"\n$archiveUrl=\"https://github.com/reyerstudio/devstrap/archive\"\n\nfunction update_manifest($name) {\n $json = (new-object net.webclient).DownloadString(\"$masterUrl/$name.json\") | ConvertFrom-JSON\n $lastVersion=$json.version\n $a = @($lastVersion -Split '\\.')\n $a[2] = ([int]$a[2])+1\n $version=\"$($a[0]).$($a[1]).$($a[2])\"\n $manifest=\"$PSScriptRoot\\..\\$name.json\"\n\n $lastSHA=$(git rev-parse origin/master)\n (new-object net.webclient).DownloadFile(\"$archiveUrl/$lastSHA.zip\", \"$env:Temp\\$lastSHA.zip\")\n $shasum = @($(shasum -a 256 \"$env:Temp\\$lastSHA.zip\") -Split \" \")[0]\n $json.version = $version\n $json.url = \"$archiveUrl/$lastSHA.zip\"\n $json.extract_dir = \"devstrap-$lastSHA\\ra\\windows\"\n $json.hash = $shasum\n $json | ConvertTo-Json | Out-File $manifest\n git add $manifest\n git commit -m \"$name $version\"\n git push origin master\n}\n\nupdate_manifest ra"
},
{
"from": "gpt",
"value": "#requires -v 3\n\n$masterUrl=\"https://raw.githubusercontent.com/reyerstudio/devstrap/master\"\n$archiveUrl=\"https://github.com/reyerstudio/devstrap/archive\"\n\nfunction update_manifest($name) {\n $json = (new-object net.webclient).DownloadString(\"$masterUrl/$name.json\") | ConvertFrom-JSON\n $lastVersion=$json.version\n $a = @($lastVersion -Split '\\.')\n $a[2] = ([int]$a[2])+1\n $version=\"$($a[0]).$($a[1]).$($a[2])\"\n $manifest=\"$PSScriptRoot\\..\\$name.json\"\n\n $lastSHA=$(git rev-parse origin/master)\n (new-object net.webclient).DownloadFile(\"$archiveUrl/$lastSHA.zip\", \"$env:Temp\\$lastSHA.zip\")\n $shasum = @($(shasum -a 256 \"$env:Temp\\$lastSHA.zip\") -Split \" \")[0]\n $json.version = $version\n $json.url = \"$archiveUrl/$lastSHA.zip\"\n $json.extract_dir = \"devstrap-$lastSHA\\ra\\windows\"\n $json.hash = $shasum\n $json | ConvertTo-Json | Out-File $manifest -Encoding UTF8\n git add $manifest\n git commit -m \"$name $version\"\n git push origin master\n}\n\nupdate_manifest ra"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add Comment based help link\n"
},
{
"from": "human",
"value": "function ConvertFrom-Base64 {\n <#\n .SYNOPSIS\n Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.\n\n .DESCRIPTION\n Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.\n\n .PARAMETER String\n Specifies the String to Convert\n\n .EXAMPLE\n ConvertFrom-Base64 -String $ImageBase64 |Out-File ImageTest.png\n\n .NOTES\n Francois-Xavier Cat\n @lazywinadmin\n lazywinadmin.com\n github.com/lazywinadmin\n#>\n [CmdletBinding()]\n PARAM (\n [parameter(Mandatory = $true, ValueFromPipeline)]\n [String]$String\n )\n TRY {\n Write-Verbose -Message \"[ConvertFrom-Base64] Converting String\"\n [System.Text.Encoding]::Default.GetString(\n [System.Convert]::FromBase64String($String)\n )\n }\n CATCH {\n Write-Error -Message \"[ConvertFrom-Base64] Something wrong happened\"\n $Error[0].Exception.Message\n }\n}\n"
},
{
"from": "gpt",
"value": "function ConvertFrom-Base64 {\n <#\n .SYNOPSIS\n Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.\n\n .DESCRIPTION\n Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.\n\n .PARAMETER String\n Specifies the String to Convert\n\n .EXAMPLE\n ConvertFrom-Base64 -String $ImageBase64 |Out-File ImageTest.png\n\n .NOTES\n Francois-Xavier Cat\n @lazywinadmin\n lazywinadmin.com\n github.com/lazywinadmin\n .Link\n https://github.com/lazywinadmin/PowerShell\n#>\n [CmdletBinding()]\n PARAM (\n [parameter(Mandatory = $true, ValueFromPipeline)]\n [String]$String\n )\n TRY {\n Write-Verbose -Message \"[ConvertFrom-Base64] Converting String\"\n [System.Text.Encoding]::Default.GetString(\n [System.Convert]::FromBase64String($String)\n )\n }\n CATCH {\n Write-Error -Message \"[ConvertFrom-Base64] Something wrong happened\"\n $Error[0].Exception.Message\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix extension of release files.\n"
},
{
"from": "human",
"value": "$ffmpeg = \"ffmpeg-20191118.0.0-d831edc\"\n$version = ($ffmpeg -split '-')[1]\n$rel32 = \"$ffmpeg-lgpl21-v142-static-md-x86\"\n$rel64 = \"$ffmpeg-lgpl21-v142-static-md-x64\"\n$wc = New-Object System.Net.WebClient\n\nif (!(Test-Path \"$rel32.zip\")) { $wc.DownloadFile(\"https://github.com/mcmtroffaes/ffmpeg-msvc-build/releases/download/$version/$rel32.zip\", \"$env:temp/$rel32.zip\") }\nif (!(Test-Path \"$rel64.zip\")) { $wc.DownloadFile(\"https://github.com/mcmtroffaes/ffmpeg-msvc-build/releases/download/$version/$rel64.zip\", \"$env:temp/$rel64.zip\") }\n\nif (!(Test-Path $rel32)) { 7z x \"$env:temp/$rel32.7z\" }\nif (!(Test-Path $rel64)) { 7z x \"$env:temp/$rel64.7z\" }\n"
},
{
"from": "gpt",
"value": "$ffmpeg = \"ffmpeg-20191118.0.0-d831edc\"\n$version = ($ffmpeg -split '-')[1]\n$rel32 = \"$ffmpeg-lgpl21-v142-static-md-x86\"\n$rel64 = \"$ffmpeg-lgpl21-v142-static-md-x64\"\n$wc = New-Object System.Net.WebClient\n\nif (!(Test-Path \"$rel32.7z\")) { $wc.DownloadFile(\"https://github.com/mcmtroffaes/ffmpeg-msvc-build/releases/download/$version/$rel32.zip\", \"$env:temp/$rel32.7z\") }\nif (!(Test-Path \"$rel64.7z\")) { $wc.DownloadFile(\"https://github.com/mcmtroffaes/ffmpeg-msvc-build/releases/download/$version/$rel64.zip\", \"$env:temp/$rel64.7z\") }\n\nif (!(Test-Path $rel32)) { 7z x \"$env:temp/$rel32.7z\" }\nif (!(Test-Path $rel64)) { 7z x \"$env:temp/$rel64.7z\" }\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Upgrade to VM v7.0.46 (has 64-bit stdio function exports)\n"
},
{
"from": "human",
"value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"v7.0.45\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion"
},
{
"from": "gpt",
"value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"v7.0.46\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script to download ap service certificate from azure\n"
},
{
"from": "gpt",
"value": "$appServiceCertificateName = \"res-cloud\"\n$resourceGroupName = \"res-cloud\"\n$azureLoginEmailId = \"cedd.burge@res-group.com\"\n$subscriptionId = \"cce8e938-137d-4f17-98c4-6e92b8f683e0\"\n\nLogin-AzureRmAccount\nSet-AzureRmContext -SubscriptionId $subscriptionId\n\n$ascResource = Get-AzureRmResource -ResourceName $appServiceCertificateName -ResourceGroupName $resourceGroupName -ResourceType \"Microsoft.CertificateRegistration/certificateOrders\" -ApiVersion \"2015-08-01\"\n$keyVaultId = \"\"\n$keyVaultSecretName = \"\"\n\n$certificateProperties=Get-Member -InputObject $ascResource.Properties.certificates[0] -MemberType NoteProperty\n$certificateName = $certificateProperties[0].Name\n$keyVaultId = $ascResource.Properties.certificates[0].$certificateName.KeyVaultId\n$keyVaultSecretName = $ascResource.Properties.certificates[0].$certificateName.KeyVaultSecretName\n\n$keyVaultIdParts = $keyVaultId.Split(\"/\")\n$keyVaultName = $keyVaultIdParts[$keyVaultIdParts.Length - 1]\n$keyVaultResourceGroupName = $keyVaultIdParts[$keyVaultIdParts.Length - 5]\nSet-AzureRmKeyVaultAccessPolicy -ResourceGroupName $keyVaultResourceGroupName -VaultName $keyVaultName -UserPrincipalName $azureLoginEmailId -PermissionsToSecrets get\n$secret = Get-AzureKeyVaultSecret -VaultName $keyVaultName -Name $keyVaultSecretName\n$pfxCertObject=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @([Convert]::FromBase64String($secret.SecretValueText),\"\", [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)\n$pfxPassword = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 50 | % {[char]$_})\n$currentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath\n[Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath\n[io.file]::WriteAllBytes(\".\\appservicecertificate.pfx\", $pfxCertObject.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $pfxPassword))\nWrite-Host \"Created an App Service Certificate copy at: $currentDirectory\\appservicecertificate.pfx\"\nWrite-Warning \"For security reasons, do not store the PFX password. Use it directly from the console as required.\"\nWrite-Host \"PFX password: $pfxPassword\""
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update deployment script to link the Modix container with the CSDiscord container so they can communicate.\n"
},
{
"from": "human",
"value": "$ErrorActionPreference = 'Stop';\n\n$tag = $env:APPVEYOR_REPO_BRANCH\nif(-not [System.String]::IsNullOrWhitespace($env:APPVEYOR_PULL_REQUEST_NUMBER)) {\n\t$tag = \"$tag-pr-${$env:APPVEYOR_PULL_REQUEST_NUMBER}\"\n}\n\nif([System.String]::IsNullOrWhitespace($tag)) {\n $tag = \"untagged\"\n}\nif (Enter-OncePerDeployment \"install_docker_image\")\n{\n\tdocker stop Modix\n\tdocker rm Modix\n\tdocker pull \"cisien/modix:$tag\"\n\tdocker run -d -e \"Token=$env:ModixToken\" -e \"ReplToken=$env:ReplServiceToken\" -e \"StackoverflowToken=$env:SOToken\" -e \"PostgreConnectionString=$env:ConnectionString\" --name Modix -v modix:c:\\app\\config \"cisien/modix:$tag\"\n}"
},
{
"from": "gpt",
"value": "$ErrorActionPreference = 'Stop';\n\n$tag = $env:APPVEYOR_REPO_BRANCH\nif(-not [System.String]::IsNullOrWhitespace($env:APPVEYOR_PULL_REQUEST_NUMBER)) {\n\t$tag = \"$tag-pr-${$env:APPVEYOR_PULL_REQUEST_NUMBER}\"\n}\n\nif([System.String]::IsNullOrWhitespace($tag)) {\n $tag = \"untagged\"\n}\nif (Enter-OncePerDeployment \"install_docker_image\")\n{\n\tdocker stop Modix\n\tdocker rm Modix\n\tdocker pull \"cisien/modix:$tag\"\n\tdocker run -d -e \"Token=$env:ModixToken\" -e \"ReplToken=$env:ReplServiceToken\" -e \"StackoverflowToken=$env:SOToken\" -e \"PostgreConnectionString=$env:ConnectionString\" --name Modix -v modix:c:\\app\\config --link=CSDiscord \"cisien/modix:$tag\"\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add default configuration for powershell\n"
},
{
"from": "human",
"value": "Set-Alias ll Get-ChildItem\n"
},
{
"from": "gpt",
"value": "chcp 65001 | out-null\n\nfunction prompt {\n '[' + $env:username + '@' + $env:computername + ' ' + $pwd + \"]`r`n$ \"\n}\n\nfunction .. {\n Set-Location ..\n}\nfunction ... {\n Set-Location ..\\..\n}\nfunction .... {\n Set-Location ..\\..\\..\n}\n\nSet-Alias l Get-ChildItem\nSet-Alias ll Get-ChildItem\nSet-Alias open Invoke-Item\n\nif (Test-Path \"C:\\Program Files\\Sublime Text 3\") {\n Set-Alias edit \"C:\\Program Files\\Sublime Text 3\\sublime_text\"\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "tests(Compute): Load tools from the correct path.\nThis is why timeout was not having any effect.\n"
},
{
"from": "human",
"value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport-module -DisableNameChecking ..\\..\\..\\BuildTools.psm1\n\nSet-TestTimeout 1200\n\ndotnet restore --force\ndotnet test --no-restore --test-adapter-path:. --logger:junit 2>&1 | %{ \"$_\" }"
},
{
"from": "gpt",
"value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport-module -DisableNameChecking ..\\..\\BuildTools.psm1\n\nSet-TestTimeout 1200\n\ndotnet restore --force\ndotnet test --no-restore --test-adapter-path:. --logger:junit 2>&1 | %{ \"$_\" }"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add untested script to run WACK\n\nWe were not able to run WACK in the build server, but we are transfering\nthe current script to this file anyway, so the server is free of source code.\n"
},
{
"from": "gpt",
"value": "$appxs = Get-ChildItem -Recurse -Filter \"**_x86_Master.appx\"\n$appx = $appxs[0]\n$report = [System.IO.Path]::Combine($PWD, \"Report.xml\")\nif(Test-Path $report)\n{\n Remove-Item $report\n}\n& 'C:\\Program Files (x86)\\Windows Kits\\8.1\\App Certification Kit\\appcert.exe' reset | Out-Null\n'Running: appcert.exe test -apptype windowsstoreapp -appxpackagepath ' + $appx.FullName + ' -reportoutputpath ' + $report + ' -testid [21,31,38,45,46,53,54,55,56,57,58] | Out-Null'\n& 'C:\\Program Files (x86)\\Windows Kits\\8.1\\App Certification Kit\\appcert.exe' test -apptype windowsstoreapp -appxpackagepath $appx.FullName -reportoutputpath $report -testid '[21,31,38,45,46,53,54,55,56,57,58]' | Out-Null\nif($LASTEXITCODE -eq 0)\n{\n $fails = Select-Xml -XPath \"//TEST[RESULT='FAIL']\" -Path $report\n if($fails)\n {\n if($fails.Count -gt 0)\n {\n foreach($fail in $fails)\n {\n 'WACK test failed: ' + $fail.Node.Description\n }\n throw ' ' + $fails.Count + ' WACK tests failed.'\n }\n }\n}\nelse\n{\n throw \"Failed to WACK test appx with exit code: \" + $LASTEXITCODE\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Remove function prototypes from psm1"
},
{
"from": "human",
"value": "\n\n\n<#\n .Synopsis\n DEPRECATED - Installing the AzureRM module installs all AzureRM cmdlets.\n\n .Description\n DEPRECATED - Installing the AzureRM module installs all AzureRM cmdlets.\n\n .Parameter MajorVersion\n DEPRECATED -Specifies the major version.\n\n .Parameter Repository\n DEPRECATED - Limit the search for \"AzureRM\" cmdlets in a specific repository.\n \n .Parameter Scope\n DEPRECATED - Specifies the parameter scope.\n\n .Parameter Force\n DEPRECATED - Force download and installation of modules already installed.\n#>\nfunction Update-AzureRM\n{\n \n param(\n [Parameter(Position=0, Mandatory = $false)]\n [string]\n $MajorVersion,\n [Parameter(Position=1, Mandatory = $false)]\n [string]\n $Repository = \"PSGallery\",\n [Parameter(Position=2, Mandatory = $false)]\n [ValidateSet(\"CurrentUser\",\"AllUsers\")]\n [string]\n $Scope = \"AllUsers\",\n [switch]\n $Force = $false)\n\n \n Write-Output \"DEPRECATED - This cmdlet is no longer necessary - installing the AzureRM module installs all AzureRM cmdlets.\"\n\n \n}\n\n<#\n .Synopsis\n DEPRECATED - If using WMF5, you can run Import-Module AzureRM to load all AzureRM modules.\n\n .Description\n DEPRECATED - If using WMF5, you can run Import-Module AzureRM to load all AzureRM modules.\n\n .Parameter MajorVersion\n DEPRECATED - Specifies the major version.\n#>\nfunction Import-AzureRM\n{\n param(\n [Parameter(Position=0, Mandatory = $false)]\n [string]\n $MajorVersion )\n Write-Output \"DEPRECATED - If using Windows Management Framework 5, you can load all modules using 'Import-Module AzureRM'.\"\n\n \n}\n\n\n\n<#\n .Synopsis\n DEPRECATED - please uninstall each module using 'Uninstall-Module Azure* -Force'\n\n .Description\n DEPRECATED - this cmdlet has no effect on installed modules\n\n .Parameter MajorVersion\n DEPRECATED - Specifies the major version.\n#>\nfunction Uninstall-AzureRM\n{\n param(\n [Parameter(Position=0, Mandatory = $false)]\n [string]\n $MinVersion)\n\n \n\n Write-Output \"DEPRECATED - to uninstall azure modules, remove or uninstall each module using 'Uninstall-Module'.\"\n\n \n}\n\nNew-Alias -Name Install-AzureRM -Value Update-AzureRM\nExport-ModuleMember -function Uninstall-AzureRM, Update-AzureRM, Import-AzureRM -Alias Install-AzureRM\n"
},
{
"from": "gpt",
"value": "# Placeholder for script template\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update packer for nested virtualization\n"
},
{
"from": "human",
"value": "cd $env:TEMP\nwget -outfile Packer.zip -uri https://dl.bintray.com/taliesins/Packer/:Packer.1.0.0.118-HyperV.nupkg -UseBasicParsing\nExpand-Archive packer.zip\ncopy packer\\packer.exe $env:ChocolateyInstall\\bin\\packer.exe\n"
},
{
"from": "gpt",
"value": "cd $env:TEMP\nwget -outfile Packer.zip -uri https://dl.bintray.com/taliesins/Packer/Packer.1.0.0.127-Develop.nupkg -UseBasicParsing\nExpand-Archive packer.zip\ncopy packer\\packer.exe $env:ChocolateyInstall\\bin\\packer.exe\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Simplify syntax for disable .NET Core telemetry\n"
},
{
"from": "human",
"value": "if (!(Get-Command -Name dotnet -ErrorAction Ignore)) {\n Write-Verbose -Message (Get-DotFilesMessage -Message 'Skipping .NET Core settings as unable to locate dotnet.')\n return\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Loading .NET Core settings ...')\n\n# Opt-out of telemetry\nSet-Item -Path Env:\\DOTNET_CLI_TELEMETRY_OPTOUT -Value 'true'\n\n# How to enable TAB completion for the .NET Core CLI\n# https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete\nRegister-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {\n Param($wordToComplete, $commandAst, $cursorPosition)\n dotnet complete --position $cursorPosition \"$commandAst\" | ForEach-Object {\n [Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)\n }\n}\n"
},
{
"from": "gpt",
"value": "if (!(Get-Command -Name dotnet -ErrorAction Ignore)) {\n Write-Verbose -Message (Get-DotFilesMessage -Message 'Skipping .NET Core settings as unable to locate dotnet.')\n return\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Loading .NET Core settings ...')\n\n# Opt-out of telemetry\n$env:DOTNET_CLI_TELEMETRY_OPTOUT = 'true'\n\n# How to enable TAB completion for the .NET Core CLI\n# https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete\nRegister-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {\n Param($wordToComplete, $commandAst, $cursorPosition)\n dotnet complete --position $cursorPosition \"$commandAst\" | ForEach-Object {\n [Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script for verifying that all repos have the same version\n"
},
{
"from": "gpt",
"value": "# Get the current version of RapidCore\n# Check that all other libraries have this version too..\n\nfunction Get-Version {\n # $path: the path to navigate to, where we should update versions and all that\n # $goTo: where to navigate after we are done\n Param ([string]$path, [string]$goTo)\n\n Set-Location $path\n \n $currentVersion = & dotnet version --output-format=json | ConvertFrom-Json | Select-Object -ExpandProperty currentVersion\n\n Set-Location $goTo\n return $currentVersion\n}\n\nfunction Validate-Version {\n # $path: the path to navigate to, where we should update versions and all that\n # $goTo: where to navigate after we are done\n Param ([string]$path, [string]$goTo, [string]$version)\n\n Set-Location $path\n Write-Host \"Validating\" $path -ForegroundColor Blue\n $currentVersion = & dotnet version --output-format=json | ConvertFrom-Json | Select-Object -ExpandProperty currentVersion\n\n if($version -ne $currentVersion) {\n Set-Location $goTo\n Throw -join(\"Version mismatch, \",$path,\" has version \",$currentVersion,\" but \",$version,\" is required\")\n }\n Set-Location $goTo\n}\n\n\n$currentVersion = Get-Version -path .\\rapidcore\\src -goTo ..\\..\\\nWrite-Host \"Current rapidcore version is \" $currentVersion -ForegroundColor Green\n\nValidate-Version -path .\\rapidcore.mongo\\src -goTo ..\\..\\ -version $currentVersion \nValidate-Version -path .\\rapidcore.redis\\src -goTo ..\\..\\ -version $currentVersion\nValidate-Version -path .\\rapidcore.xunit\\src -goTo ..\\..\\ -version $currentVersion\n\nWrite-Host \"All ok\" -ForegroundColor Green\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Remove version extraction for SSMS\n"
},
{
"from": "human",
"value": "#\n# SQL Server Management Studio 2016 snapshot script\n# https://github.com/turboapps/turbome/tree/master/sqlserver/ssms2016\n#\n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\n$page = Invoke-WebRequest -Uri \"https://msdn.microsoft.com/en-us/library/mt238290.aspx\"\n$body = $page.ParsedHtml.getElementById(\"mainBody\")\n$hyperlinks = $body.getElementsByTagName(\"a\")\n$downloadLink = $hyperlinks | Select-Object -First 1\n\nif(-not ($downloadLink.outerText -match \"\\d+(\\.\\d+)*\"))\n{\n throw \"Failed to extract version number\"\n}\n$tag = $Matches[0]\n\nWrite-Host \"SQL Server Management Studio version $tag\"\n\"sqlserver/ssms2016:$tag\" | Set-Content \"image.txt\"\n\n(New-Object System.Net.WebClient).DownloadFile($downloadLink.href,\"install.exe\")"
},
{
"from": "gpt",
"value": "#\n# SQL Server Management Studio 2016 snapshot script\n# https://github.com/turboapps/turbome/tree/master/sqlserver/ssms2016\n#\n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\n$page = Invoke-WebRequest -Uri \"https://msdn.microsoft.com/en-us/library/mt238290.aspx\"\n$body = $page.ParsedHtml.getElementById(\"mainBody\")\n$hyperlinks = $body.getElementsByTagName(\"a\")\n$downloadLink = $hyperlinks | Select-Object -First 1\n\nWrite-Host \"SQL Server Management Studio\"\n\"sqlserver/ssms2016\" | Set-Content \"image.txt\"\n\n(New-Object System.Net.WebClient).DownloadFile($downloadLink.href,\"install.exe\")"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add PS script to run Wyam\n"
},
{
"from": "gpt",
"value": "$wyam = 'Wyam.exe'\n\n$config = Join-Path $PSScriptRoot 'Wyam/config.wyam'\n$input = Join-Path $PSScriptRoot 'Wyam/Input'\n$output = Join-Path $PSScriptRoot 'Wyam/Output'\n\n. $wyam --config $config --input $input --output $output"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update vscode extension installation script\n"
},
{
"from": "human",
"value": "# Script to install extensions for Visual Studio Code\n\n\n# Install Language Extensions\n## golang\ncode --install-extension ms-vscode.go\n\n## Python\ncode --install-extension ms-python.python\ncode --install-extension njpwerner.autodocstring\n\n## C++\ncode --install-extension ms-vscode.cpptools\ncode --install-extension mine.cpplint\n\n## Shell Script\ncode --install-extension timonwong.shellcheck\n\n## TypeScript\ncode --install-extension ms-vscode.vscode-typescript-tslint-plugin\n\n## etc\ncode --install-extension yzhang.markdown-all-in-one\ncode --install-extension jebbs.plantuml\ncode --install-extension lextudio.restructuredtext\n\n\n# Install Application Extensions\n## docker\ncode --install-extension PeterJausovec.vscode-docker\n\n## Git\ncode --install-extension eamodio.gitlens\n\n## Jupyter Notebook\ncode --install-extension jithurjacob.nbpreviewer\n"
},
{
"from": "gpt",
"value": "# Script to install extensions for Visual Studio Code\n\n\n# Install Language Extensions\n## golang\ncode --force --install-extension ms-vscode.go\n\n## Python\ncode --force --install-extension ms-python.python\ncode --force --install-extension njpwerner.autodocstring\n\n## C++\ncode --force --install-extension ms-vscode.cpptools\ncode --force --install-extension mine.cpplint\n\n## Shell Script\ncode --force --install-extension timonwong.shellcheck\n\n## TypeScript\ncode --force --install-extension ms-vscode.vscode-typescript-tslint-plugin\n\n## etc\ncode --force --install-extension bungcip.better-toml\ncode --force --install-extension yzhang.markdown-all-in-one\ncode --force --install-extension jebbs.plantuml\ncode --force --install-extension lextudio.restructuredtext\n\n\n# Install Application Extensions\n## docker\ncode --force --install-extension PeterJausovec.vscode-docker\n\n## Git\ncode --force --install-extension eamodio.gitlens\n\n## Jupyter Notebook\ncode --force --install-extension jithurjacob.nbpreviewer\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script for downloading latest Adobe Reader version.\n"
},
{
"from": "gpt",
"value": "# Remove progress bars for Invoke-Request to significantly improve performance\n$ProgressPreference = 'SilentlyContinue'\n\n# Get latest version for Acrobat Reader from their SCUP page.\n## Download SCUP cab.\nWget https://armmf.adobe.com/arm-manifests/win/SCUP/ReaderCatalog-DC.cab -OutFile ReaderCatalog.cab\n## Expand cab to XML.\nExpand ReaderCatalog.cab -F:* ReaderCatalog.xml\n## Parse XML for latest version\n[XML]$ReaderCatalog = Get-Content(\"ReaderCatalog.xml\")\n$Versions = $ReaderCatalog.SystemsManagementCatalog.SoftwareDistributionPackage.InstallableItem.ApplicabilityRules.MetaData.MsiPatchMetaData.MsiPatch.TargetProduct.UpdatedVersion | Sort-Object -Descending\n$LatestVersion = $Versions[0] -Replace ('\\.','')\n\n## Create download link for Reader\n$DownloadLink = \"https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/\" + $LatestVersion + \"/AcroRdrDC\" + $LatestVersion + \"_en_US.exe\"\n\n\n# Download RStudio installer.\n$InstallerName = [System.IO.Path]::GetFileName($DownloadLink)\nWget $DownloadLink -O $InstallerName\n\n# Print the installer filename.\n$InstallerName"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update upload script for appveyor to use new deployment url"
},
{
"from": "human",
"value": "function uploadRsqueak {\n [CmdletBinding()]\n param([string] $pattern)\n $loc = Get-Location\n $provider = $loc.Provider\n $files = @()\n $longfiles = $pscmdlet.GetResolvedProviderPathFromPSPath($pattern, [ref] $provider)\n $longfiles | % { $file = gci $_ ; $files += $file.Name }\n foreach($item in $files) {\n $url = \"http://www.lively-kernel.org/babelsberg/RSqueak/$item\"\n $fullpath = Join-Path $pwd $item\n break\n }\n Write-Host \"Uploading $fullpath to $url\"\n Invoke-WebRequest -Method PUT -Uri $url -InFile $fullpath\n}\n\nuploadRsqueak \"rsqueak-win32-*.exe\"\ncp rsqueak.exe rsqueak-win32-latest.exe\nuploadRsqueak rsqueak-win32-latest.exe\n"
},
{
"from": "gpt",
"value": "function uploadRsqueak {\n [CmdletBinding()]\n param([string] $pattern)\n $loc = Get-Location\n $provider = $loc.Provider\n $files = @()\n $longfiles = $pscmdlet.GetResolvedProviderPathFromPSPath($pattern, [ref] $provider)\n $longfiles | % { $file = gci $_ ; $files += $file.Name }\n foreach($item in $files) {\n $url = \"https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/$item\"\n $fullpath = Join-Path $pwd $item\n break\n }\n Write-Host \"Uploading $fullpath to $url\"\n $bytes = [System.Text.Encoding]::ASCII.GetBytes($env:DeployCredentials)\n $base64 = [System.Convert]::ToBase64String($bytes)\n $basicAuthValue = \"Basic $base64\n $headers = @{ Authorization = $basicAuthValue }\n Invoke-WebRequest -Method PUT -Uri $url -InFile $fullpath -Headers $headers\n}\n\nuploadRsqueak \"rsqueak-win32-*.exe\"\ncp rsqueak.exe rsqueak-win32-latest.exe\nuploadRsqueak rsqueak-win32-latest.exe\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add ExchangeOnline settings with ignored user properties\n"
},
{
"from": "gpt",
"value": "if ($DotFilesShowScriptEntry) {\n Write-Verbose -Message (Get-DotFilesMessage -Message $PSCommandPath)\n}\n\nif (!(Test-IsWindows)) {\n return\n}\n\ntry {\n if (!$DotFilesFastLoad) {\n Test-ModuleAvailable -Name ExchangeOnlineManagement\n }\n} catch {\n Write-Verbose -Message (Get-DotFilesMessage -Message 'Skipping ExchangeOnline settings as module not found.')\n return\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Loading ExchangeOnline settings ...')\n\n# Mailbox properties we usually don't care about\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignment', '')]\n$ExoMailboxIgnoredProperties = @(\n # User identity\n 'MicrosoftOnlineServicesID',\n 'WindowsEmailAddress',\n 'WindowsLiveID',\n\n # Mailbox identity\n #'Alias',\n 'DistinguishedName',\n #'Id',\n 'Identity',\n 'LegacyExchangeDN',\n 'Name',\n 'NetID',\n 'SamAccountName',\n #'UserPrincipalName',\n\n # Mailbox internal\n 'MailboxLocations',\n 'MailboxRelease',\n\n # Server internal\n 'Database',\n 'ServerLegacyDN',\n 'ServerName',\n\n # GUIDs\n 'DatabaseGuid',\n 'ExchangeGuid',\n 'ExchangeObjectId',\n 'ExternalDirectoryObjectId',\n 'Guid',\n\n # Timestamps\n 'EnforcedTimestamps',\n 'StsRefreshTokensValidFrom',\n 'WhenChanged',\n 'WhenChangedUTC',\n 'WhenCreated',\n 'WhenCreatedUTC',\n 'WhenMailboxCreated'\n)\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use proper build directory (has configuration)\n"
},
{
"from": "human",
"value": "# Create the PerfTests directory under Binaries\\$(Configuration). There are still a number\n# of tools (in roslyn and roslyn-internal) that depend on this combined directory.\n[CmdletBinding(PositionalBinding=$false)]\nparam ([string]$buildDir)\n\nSet-StrictMode -version 2.0\n$ErrorActionPreference=\"Stop\"\n\ntry {\n . (Join-Path $PSScriptRoot \"build-utils.ps1\")\n [string]$target = Join-Path $buildDir \"PerfTests\"\n Write-Host \"PerfTests: $target\"\n if (-not (test-path $target)) {\n Create-Directory $target\n }\n\n Push-Location $binariesDir\n foreach ($subDir in @(\"Dlls\", \"UnitTests\")) {\n Push-Location $subDir\n foreach ($path in Get-ChildItem -re -in \"PerfTests\") {\n Write-Host \"`tcopying $path\"\n Copy-Item -force -recurse \"$path\\*\" $target\n }\n Pop-Location\n }\n Pop-Location\n exit 0\n}\ncatch {\n Write-Host \"Error: $($_.Exception.Message)\"\n exit 1\n}\n\n"
},
{
"from": "gpt",
"value": "# Create the PerfTests directory under Binaries\\$(Configuration). There are still a number\n# of tools (in roslyn and roslyn-internal) that depend on this combined directory.\n[CmdletBinding(PositionalBinding=$false)]\nparam ([string]$buildDir)\n\nSet-StrictMode -version 2.0\n$ErrorActionPreference=\"Stop\"\n\ntry {\n . (Join-Path $PSScriptRoot \"build-utils.ps1\")\n [string]$target = Join-Path $buildDir \"PerfTests\"\n Write-Host \"PerfTests: $target\"\n if (-not (test-path $target)) {\n Create-Directory $target\n }\n\n Push-Location $buildDir\n foreach ($subDir in @(\"Dlls\", \"UnitTests\")) {\n Push-Location $subDir\n foreach ($path in Get-ChildItem -re -in \"PerfTests\") {\n Write-Host \"`tcopying $path\"\n Copy-Item -force -recurse \"$path\\*\" $target\n }\n Pop-Location\n }\n Pop-Location\n exit 0\n}\ncatch {\n Write-Host \"Error: $($_.Exception.Message)\"\n exit 1\n}\n\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use Get-ToolsLocation instead of ChocolateyToolsLocation.\n\n#20.\n"
},
{
"from": "human",
"value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\nif ($Env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {\r\n\tthrow \"This package requires a 64-bit Windows.\"\r\n}\r\n\r\nNew-ItemProperty -Force -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel' -Name 'obcaseinsensitive' -Value 0 -PropertyType Dword\r\necho 'Please restart your system to let registry changes take effect.'\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path $Env:ChocolateyToolsLocation $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n"
},
{
"from": "gpt",
"value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\nif ($Env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {\r\n\tthrow \"This package requires a 64-bit Windows.\"\r\n}\r\n\r\nNew-ItemProperty -Force -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Kernel' -Name 'obcaseinsensitive' -Value 0 -PropertyType Dword\r\necho 'Please restart your system to let registry changes take effect.'\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path (Get-ToolsLocation) $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use correct install path for CodeCoverage.exe\n"
},
{
"from": "human",
"value": "mkdir Temp\ncd Temp\nnuget install Microsoft.CodeCoverage -Version 16.4.0\ncd ..\n\nNew-Item -Type Directory -Force -Path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Team Tools\"\nMove-Item -Path \"Microsoft.CodeCoverage.16.4.0\\build\\netstandard1.0\\CodeCoverage\" -Destination \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Team Tools\\Dynamic Code Coverage Tools\"\nRemove-Item -Recurse -Force Temp\n"
},
{
"from": "gpt",
"value": "mkdir Temp\ncd Temp\nnuget install Microsoft.CodeCoverage -Version 16.4.0\ncd ..\n\nNew-Item -Type Directory -Force -Path \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Team Tools\"\nMove-Item -Path \"Temp\\Microsoft.CodeCoverage.16.4.0\\build\\netstandard1.0\\CodeCoverage\" -Destination \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Team Tools\\Dynamic Code Coverage Tools\"\nRemove-Item -Recurse -Force Temp\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add Unit Test for StartSleepTest.cs\n"
},
{
"from": "human",
"value": "Describe \"Start-Sleep\" {\n\n Context \"Validate Start-Sleep works properly\" {\n\tIt \"Should only sleep for at least 1 second\" {\n\t $result = Measure-Command { Start-Sleep -s 1 }\n\t $result.TotalSeconds | Should BeGreaterThan 0.25\n\t}\n\n\tIt \"Should sleep for at least 1 second using the alias\" {\n\t $result = Measure-Command { sleep -s 1 }\n\t $result.TotalSeconds | Should BeGreaterThan 0.25\n\t}\n }\n}\n"
},
{
"from": "gpt",
"value": "Describe \"Start-Sleep DRT Unit Tests\" -Tags DRT{\n It \"Shoule be works properly when sleeping with Second\" {\n $dtStart = [DateTime]::Now\n Start-Sleep -Seconds 1\n $dtEnd = [DateTime]::Now\n $millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds\n $millseconds | Should BeGreaterThan 1000\n }\n\n It \"Shoule be works properly when sleeping with Second\" {\n $dtStart = [DateTime]::Now\n Start-Sleep -Milliseconds 1000\n $dtEnd = [DateTime]::Now\n $millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds\n $millseconds | Should BeGreaterThan 1000\n }\n\n}\n\nDescribe \"Start-Sleep\" {\n\n Context \"Validate Start-Sleep works properly\" {\n\tIt \"Should only sleep for at least 1 second\" {\n\t $result = Measure-Command { Start-Sleep -s 1 }\n\t $result.TotalSeconds | Should BeGreaterThan 0.25\n\t}\n\n\tIt \"Should sleep for at least 1 second using the alias\" {\n\t $result = Measure-Command { sleep -s 1 }\n\t $result.TotalSeconds | Should BeGreaterThan 0.25\n\t}\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Copy Telegraf extra file into Windows package\n"
},
{
"from": "human",
"value": "$ErrorActionPreference = \"stop\"\r\nNew-Item -ItemType Directory \"$env:PKG_PATH/bin\"\r\nNew-Item -ItemType Directory \"$env:PKG_PATH/conf\"\r\nnew-item -Path \"c:\\gopath\\src\\github.com\\influxdata\" -type directory\r\ncopy-item -recurse -Path C:\\pkg\\src\\telegraf -Destination c:\\gopath\\src\\github.com\\influxdata\\\r\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\r\nInvoke-WebRequest https://github.com/golang/dep/releases/download/v0.5.0/dep-windows-amd64.exe -OutFile C:\\gopath\\src\\github.com\\influxdata\\telegraf\\dep.exe\r\nSet-Location C:\\gopath\\src\\github.com\\influxdata\\telegraf\r\n$Env:DEPCACHEDIR=\"C:\\tmp\"\r\n$Env:TEMP=\"C:\\tmp\"\r\n$Env:TMP=\"C:\\tmp\"\r\n.\\dep.exe ensure -vendor-only -v\r\nSet-Location C:\\gopath\\src\\github.com\\influxdata\\telegraf\\\r\n$env:GOOS=\"windows\"\r\n$env:GOARCH=\"386\"\r\ngo build .\\cmd\\telegraf\\\r\nCopy-Item -Path \"telegraf.exe\" -Destination \"$env:PKG_PATH/bin/\"\r\nCopy-Item \"c:\\pkg\\extra\\telegraf.nssm.j2\" \"$env:PKG_PATH/conf/\"\r\n"
},
{
"from": "gpt",
"value": "$ErrorActionPreference = \"stop\"\r\nNew-Item -ItemType Directory \"$env:PKG_PATH/bin\"\r\nNew-Item -ItemType Directory \"$env:PKG_PATH/conf\"\r\nnew-item -Path \"c:\\gopath\\src\\github.com\\influxdata\" -type directory\r\ncopy-item -recurse -Path C:\\pkg\\src\\telegraf -Destination c:\\gopath\\src\\github.com\\influxdata\\\r\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\r\nInvoke-WebRequest https://github.com/golang/dep/releases/download/v0.5.0/dep-windows-amd64.exe -OutFile C:\\gopath\\src\\github.com\\influxdata\\telegraf\\dep.exe\r\nSet-Location C:\\gopath\\src\\github.com\\influxdata\\telegraf\r\n$Env:DEPCACHEDIR=\"C:\\tmp\"\r\n$Env:TEMP=\"C:\\tmp\"\r\n$Env:TMP=\"C:\\tmp\"\r\n.\\dep.exe ensure -vendor-only -v\r\nSet-Location C:\\gopath\\src\\github.com\\influxdata\\telegraf\\\r\n$env:GOOS=\"windows\"\r\n$env:GOARCH=\"386\"\r\ngo build .\\cmd\\telegraf\\\r\nCopy-Item -Path \"telegraf.exe\" -Destination \"$env:PKG_PATH/bin/\"\r\nCopy-Item \"c:\\pkg\\extra\\telegraf.nssm.j2\" \"$env:PKG_PATH/conf/\"\r\nCopy-Item \"c:\\pkg\\extra\\telegraf.extra.j2\" \"$env:PKG_PATH/conf/\"\r\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Debug the current directory when zipping\n"
},
{
"from": "human",
"value": "function ZipFiles( $zipfilename, $sourcedir )\n{\n Add-Type -Assembly System.IO.Compression.FileSystem\n $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal\n [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir,\n $zipfilename, $compressionLevel, $false)\n}\n\nZipFiles website.zip src/\n"
},
{
"from": "gpt",
"value": "function ZipFiles( $zipfilename, $sourcedir )\n{\n Add-Type -Assembly System.IO.Compression.FileSystem\n $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal\n [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir,\n $zipfilename, $compressionLevel, $false)\n}\n\npwd\n\nZipFiles website.zip src/\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script to run web config transformations\n\n"
},
{
"from": "gpt",
"value": "$environmentName = \"Production\"\n\n# Applying web.config transformations\n$webConfigTransformatorPackages = Join-Path -Path $env:USERPROFILE -ChildPath \"\\.nuget\\packages\\WebConfigTransformRunner\"\n$latestWebConfigTranformator = Join-Path -Path ((Get-ChildItem -Path $webConfigTransformatorPackages | Sort-Object Fullname -Descending)[0].FullName) -ChildPath \"Tools\\WebConfigTransformRunner.exe\"\n$webConfigDirs = Get-ChildItem -Path \"$PSScriptRoot\\publish\" -Recurse -Filter \"web*.config\" | Select -Property Directory -Unique\nForEach ($directory in $webConfigDirs.Directory){\n $transformationSource = (Get-ChildItem -Path $directory -Filter (\"web.\" + $environmentName + \".config\"))\n if ($transformationSource) {\n $guid = [Guid]::NewGuid().ToString()\n $transformArguments = @(\"\"\"\" + (Join-Path -Path $directory -ChildPath \"web.config\") + \"\"\"\",`\n \"\"\"\" + $transformationSource[0].FullName + \"\"\"\",`\n \"\"\"\" + (Join-Path -Path $directory -ChildPath $guid) + \"\"\"\")\n $transformationProcess = Start-Process -FilePath $latestWebConfigTranformator -ArgumentList $transformArguments -Wait -PassThru -NoNewWindow\n # Delete original web.config and rename the created one\n Remove-Item -Path (Join-Path -Path $directory -ChildPath \"web.config\")\n Rename-Item -Path (Join-Path -Path $directory -ChildPath $guid) -NewName (Join-Path -Path $directory -ChildPath \"web.config\") \n }\n # Delete all web.*.config files\n ForEach ($file in (Get-ChildItem -Path $directory -Filter \"web.*.config\")){\n Write-Host \"Removing $file\"\n Remove-Item -Path $file.FullName\n }\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add note about windows update\n"
},
{
"from": "human",
"value": "Import-Module .\\Functions\n\n# Install BoxStarter to handle some system configuration\ncinst BoxStarter\n\n## System Configuration\n\nSet-ExplorerOptions -showHidenFilesFoldersDrives -showFileExtensions\n\nDisable-InternetExplorerESC\n\nEnable-RemoteDesktop\n\nEnable-MicrosoftUpdate\n\nUpdate-ExecutionPolicy\n\nInstall-WindowsUpdate\n\n## cinst freeSSHD"
},
{
"from": "gpt",
"value": "Import-Module .\\Functions\n\n# Install BoxStarter to handle some system configuration\ncinst BoxStarter\n\n## System Configuration\n\nSet-ExplorerOptions -showHidenFilesFoldersDrives -showFileExtensions\n\nDisable-InternetExplorerESC\n\nEnable-RemoteDesktop\n\nEnable-MicrosoftUpdate\n\nUpdate-ExecutionPolicy\n\n## This may not be desired, it'll run all Windows Updates available\nInstall-WindowsUpdate\n\n## cinst freeSSHD"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "[StandardPublishingCMS] Change timer job name for variations schedule for pages\n"
},
{
"from": "human",
"value": "# ------------------------------------------------------------------------------------------------------------\n# Copyright\t\t : GSoft @2015\n# Model \t\t : Cross Site Publishing CMS\n# File : Adjust-VariationsTimerJob.template.ps1\n# Description\t : This script adjusts the Variations Propagate List Items timer job (default to every 5 minutes)\n# ------------------------------------------------------------------------------------------------------------\n\n$webApp = \"[[DSP_PortalWebAppUrl]]\"\n$defaultTimerSchedule = \"[[DSP_DEFAULT_VariationTimerJobFrequence]]\"\n$customTimerSchedule = \"[[DSP_CUSTOM_VariationTimerJobFrequence]]\"\n$timerJob = \"VariationsPropagateListItem\"\n\n$timerSchedule = $defaultTimerSchedule\n\nif(![string]::IsNullOrEmpty($customTimerSchedule))\n{\n\t$timerSchedule = $customTimerSchedule\n}\n\nGet-SPTimerJob -WebApplication $webApp | where Name -eq $timerJob | Set-SPTimerJob -Schedule $timerSchedule"
},
{
"from": "gpt",
"value": "# ------------------------------------------------------------------------------------------------------------\n# Copyright\t\t : GSoft @2015\n# Model \t\t : Cross Site Publishing CMS\n# File : Adjust-VariationsTimerJob.template.ps1\n# Description\t : This script adjusts the Variations Propagate List Items timer job (default to every 5 minutes)\n# ------------------------------------------------------------------------------------------------------------\n\n$webApp = \"[[DSP_PortalWebAppUrl]]\"\n$defaultTimerSchedule = \"[[DSP_DEFAULT_VariationTimerJobFrequence]]\"\n$customTimerSchedule = \"[[DSP_CUSTOM_VariationTimerJobFrequence]]\"\n$timerJob = \"VariationsPropagatePage\"\n\n$timerSchedule = $defaultTimerSchedule\n\nif(![string]::IsNullOrEmpty($customTimerSchedule))\n{\n\t$timerSchedule = $customTimerSchedule\n}\n\nGet-SPTimerJob -WebApplication $webApp | where Name -eq $timerJob | Set-SPTimerJob -Schedule $timerSchedule"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add support for resetting scoop\n"
},
{
"from": "human",
"value": "# Usage: scoop reset <app>\n# Summary: Reset an app to resolve conflicts\n# Help: Used to resolve conflicts in favor of a particular app. For example,\n# if you've installed 'python' and 'python27', you can use 'scoop reset' to switch between\n# using one or the other.\nparam($app)\n\n. \"$psscriptroot\\..\\lib\\core.ps1\"\n. \"$psscriptroot\\..\\lib\\manifest.ps1\"\n. \"$psscriptroot\\..\\lib\\help.ps1\"\n. \"$psscriptroot\\..\\lib\\install.ps1\"\n. \"$psscriptroot\\..\\lib\\versions.ps1\"\n\nif(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }\n\nif(!(installed $app)) { abort \"$app isn't installed\" }\n\n$version = current_version $app\n\"resetting $app ($version)\"\n\n$dir = resolve-path (versiondir $app $version)\n$manifest = installed_manifest $app $version\n\ncreate_shims $manifest $dir $false\nenv_add_path $manifest $dir\nenv_set $manifest $dir"
},
{
"from": "gpt",
"value": "# Usage: scoop reset <app>\n# Summary: Reset an app to resolve conflicts\n# Help: Used to resolve conflicts in favor of a particular app. For example,\n# if you've installed 'python' and 'python27', you can use 'scoop reset' to switch between\n# using one or the other.\nparam($app)\n\n. \"$psscriptroot\\..\\lib\\core.ps1\"\n. \"$psscriptroot\\..\\lib\\manifest.ps1\"\n. \"$psscriptroot\\..\\lib\\help.ps1\"\n. \"$psscriptroot\\..\\lib\\install.ps1\"\n. \"$psscriptroot\\..\\lib\\versions.ps1\"\n\nif(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }\n\nif ($app -eq \"scoop\") {\n \"resetting scoop\"\n\n if(!(test-path ~/.bashrc)) {\n 'creating ~/.bashrc'\n new-item -type file ~/.bashrc | out-null\n }\n if (!(get-content ~/.bashrc | select-string 'alias scoop' -quiet)) {\n 'creating bash alias for scoop...'\n 'alias scoop=\"powershell scoop.ps1\"' | out-file ~/.bashrc -en oem -append\n }\n else {\n 'bash alias for scoop already exists... skipping...'\n }\n} \nelse {\n if(!(installed $app)) { abort \"$app isn't installed\" }\n\n $version = current_version $app\n \"resetting $app ($version)\"\n\n $dir = resolve-path (versiondir $app $version)\n $manifest = installed_manifest $app $version\n\n create_shims $manifest $dir $false\n env_add_path $manifest $dir\n env_set $manifest $dir\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update build script for core\n"
},
{
"from": "human",
"value": "param (\n\t## The build target, i.e. Build, Rebuild, Clean\n\t[string]$Target = 'Build',\n\n\t## The build configuration, i.e. Debug/Release\n\t[string]$Configuration = 'Debug'\n)\n\n$ErrorActionPreference = \"Stop\"\n\n$Here = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n\n$SolutionRoot = (Split-Path -parent $Here)\n\n$SolutionFile = Join-Path $SolutionRoot \"CertiPay.Payroll.Common.sln\"\n\n# Bootstap ensures we have what we need to build the project\n\n$MSBuild = \"${env:ProgramFiles(x86)}\\MSBuild\\14.0\\Bin\\msbuild.exe\"\n\n# Build the solution, packaging the files if requested\n\nWrite-Output \"Running build target $Target for $Configuration\"\n\n# Switch /nodeReuse:false tells msbuild to stop after completing the build, avoiding conditions on the build server where it kept packages locked\n\n& $MSBuild $SolutionFile /v:quiet /t:$Target /m /p:Configuration=$Configuration /nodeReuse:false\n\nEXIT $LASTEXITCODE"
},
{
"from": "gpt",
"value": "param (\n\t## The build target, i.e. Build, Rebuild, Clean\n\t[string]$Target = 'Build',\n\n\t## The build configuration, i.e. Debug/Release\n\t[string]$Configuration = 'Debug'\n)\n\n$ErrorActionPreference = \"Stop\"\n\n$Here = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n\n$SolutionRoot = (Split-Path -parent $Here)\n\n$SolutionFile = Join-Path $SolutionRoot \"CertiPay.Payroll.Common\"\n\n# Bootstap ensures we have what we need to build the project\n\n$DotNet = \"${env:ProgramFiles}\\dotnet\\dotnet.exe\"\n\n# Build the solution, packaging the files if requested\n\n# dotnet.exe build \"C:\\Users\\Administrator\\Documents\\GitHub\\certipay.payroll.common\\CertiPay.Payroll.Common\" --configuration Debug --no-dependencies --no-incremental\n\nWrite-Output \"Running build target $Target for $Configuration\"\n\n& $DotNet build $SolutionFile --configuration $Configuration\n\nEXIT $LASTEXITCODE"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Upgrade to VM version 7.0.54\n"
},
{
"from": "human",
"value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"v7.0.53\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion"
},
{
"from": "gpt",
"value": "\n# Powershell script to pull the VM files from GitHub into the current folder.\n# Edit the following to match the version of the VM that is compatible with this image\n\nparam \n(\n [string]$VMversion=\"7.0.54.1\"\n)\n\nTry \n{\n\t$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;\n\tWrite-Host \"Fetching DolphinVM.zip\" $VMversion\n\t$source = \"https://github.com/dolphinsmalltalk/DolphinVM/releases/download/$VMversion/DolphinVM.zip\";\n\t$zipFile = $scriptDir+\"\\DolphinVM.zip\";\n\tInvoke-WebRequest $source -OutFile $zipFile;\n}\nCatch\n{\n\tWrite-Host \"Unable to fetch DolphinVM.zip\" $VMversion;\n\tBreak;\n}\n\n$shell = new-object -com shell.application;\n$zip = $shell.NameSpace($zipFile);\nforeach($item in $zip.items())\n{\n\tWrite-Host \"..unpack\" $item.Name\n\t$shell.Namespace($scriptDir).copyhere($item, 0x14);\n}\nWrite-Host \"Removing Zip\"\nRemove-Item $zipFile\nWrite-Host \"Done fetching DolphinVM.zip\" $VMversion"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add FsMtParser to build/pack nuget package\n"
},
{
"from": "human",
"value": "Push-Location $PSScriptRoot\n\nif(Test-Path .\\artifacts) { Remove-Item .\\artifacts -Force -Recurse }\n\n& dotnet restore --no-cache\n\n$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];\n$revision = @{ $true = \"{0:00000}\" -f [convert]::ToInt32(\"0\" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = \"local\" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];\n$suffix = @{ $true = \"\"; $false = \"$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision\"}[$branch -eq \"master\" -and $revision -ne \"local\"]\n\necho \"build: Version suffix is $suffix\"\n\nPush-Location src\\FsMessageTemplates\n\n& dotnet pack -c Release -o ..\\..\\.\\artifacts --version-suffix=$revision\nif($LASTEXITCODE -ne 0) { exit 1 }\n\nPop-Location\n\nPush-Location test\\FsMessageTemplates.Tests\n\n& dotnet test -c Release\nif($LASTEXITCODE -ne 0) { exit 2 }\n\nPop-Location\n"
},
{
"from": "gpt",
"value": "Push-Location $PSScriptRoot\n\nif(Test-Path .\\artifacts) { Remove-Item .\\artifacts -Force -Recurse }\n\n& dotnet restore --no-cache\n\n$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];\n$revision = @{ $true = \"{0:00000}\" -f [convert]::ToInt32(\"0\" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = \"local\" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];\n$suffix = @{ $true = \"\"; $false = \"$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision\"}[$branch -eq \"master\" -and $revision -ne \"local\"]\n\necho \"build: Version suffix is $suffix\"\n\nPush-Location src\\FsMessageTemplates\n\n& dotnet pack -c Release -o ..\\..\\.\\artifacts --version-suffix=$revision\nif($LASTEXITCODE -ne 0) { exit 1 }\n\nPop-Location\n\nPush-Location src\\FsMtParser\n\n& dotnet pack -c Release -o ..\\..\\.\\artifacts --version-suffix=$revision\nif($LASTEXITCODE -ne 0) { exit 1 }\n\nPop-Location\n\nPush-Location test\\FsMessageTemplates.Tests\n\n& dotnet test -c Release\nif($LASTEXITCODE -ne 0) { exit 2 }\n\nPop-Location\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use 1607 tag to have that image as first in manifest list\n"
},
{
"from": "human",
"value": "$version=$(select-string -Path Dockerfile -Pattern \"ENV CURL_VERSION\").ToString().split()[-1]\ndocker tag curl stefanscherer/curl-windows:$version-2016\ndocker push stefanscherer/curl-windows:$version-2016\n\nnpm install -g rebase-docker-image\nrebase-docker-image stefanscherer/curl-windows:$version-2016 -t stefanscherer/curl-windows:$version-1709 -b microsoft/nanoserver:1709\n\n..\\update-docker-cli.ps1\n\ndocker manifest create `\n stefanscherer/curl-windows:$version `\n stefanscherer/curl-windows:$version-2016 `\n stefanscherer/curl-windows:$version-1709\ndocker manifest push stefanscherer/curl-windows:$version\n\ndocker manifest create `\n stefanscherer/curl-windows:latest `\n stefanscherer/curl-windows:$version-2016 `\n stefanscherer/curl-windows:$version-1709\ndocker manifest push stefanscherer/curl-windows:latest\n"
},
{
"from": "gpt",
"value": "$version=$(select-string -Path Dockerfile -Pattern \"ENV CURL_VERSION\").ToString().split()[-1]\ndocker tag curl stefanscherer/curl-windows:$version-1607\ndocker push stefanscherer/curl-windows:$version-1607\n\nnpm install -g rebase-docker-image\nrebase-docker-image stefanscherer/curl-windows:$version-1607 -t stefanscherer/curl-windows:$version-1709 -b microsoft/nanoserver:1709\n\n..\\update-docker-cli.ps1\n\ndocker manifest create `\n stefanscherer/curl-windows:$version `\n stefanscherer/curl-windows:$version-1607 `\n stefanscherer/curl-windows:$version-1709\ndocker manifest push stefanscherer/curl-windows:$version\n\ndocker manifest create `\n stefanscherer/curl-windows:latest `\n stefanscherer/curl-windows:$version-1607 `\n stefanscherer/curl-windows:$version-1709\ndocker manifest push stefanscherer/curl-windows:latest\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add exit code test in appveyor script\n"
},
{
"from": "human",
"value": "$netherRoot = $PSScriptRoot\n\n# launch Nether.Web\nStart-Process powershell \"$netherRoot\\rundev.ps1\"\n\n# test for 200 OK from GET http://localhost:5000\n# with a retry window of 300 seconds \n$maximumRetryInSeconds = 300\n$startTime = Get-Date\n$r = $null\n$loaded = $false\nwhile (((Get-Date) - $startTime).TotalSeconds -le $maximumRetryInSeconds) {\n Write-Host \"testing http://localhost:5000\"\n try { $r = Invoke-WebRequest http://localhost:5000 -ErrorAction SilentlyContinue} catch{}\n if ( ($r -ne $null) -and ($r.StatusCode -eq 200)) {\n $loaded = $true\n Write-Host \"success!\"\n break\n }\n Start-Sleep -Seconds 10\n}\n\nif (-not $loaded){\n exit 100\n}\n\n&\"$netherRoot\\run-integration-tests.ps1\""
},
{
"from": "gpt",
"value": "$netherRoot = $PSScriptRoot\n\n# launch Nether.Web\nStart-Process powershell \"$netherRoot\\rundev.ps1\"\n\n# test for 200 OK from GET http://localhost:5000\n# with a retry window of 300 seconds \n$maximumRetryInSeconds = 300\n$startTime = Get-Date\n$r = $null\n$loaded = $false\nwhile (((Get-Date) - $startTime).TotalSeconds -le $maximumRetryInSeconds) {\n Write-Host \"testing http://localhost:5000\"\n try { $r = Invoke-WebRequest http://localhost:5000 -ErrorAction SilentlyContinue} catch{}\n if ( ($r -ne $null) -and ($r.StatusCode -eq 200)) {\n $loaded = $true\n Write-Host \"success!\"\n break\n }\n Start-Sleep -Seconds 10\n}\n\nif (-not $loaded){\n exit 100\n}\n\n&\"$netherRoot\\run-integration-tests.ps1\"\nif ($LASTEXITCODE -ne 0){\n $testExitCode = $LASTEXITCODE\n Write-Host \"Integration tests failed: $testExitCode\"\n exit $testExitCode\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script to launch app via adb\n"
},
{
"from": "gpt",
"value": "a\u0000d\u0000b\u0000 \u0000s\u0000h\u0000e\u0000l\u0000l\u0000 \u0000m\u0000o\u0000n\u0000k\u0000e\u0000y\u0000 \u0000-\u0000p\u0000 \u0000$\u0000a\u0000r\u0000g\u0000s\u0000[\u00000\u0000]\u0000 \u0000-\u0000c\u0000 \u0000a\u0000n\u0000d\u0000r\u0000o\u0000i\u0000d\u0000.\u0000i\u0000n\u0000t\u0000e\u0000n\u0000t\u0000.\u0000c\u0000a\u0000t\u0000e\u0000g\u0000o\u0000r\u0000y\u0000.\u0000L\u0000A\u0000U\u0000N\u0000C\u0000H\u0000E\u0000R\u0000 \u00001\u0000\r\u0000\n\u0000"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Check architecture when installing via Chocolatey.\n"
},
{
"from": "human",
"value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path $Env:ChocolateyToolsLocation $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n"
},
{
"from": "gpt",
"value": "$osVersion = [Environment]::OSVersion.Version.Major\r\n$osRelId = (gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion').ReleaseId\r\nif ($osVersion -ne 10 -or $osRelId -lt 1703) {\r\n\tthrow \"This package requires Windows 10 Fall Creators Update or later.\"\r\n}\r\n\r\nif ($Env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {\r\n\tthrow \"This package requires a 64-bit Windows.\"\r\n}\r\n\r\n$packageName = 'lxrunoffline'\r\n$url = 'https://github.com/DDoSolitary/LxRunOffline/releases/download/v{VERSION}/LxRunOffline-v{VERSION}.zip'\r\n$unzipLocation = Join-Path $Env:ChocolateyToolsLocation $packageName\r\nif (Test-Path $unzipLocation) {\r\n\trm -Recurse $unzipLocation\r\n}\r\nInstall-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $unzipLocation -Checksum '{CHECKSUM}' -ChecksumType 'sha256'\r\nInstall-ChocolateyPath -PathToInstall $unzipLocation -PathType 'Machine'\r\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update module manifest to test PSEdition\n"
},
{
"from": "human",
"value": "#\n# Script module for module 'PSScriptAnalyzer'\n#\n\n# Clear PSDefaultParameterValues in the module scope and enable strict mode\n$PSDefaultParameterValues.Clear()\nSet-StrictMode -Version Latest\n\n# Set up some helper variables to make it easier to work with the module\n$PSModule = $ExecutionContext.SessionState.Module\n$PSModuleRoot = $PSModule.ModuleBase\n\n# Import the appropriate nested binary module based on the current PowerShell version\n$binaryModuleRoot = $PSModuleRoot\n\nif ($PSVersionTable.PSEdition -ne 'Desktop') {\n $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'\n}\nelse\n{\n if ($PSVersionTable.PSVersion -lt [Version]'5.0') {\n $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv3'\n } \n}\n\n$binaryModulePath = Join-Path -Path $binaryModuleRoot -ChildPath 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll'\n$binaryModule = Import-Module -Name $binaryModulePath -PassThru\n\n# When the module is unloaded, remove the nested binary module that was loaded with it\n$PSModule.OnRemove = {\n Remove-Module -ModuleInfo $binaryModule\n}"
},
{
"from": "gpt",
"value": "#\n# Script module for module 'PSScriptAnalyzer'\n#\n\n# Clear PSDefaultParameterValues in the module scope and enable strict mode\n$PSDefaultParameterValues.Clear()\nSet-StrictMode -Version Latest\n\n# Set up some helper variables to make it easier to work with the module\n$PSModule = $ExecutionContext.SessionState.Module\n$PSModuleRoot = $PSModule.ModuleBase\n\n# Import the appropriate nested binary module based on the current PowerShell version\n$binaryModuleRoot = $PSModuleRoot\n\n\nif (($PSVersionTable.Keys -contains \"PSEdition\") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {\n $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'\n}\nelse\n{\n if ($PSVersionTable.PSVersion -lt [Version]'5.0') {\n $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv3'\n } \n}\n\n$binaryModulePath = Join-Path -Path $binaryModuleRoot -ChildPath 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll'\n$binaryModule = Import-Module -Name $binaryModulePath -PassThru\n\n# When the module is unloaded, remove the nested binary module that was loaded with it\n$PSModule.OnRemove = {\n Remove-Module -ModuleInfo $binaryModule\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Update Local Module Metadata is a runbook not a reference PS module\n"
},
{
"from": "gpt",
"value": "<#\n .Synopsis\n Runs in an SMA environment and imports all metadata about a PowerShell module\n into the environment\n#>\nWorkflow Update-LocalModuleMetadata\n{ \n Param([Parameter(Mandatory=$True)] $ModuleName)\n\n Write-Verbose -Message \"[$ModuleName] Started [$WorkflowCommandName]\"\n\n try \n {\n\t\tSet-AutomationActivityMetadata -ModuleName $ModuleName -ModuleVersion 1 -ListOfCommands (Get-Command -Module $ModuleName).Name\n\t} \n\tcatch \n {\n\t\tThrow-Exception -Type 'ModuleActivityFailure' `\n -Message 'Failed to set the module activity metadata' `\n -Property @{ 'Error' = $_ }\n\t}\n \n Write-Verbose -Message \"[$ModuleName] Finished [$WorkflowCommandName]\" \n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Remove the PoSh diff alias if the real deal is present\n"
},
{
"from": "human",
"value": "if ($DotFilesShowScriptEntry) {\n Write-Verbose -Message (Get-DotFilesMessage -Message $PSCommandPath)\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Configuring aliases ...')\n\n# Some useful aliases\nSet-Alias -Name cop -Value Compare-ObjectProperties\nSet-Alias -Name gh -Value Get-Help\nSet-Alias -Name gita -Value Invoke-GitChildDir\nSet-Alias -Name rdn -Value Resolve-DnsName\nSet-Alias -Name up -Value Update-Profile\nSet-Alias -Name which -Value Get-Command\n\n# Windows only\nif (Test-IsWindows) {\n # Remove the curl alias if the real deal is present\n if (Get-Command -Name curl.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\curl -ErrorAction Ignore\n }\n\n # Remove the sc alias in favour of the sc.exe utility\n if (Get-Command -Name sc.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\sc -ErrorAction Ignore\n }\n\n # Remove the wget alias if the real deal is present\n if (Get-Command -Name wget.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\wget -ErrorAction Ignore\n }\n}\n"
},
{
"from": "gpt",
"value": "if ($DotFilesShowScriptEntry) {\n Write-Verbose -Message (Get-DotFilesMessage -Message $PSCommandPath)\n}\n\nWrite-Verbose -Message (Get-DotFilesMessage -Message 'Configuring aliases ...')\n\n# Some useful aliases\nSet-Alias -Name cop -Value Compare-ObjectProperties\nSet-Alias -Name gh -Value Get-Help\nSet-Alias -Name gita -Value Invoke-GitChildDir\nSet-Alias -Name rdn -Value Resolve-DnsName\nSet-Alias -Name up -Value Update-Profile\nSet-Alias -Name which -Value Get-Command\n\n# Windows only\nif (Test-IsWindows) {\n # Remove the curl alias if the real deal is present\n if (Get-Command -Name curl.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\curl -ErrorAction Ignore\n }\n\n # Remove the diff alias if the real deal is present\n if (Get-Command -Name diff.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\diff -Force -ErrorAction Ignore\n }\n\n # Remove the sc alias in favour of the sc.exe utility\n if (Get-Command -Name sc.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\sc -ErrorAction Ignore\n }\n\n # Remove the wget alias if the real deal is present\n if (Get-Command -Name wget.exe -ErrorAction Ignore) {\n Remove-Item -LiteralPath Alias:\\wget -ErrorAction Ignore\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add conemu and msys2 via chocolatey\n"
},
{
"from": "human",
"value": "Set-ExecutionPolicy Unrestricted\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\nchoco install conemu\nchoco install msys2\n"
},
{
"from": "gpt",
"value": "Set-ExecutionPolicy Unrestricted\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\nchoco install -y conemu\nchoco install -y msys2\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Use native powershell for unzipping\n"
},
{
"from": "human",
"value": "Write-Host \"Installing chocolatey\"\nSet-ExecutionPolicy Unrestricted\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n((New-Object System.Net.WebClient).DownloadFile('https://github.com/ctfhacker/windows-setup/archive/master.zip', 'C:\\Windows\\Temp\\master.zip'))\n\ncd C:\\Windows\\Temp\\\nmkdir master\n$shell = new-object -com shell.application\n$zip = $shell.NameSpace(\"master.zip\")\nforeach($item in $zip.items())\n{\n $shell.Namespace(\".\\master\").copyhere($item)\n}\n\ncd master\\windows-setup-master\n\nGet-ChildItem | ForEach-Object {\n Write-Host \"Executing \" + $_.FullName\n & $_.FullName\n}\n\nWrite-Host \"Rebooting..\"\nshutdown /r /t 0\n"
},
{
"from": "gpt",
"value": "Write-Host \"Installing chocolatey\"\nSet-ExecutionPolicy Unrestricted\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n((New-Object System.Net.WebClient).DownloadFile('https://github.com/ctfhacker/windows-setup/archive/master.zip', 'C:\\Windows\\Temp\\master.zip'))\n\ncd C:\\Windows\\Temp\\\nmkdir master\n$shell = new-object -com shell.application\n$zip = $shell.NameSpace(\"C:\\Windows\\Temp\\master.zip\")\nforeach($item in $zip.items())\n{\n $shell.Namespace(\".\\master\").copyhere($item)\n}\n\ncd master\\windows-setup-master\n\nGet-ChildItem | ForEach-Object {\n Write-Host \"Executing \" + $_.FullName\n & $_.FullName\n}\n\nWrite-Host \"Rebooting..\"\nshutdown /r /t 0\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix scope of $LastObject in Out-Default function\n"
},
{
"from": "human",
"value": "Write-Verbose -Message (Get-DotFilesMessage -Message 'Configuring PowerShell ...')\n\n# Number of elements to enumerate when displaying arrays\n$FormatEnumerationLimit = 5\n\n# Default to UTF-8 encoding with Out-File\n$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'\n\n# PowerShell Core doesn't publish help for the en-GB locale\nif ($PSVersionTable.PSEdition -eq 'Core') {\n $PSDefaultParameterValues['Update-Help:UICulture'] = 'en-US'\n}\n\n# Save the output of the last command in a variable\n# http://get-powershell.com/post/2008/06/25/Stuffing-the-output-of-the-last-command-into-an-automatic-variable.aspx\nFunction Out-Default {\n $Input | Tee-Object -Variable LastObject | Microsoft.PowerShell.Core\\Out-Default\n}\n\n# Setup our custom prompt if oh-my-posh is not loaded\nif (!(Get-Module -Name oh-my-posh)) {\n Function Prompt {\n $prompt = ''\n\n # posh-git\n if ($GitPromptScriptBlock) {\n $prompt += & $GitPromptScriptBlock\n }\n\n # Default\n if (-not $prompt) {\n $prompt = 'PS {0}{1} ' -f $ExecutionContext.SessionState.Path.CurrentLocation, '>' * ($NestedPromptLevel + 1)\n }\n\n # ConEmu\n if ($ConEmuPrompt) {\n $prompt += & $ConEmuPrompt\n }\n\n return $prompt\n }\n}\n"
},
{
"from": "gpt",
"value": "Write-Verbose -Message (Get-DotFilesMessage -Message 'Configuring PowerShell ...')\n\n# Number of elements to enumerate when displaying arrays\n$FormatEnumerationLimit = 5\n\n# Default to UTF-8 encoding with Out-File\n$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'\n\n# PowerShell Core doesn't publish help for the en-GB locale\nif ($PSVersionTable.PSEdition -eq 'Core') {\n $PSDefaultParameterValues['Update-Help:UICulture'] = 'en-US'\n}\n\n# Save the output of the last command in a variable\n# http://get-powershell.com/post/2008/06/25/Stuffing-the-output-of-the-last-command-into-an-automatic-variable.aspx\nFunction Out-Default {\n $Input | Tee-Object -Variable LastObject | Microsoft.PowerShell.Core\\Out-Default\n $Global:LastObject = $LastObject\n}\n\n# Setup our custom prompt if oh-my-posh is not loaded\nif (!(Get-Module -Name oh-my-posh)) {\n Function Prompt {\n $prompt = ''\n\n # posh-git\n if ($GitPromptScriptBlock) {\n $prompt += & $GitPromptScriptBlock\n }\n\n # Default\n if (-not $prompt) {\n $prompt = 'PS {0}{1} ' -f $ExecutionContext.SessionState.Path.CurrentLocation, '>' * ($NestedPromptLevel + 1)\n }\n\n # ConEmu\n if ($ConEmuPrompt) {\n $prompt += & $ConEmuPrompt\n }\n\n return $prompt\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update fix based on comments for Export-Clixml and Import-Clixml Pester Test\n"
},
{
"from": "human",
"value": "Describe \"XmlCommand DRT basic functionality Tests\" -Tags DRT{\n\n\tBeforeAll {\n\t\tif(-not ([System.Management.Automation.PSTypeName]'IsHiddenTestType').Type)\n\t\t{\n\t\t\tAdd-Type -TypeDefinition @\"\n\t\tpublic class IsHiddenTestType\n {\n public IsHiddenTestType()\n {\n Property1 = 1;\n Property2 = \"some string\";\n }\n\n public IsHiddenTestType(int val, string data)\n {\n Property1 = val;\n Property2 = data;\n }\n\n public int Property1;\n public string Property2;\n }\n\"@\n\t\t}\n }\n\n\tBeforeEach {\n\t\t$testfile = Join-Path -Path $TestDrive -ChildPath \"clixml-directive.xml\"\n\t}\n\t\n AfterEach {\n\t\trm $testfile\n }\n\n It \"Import with CliXml directive should work\" -Skip:$IsOSX{\n\t\tGet-Process | Export-Clixml $testfile\n\t\t$results = Import-clixml $testfile\n\t\t$results.Count | Should BeGreaterThan 0\n\t\t$results[0].ToString().Contains(\"System.Diagnostics.Process\") | Should Be $true\n }\n\t\n\tIt \"Import with Rehydration should work\" -Skip:$IsOSX{\n\t\t$property1 = 256\n\t\t$property2 = \"abcdef\"\n\t\t$isHiddenTestType = [IsHiddenTestType]::New($property1,$property2)\n\t\t$isHiddenTestType | Export-Clixml $testfile\n\t\t$results = Import-clixml $testfile\n\t\t$results.Property1 | Should Be $property1\n\t\t$results.Property2 | Should Be $property2\n }\n}\n"
},
{
"from": "gpt",
"value": "Describe \"XmlCommand DRT basic functionality Tests\" -Tags DRT{\n\n\tBeforeAll {\n\t\tif(-not ('IsHiddenTestType' -as \"type\"))\n\t\t{\n\t\t\tAdd-Type -TypeDefinition @\"\n\t\tpublic class IsHiddenTestType\n {\n public IsHiddenTestType()\n {\n Property1 = 1;\n Property2 = \"some string\";\n }\n\n public IsHiddenTestType(int val, string data)\n {\n Property1 = val;\n Property2 = data;\n }\n\n public int Property1;\n public string Property2;\n }\n\"@\n\t\t}\n }\n\n\tBeforeEach {\n\t\t$testfile = Join-Path -Path $TestDrive -ChildPath \"clixml-directive.xml\"\n\t}\n\t\n AfterEach {\n\t\tremove-item $testfile\n }\n\n It \"Import with CliXml directive should work\" -Skip:$IsOSX{\n\t\tGet-Process | Export-Clixml $testfile\n\t\t$results = Import-Clixml $testfile\n\t\t$results.Count | Should BeGreaterThan 0\n\t\t$results[0].ToString() | Should Match \"System.Diagnostics.Process\"\n }\n\t\n\tIt \"Import with Rehydration should work\" -Skip:$IsOSX{\n\t\t$property1 = 256\n\t\t$property2 = \"abcdef\"\n\t\t$isHiddenTestType = [IsHiddenTestType]::New($property1,$property2)\n\t\t$isHiddenTestType | Export-Clixml $testfile\n\t\t$results = Import-Clixml $testfile\n\t\t$results.Property1 | Should Be $property1\n\t\t$results.Property2 | Should Be $property2\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update installation script to use file\n"
},
{
"from": "human",
"value": "$package = 'GitDiffMargin'\n\n$params = @{\n PackageName = $package;\n VsixUrl = 'https://visualstudiogallery.msdn.microsoft.com/cf49cf30-2ca6-4ea0-b7cc-6a8e0dadc1a8/file/101267/12/GitDiffMargin.vsix';\n}\n\nInstall-VisualStudioVsixExtension @params\n"
},
{
"from": "gpt",
"value": "$ErrorActionPreference = 'Stop';\n\n$toolsPath = Split-Path $MyInvocation.MyCommand.Definition\n$filePath = \"$toolsPath\\GitDiffMargin.vsix\"\n\n$package = 'GitDiffMargin'\n$vsixUrl = \"file://\" + $filePath.Replace(\"\\\", \"/\")\n\n$params = @{\n PackageName = $package;\n VsixUrl = $vsixUrl;\n}\n\nInstall-VisualStudioVsixExtension @params\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Allow create or not ACR when creating k8s\n"
},
{
"from": "human",
"value": "Param(\n [parameter(Mandatory=$true)][string]$resourceGroupName,\n [parameter(Mandatory=$true)][string]$location,\n [parameter(Mandatory=$true)][string]$registryName,\n [parameter(Mandatory=$true)][string]$orchestratorName,\n [parameter(Mandatory=$true)][string]$dnsName\n)\n\n# Create resource group\nWrite-Host \"Creating resource group...\" -ForegroundColor Yellow\naz group create --name=$resourceGroupName --location=$location\n\n# Create Azure Container Registry\nWrite-Host \"Creating Azure Container Registry...\" -ForegroundColor Yellow\naz acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic\n\n# Create kubernetes orchestrator\nWrite-Host \"Creating kubernetes orchestrator...\" -ForegroundColor Yellow\naz acs create --orchestrator-type=kubernetes --resource-group $resourceGroupName --name=$orchestratorName --dns-prefix=$dnsName --generate-ssh-keys\n\n# Retrieve kubernetes cluster configuration and save it under ~/.kube/config \naz acs kubernetes get-credentials --resource-group=$resourceGroupName --name=$orchestratorName\n\n# Show ACR credentials\naz acr credential show -n $registryName"
},
{
"from": "gpt",
"value": "Param(\n [parameter(Mandatory=$true)][string]$resourceGroupName,\n [parameter(Mandatory=$true)][string]$location,\n [parameter(Mandatory=$true)][string]$registryName,\n [parameter(Mandatory=$true)][string]$orchestratorName,\n [parameter(Mandatory=$true)][string]$dnsName,\n [parameter(Mandatory=$true)][string]$createAcr=$true\n)\n\n# Create resource group\nWrite-Host \"Creating resource group...\" -ForegroundColor Yellow\naz group create --name=$resourceGroupName --location=$location\n\nif ($createAcr) {\n # Create Azure Container Registry\n Write-Host \"Creating Azure Container Registry...\" -ForegroundColor Yellow\n az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic\n}\n\n# Create kubernetes orchestrator\nWrite-Host \"Creating kubernetes orchestrator...\" -ForegroundColor Yellow\naz acs create --orchestrator-type=kubernetes --resource-group $resourceGroupName --name=$orchestratorName --dns-prefix=$dnsName --generate-ssh-keys\n\n# Retrieve kubernetes cluster configuration and save it under ~/.kube/config \naz acs kubernetes get-credentials --resource-group=$resourceGroupName --name=$orchestratorName\n\n# Show ACR credentials\naz acr credential show -n $registryName"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix build script - nuget pack command\n"
},
{
"from": "human",
"value": "properties {\n\t# base & build directories\n\t$base_dir = . resolve-path .\\\n\t$tests_dir = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure.UnitTests\\bin\\Release\"\n\n\t# .net framework version\n\t$framework = \"4.5.1\"\n\t\n\t# solution file & unit tests\n\t$sln_file = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure.sln\"\n\t$unit_tests = \"$tests_dir\\ReliableUnitOfWork.SqlAzure.UnitTests.dll\"\n\t$nuspec_file = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure\\ReliableUnitOfWork.SqlAzure.csproj\"\n}\n\ntask default -depends PackNuGetPackages\n\ntask GitVersion {\n\t$assemblyVersion = (gitversion | Out-String | ConvertFrom-Json).AssemblySemVer\n\tWrite-Host \"Current Assemby Version (from GitVersion): $assemblyVersion\"\n}\n\ntask RestoreNuGetPackages -depends GitVersion {\n\texec { nuget.exe restore $sln_file }\n}\n\ntask BuildSolution -depends RestoreNuGetPackages {\n\texec { msbuild \"/t:Clean;Rebuild\" \"/p:configuration=Release;OutDir=$build_dir\" $sln_file }\n}\n\ntask RunUnitTests -depends BuildSolution {\n\texec { xunit.console.clr4.bat $unit_tests }\n}\n\ntask PackNuGetPackages -depends RunUnitTests {\n\texec { nuget.exe pack $nuspec_file }\n}\n"
},
{
"from": "gpt",
"value": "properties {\n\t# build variables\n\t$framework = \"4.5.1\"\t\t# .net framework version\n\t$configuration = \"Release\"\t# build configuration\n\t\n\t# directories\n\t$base_dir = . resolve-path .\\\n\t$tests_dir = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure.UnitTests\\bin\\$configuration\"\n\n\t# files\n\t$sln_file = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure.sln\"\n\t$unit_tests = \"$tests_dir\\ReliableUnitOfWork.SqlAzure.UnitTests.dll\"\n\t$nuspec_file = \"$base_dir\\src\\ReliableUnitOfWork.SqlAzure\\ReliableUnitOfWork.SqlAzure.nuspec\"\n}\n\ntask default -depends PackNuGetPackages\n\ntask RestoreNuGetPackages {\n\texec { nuget.exe restore $sln_file }\n}\n\ntask BuildSolution -depends RestoreNuGetPackages {\n\texec { msbuild \"/t:Clean;Build\" \"/p:Configuration=$configuration\" $sln_file }\n}\n\ntask RunUnitTests -depends BuildSolution {\n\texec { xunit.console.clr4.bat $unit_tests }\n}\n\ntask PackNuGetPackages -depends RunUnitTests {\n\t# assembly version calculated by GitVersion\n\t$version = (gitversion | Out-String | ConvertFrom-Json).NuGetVersion\n\tWrite-Host \"NuGet Version (calculated by GitVersion): $version\"\n\texec { nuget.exe pack $nuspec_file -Version $version -Prop Configuration=$configuration -Symbols -Verbosity detailed }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update scoop and concfg in install script\n"
},
{
"from": "human",
"value": "if (Test-Path $PROFILE) {\n $file = Get-Item $PROFILE -Force -ea 0\n $symlink = $file.Attributes -band [IO.FileAttributes]::ReparsePoint\n if (-Not $symlink) {\n Remove-Item $PROFILE\n cmd /c mklink \"$PROFILE\" \"$($args[0])\"\n }\n} else {\n $profilePath = Split-Path $PROFILE\n if (!(Test-Path -Path $profilePath)) {\n New-Item -ItemType directory -Path $profilePath | Out-Null\n }\n cmd /c mklink \"$PROFILE\" \"$($args[0])\"\n}\n\n. $PROFILE\n\niex (new-object net.webclient).downloadstring('https://get.scoop.sh')\nscoop install concfg\nconcfg import -n solarized-light small concfg\\source-code-pro.json\nconcfg clean\n"
},
{
"from": "gpt",
"value": "if (Test-Path $PROFILE) {\n $file = Get-Item $PROFILE -Force -ea 0\n $symlink = $file.Attributes -band [IO.FileAttributes]::ReparsePoint\n if (-Not $symlink) {\n Remove-Item $PROFILE\n cmd /c mklink \"$PROFILE\" \"$($args[0])\"\n }\n} else {\n $profilePath = Split-Path $PROFILE\n if (!(Test-Path -Path $profilePath)) {\n New-Item -ItemType directory -Path $profilePath | Out-Null\n }\n cmd /c mklink \"$PROFILE\" \"$($args[0])\"\n}\n\n. $PROFILE\n\niex (new-object net.webclient).downloadstring('https://get.scoop.sh')\nscoop update\nscoop install concfg\nscoop update concfg\nconcfg import -n solarized-light small concfg\\source-code-pro.json\nconcfg clean\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix package versioning in non AppVeyor environment.\n"
},
{
"from": "human",
"value": "# Set versions for AssemblyInfo.cs\n$version = ( Get-Content .\\Version.txt );\n$env:AssemblyBaseVersion = $version | foreach{ if( $_ -match \"^\\d+\\.\\d+\" ){ $matches[0] } }\nif ( $env:APPVEYOR_REPO_TAG -ne \"True\" )\n{\n\tif ( ${env:APPVEYOR_BUILD_NUMBER} -eq $null )\n\t{\n\t\t$now = [DateTime]::UtcNow\n\t\t$daysSpan = $now - ( New-Object DateTime( $now.Year, 1, 1 ) )\n\t\t$env:PackageVersion = \"${version}-{0:yy}{1:000}\" -f @( $now, $daysSpan.Days )\n\t}\n\telseif ( ${version} -match \"^[\\d.]+$\" )\n\t{\n\t\t$env:PackageVersion = \"${version}-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n\telse\n\t{\n\t\t$env:PackageVersion = \"${version}-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n}\nelse\n{\n\t$env:PackageVersion = $version\n}\n\nWrite-Host \"version:'${version}', AssemblyBaseVersion:'${env:AssemblyBaseVersion}', PackageVersion:'${env:PackageVersion}'\"\n"
},
{
"from": "gpt",
"value": "# Set versions for AssemblyInfo.cs\n$version = ( Get-Content .\\Version.txt );\n$env:AssemblyBaseVersion = $version | foreach{ if( $_ -match \"^\\d+\\.\\d+\" ){ $matches[0] } }\nif ( $env:APPVEYOR_REPO_TAG -ne \"True\" )\n{\n\tif ( ${env:APPVEYOR_BUILD_NUMBER} -eq $null )\n\t{\n\t\t$now = [DateTime]::UtcNow\n\t\t$daysSpan = $now - ( New-Object DateTime( $now.Year, 1, 1 ) )\n\t\t$env:PackageVersion = \"${version}-{0:yy}{1:000}-{2:000}\" -f @( $now, $daysSpan.Days, ( $now.TimeOfDay.TotalMinutes / 2 ) )\n\t}\n\telseif ( ${version} -match \"^[\\d.]+$\" )\n\t{\n\t\t$env:PackageVersion = \"${version}-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n\telse\n\t{\n\t\t$env:PackageVersion = \"${version}-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n}\nelse\n{\n\t$env:PackageVersion = $version\n}\n\nWrite-Host \"version:'${version}', AssemblyBaseVersion:'${env:AssemblyBaseVersion}', PackageVersion:'${env:PackageVersion}'\"\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add version number updating script\n"
},
{
"from": "gpt",
"value": "# Update versions.\nparam( [string]$mode = \"fix\", [string]$suffix = $null, [bool]$forceRebuild = $false )\n\n$baseDirectory = \".\\src\"\n[string]$msbuild\nswitch( [Environment]::OSVersion.Platform )\n{\n\t{ $_ -eq [PlatformID]::Win32Windows -or $_ -eq [PlatformID]::Win32NT }\n\t{\n\t\t$framworkRoot\n\t\tif( [IntPtr]::Size -eq 8 )\n\t\t{\n\t\t\t$framworkRoot = \"$env:SystemRoot\\Microsoft.NET\\Framework64\"\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$framworkRoot = \"$env:SystemRoot\\Microsoft.NET\\Framework\"\n\t\t}\n\t\t\n\t\t$frameworkDirectories = dir $framworkRoot\n\t\t$msbuild = $frameworkDirectories[ $frameworkDirectories.Length ] + \"MSBuild.exe\"\n\t}\n\t{ $_ -eq [PlatformID]::Unix -or $_ -eq [PlatformID]::MacOSX }\n\t{\n\t\t$msbuild = \"$env:MONO_ROOT/bin/xbuild\"\n\t}\n\tdefault\n\t{\n\t\tthrow ( \"Unknown platform {0}.\" -f [Environment]::OSVersion.Platform )\n\t}\n}\n\nif( $forceRebuild -or ![IO.File]::Exists( \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" ) )\n{\n\t& \"$msbuild\" \".\\tools\\UpdateVersion\\UpdateVersion.csproj\" \"-Config=Release\"\n}\n\n[Version]$version = $null\nif( $versionString -ne $null )\n{\n\ttry\n\t{\n\t\t$version = new-object Version( $versionString )\n\t}\n\tcatch { }\n}\nswitch ( $mode )\n{\n\t\"show\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" --show\n\t}\n\t\"fix\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" -b\n\t}\n\t\"minor\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" -n\n\t}\n\t\"major\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" -j\n\t}\n\t\"beta\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" -n --suffix Beta\n\t}\n\t\"rc\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" --suffix RC\n\t}\n\t\"release\"\n\t{\n\t\t& \".\\tools\\UpdateVersion\\bin\\UpdateVersion.exe\" -d \"$baseDirectory\" --no-suffix\n\t}\n\tdefault\n\t{\n\t\tthrow ( \"Unknown mode `\"{0}`\"\" -f $mode )\n\t}\n}"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Resolve symlink to bin dir in pwsh profile\n"
},
{
"from": "human",
"value": "# Make tab act like bash\nSet-PSReadlineKeyHandler -Key Tab -Function Complete\n\n# Disable tab completion bell\nSet-PSReadlineOption -BellStyle None\n\n# Aliases\nSet-Alias c code-insiders.cmd\n\n# Add bin to $Path\n# $vParentPath = Split-Path $PSScriptRoot -Parent\n# $vBinPath = Join-Path -Path $vParentPath -ChildPath \"data\\bin\"\n$env:Path = \"$env:Path;E:\\GitHub\\Tyriar\\dotfiles\\data\\bin\"\n\n# Remove ad spam from npm install...\n$env:OPEN_SOURCE_CONTRIBUTOR = \"true\"\n\n# Prompt posh-git\n# Import-Module posh-git\n\n# Prompt starship\nInvoke-Expression (&starship init powershell)\n"
},
{
"from": "gpt",
"value": "# Make tab act like bash\nSet-PSReadlineKeyHandler -Key Tab -Function Complete\n\n# Disable tab completion bell\nSet-PSReadlineOption -BellStyle None\n\n# Aliases\nSet-Alias c code-insiders.cmd\n\n# Add bin to $Path\n$vResolvedPath = (Get-ChildItem -Path \"$([Environment]::GetFolderPath(\"MyDocuments\"))\\PowerShell\\Profile.ps1\").Target\n$vParentPath = Split-Path (Get-ChildItem $vResolvedPath).DirectoryName -Parent\n$vBinPath = Join-Path -Path $vParentPath -ChildPath \"bin\"\n$env:Path = \"$env:Path;$vBinPath\"\n\n# Remove ad spam from npm install...\n$env:OPEN_SOURCE_CONTRIBUTOR = \"true\"\n\n# Prompt posh-git\n# Import-Module posh-git\n\n# Prompt starship\nInvoke-Expression (&starship init powershell)\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix test timing out due to module scan\n"
},
{
"from": "human",
"value": "[CmdletBinding()]\nparam()\n\n# Arrange.\n. $PSScriptRoot\\..\\..\\..\\..\\Tests\\lib\\Initialize-Test.ps1\n$module = Microsoft.PowerShell.Core\\Import-Module $PSScriptRoot\\.. -PassThru\n$variableSets = @(\n @{ PreferredModule = 'Azure', 'AzureRM' }\n @{ PreferredModule = 'Azure' }\n @{ PreferredModule = 'AzureRM' }\n)\nforeach ($variableSet in $variableSets) {\n Write-Verbose ('-' * 80)\n Unregister-Mock Import-FromModulePath\n Unregister-Mock Import-FromSdkPath\n Register-Mock Import-FromModulePath\n Register-Mock Import-FromSdkPath\n\n # Act/Assert.\n Assert-Throws { & $module Import-AzureModule -PreferredModule $variableSet.PreferredModule -azurePsVersion \"4.1.0\" } -MessagePattern \"AZ_ModuleNotFound 4.1.0\"\n}\n"
},
{
"from": "gpt",
"value": "[CmdletBinding()]\nparam()\n\n# Arrange.\n. $PSScriptRoot\\..\\..\\..\\..\\Tests\\lib\\Initialize-Test.ps1\n$module = Microsoft.PowerShell.Core\\Import-Module $PSScriptRoot\\.. -PassThru\nRegister-Mock Import-FromModulePath\nRegister-Mock Import-FromSdkPath\nRegister-Mock Discover-AvailableAzureModules\n$variableSets = @(\n @{ PreferredModule = 'Azure', 'AzureRM' }\n @{ PreferredModule = 'Azure' }\n @{ PreferredModule = 'AzureRM' }\n)\nforeach ($variableSet in $variableSets) {\n Write-Verbose ('-' * 80)\n\n # Act/Assert.\n Assert-Throws { & $module Import-AzureModule -PreferredModule $variableSet.PreferredModule -azurePsVersion \"4.1.0\" } -MessagePattern \"AZ_ModuleNotFound 4.1.0\"\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Validate behaviour of Get-FunctionDefinition when the file doesn't contain any function\n"
},
{
"from": "human",
"value": "#Get public and private function definition files.\n $Public = @( Get-ChildItem -Path $PSScriptRoot\\Public\\*.ps1 -ErrorAction SilentlyContinue )\n $Private = @( Get-ChildItem -Path $PSScriptRoot\\Private\\*.ps1 -ErrorAction SilentlyContinue )\n\n#Dot source the files\n Foreach ( $Import in @($Public + $Private) ) {\n Try\n {\n . $Import.FullName\n }\n Catch\n {\n Write-Error -Message \"Failed to import function $($Import.FullName): $_\"\n }\n }\n\n# Here I might...\n # Read in or create an initial config file and variable\n # Export Public functions ($Public.BaseName) for WIP modules\n # Set variables visible to the module and its functions only\n\nExport-ModuleMember -Function $Public.Basename\n"
},
{
"from": "gpt",
"value": "#Get public and private function definition files.\n $Public = @( Get-ChildItem -Path $PSScriptRoot\\Public\\*.ps1 -ErrorAction SilentlyContinue )\n $Private = @( Get-ChildItem -Path $PSScriptRoot\\Private\\*.ps1 -ErrorAction SilentlyContinue )\n\n Foreach ( $Import in @($Public + $Private) ) {\n Try {\n . $Import.FullName\n }\n Catch {\n Write-Error -Message \"Failed to import function $($Import.FullName): $_\"\n }\n }\n\n# Here I might...\n # Export Public functions ($Public.BaseName) for WIP modules\n # Set variables visible to the module and its functions only\n\nExport-ModuleMember -Function $Public.Basename"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Clean the install directory when installing a new version.\n\nh/t @ferventcoder on git-tfs/git-tfs#341\n"
},
{
"from": "human",
"value": "try {\n $sysDrive = $env:SystemDrive\n $gittfsPath = \"$sysDrive\\tools\\gittfs\"\n \n Install-ChocolateyZipPackage 'gittfs' '${DownloadUrl}' $gittfsPath\n Install-ChocolateyPath $gittfsPath\n\n write-host 'git-tfs has been installed. Call git tfs from the command line to see options. You may need to close and reopen the command shell.'\n Write-ChocolateySuccess 'gittfs'\n} catch {\n Write-ChocolateyFailure 'gittfs' $($_.Exception.Message)\n throw \n}\n"
},
{
"from": "gpt",
"value": "try {\n $sysDrive = $env:SystemDrive\n $gittfsPath = \"$sysDrive\\tools\\gittfs\"\n\n if(test-path $gittfsPath) {\n write-host \"Cleaning out the contents of $gittfsPath\"\n Remove-Item \"$($gittfsPath)\\*\" -recurse -force\n }\n \n Install-ChocolateyZipPackage 'gittfs' '${DownloadUrl}' $gittfsPath\n Install-ChocolateyPath $gittfsPath\n\n write-host 'git-tfs has been installed. Call `git tfs` from the command line to see options. You may need to close and reopen the command shell.'\n Write-ChocolateySuccess 'gittfs'\n} catch {\n Write-ChocolateyFailure 'gittfs' $($_.Exception.Message)\n throw \n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Revert \"Update date format for windows build\"\n\nThis reverts commit 663ef3bb1c3db7f18e8eb4ca471045328291d54e.\n"
},
{
"from": "human",
"value": "$VERSION_FILE = $(split-path $MyInvocation.MyCommand.Definition) + \"\\..\\VERSION\"\n$BUILT_AT_FILE = $(split-path $MyInvocation.MyCommand.Definition) + \"\\..\\BUILT_AT\"\n\n$CURRENT_SHA = $(git rev-parse --short HEAD)\n$CURRENT_VERSION = get-content VERSION\n$VERSION_STRING = $CURRENT_VERSION + \"+\" + $CURRENT_SHA\n$DATE = Get-Date -uformat \"%Y%m%dT%H%M\"\n\n$VERSION_STRING | Out-File -Encoding \"UTF8\" $VERSION_FILE\n$DATE | Out-File -Encoding \"UTF8\" $BUILT_AT_FILE\n"
},
{
"from": "gpt",
"value": "$VERSION_FILE = $(split-path $MyInvocation.MyCommand.Definition) + \"\\..\\VERSION\"\n$BUILT_AT_FILE = $(split-path $MyInvocation.MyCommand.Definition) + \"\\..\\BUILT_AT\"\n\n$CURRENT_SHA = $(git rev-parse --short HEAD)\n$CURRENT_VERSION = get-content VERSION\n$VERSION_STRING = $CURRENT_VERSION + \"+\" + $CURRENT_SHA\n$DATE = Get-Date -uformat \"%Y-%m-%dT%H:%M:%S+00:00\"\n\n$VERSION_STRING | Out-File -Encoding \"UTF8\" $VERSION_FILE\n$DATE | Out-File -Encoding \"UTF8\" $BUILT_AT_FILE\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Test script to invoke a Mozilla HTTP Observatory Scan\n"
},
{
"from": "gpt",
"value": "<#\n .SYNOPSIS\n Invoke a Mozilla HTTP Observatory scan and wait for the scan to complete\n\n .PARAMETER Hostname\n The Hostname of the website to scan, e.g. 'www.mozilla.org'\n\n .PARAMETER Rescan\n Set this switch to force a Rescan\n\n .DESCRIPTION\n See https://github.com/mozilla/http-observatory/blob/master/httpobs/docs/api.md for more information. \n By default, the HTTP Observatory will return a cached site result if the site has been scanned anytime \n in the previous 24 hours. Regardless of the value of rescan, a site can not be scanned at a frequency \n greater than every three minutes.\n#>\n[CmdletBinding()]\nparam (\n [string] $Hostname,\n [switch] $Rescan\n)\n\n$ErrorActionPreference = 'Stop'\n\n$Endpoint = 'https://http-observatory.security.mozilla.org/api/v1'\n\nif ($Rescan){\n $rescanParam = 'true'\n} else {\n $rescanParam = 'false'\n}\n\n$params = @{ hidden = 'true'; rescan = $rescanParam }\n$url = \"$Endpoint/analyze?host=$Hostname\"\n\nWrite-Output \"POST $url\"\n$scan = Invoke-RestMethod -Method Post -Uri $url -Body $params\n\nWrite-Output $scan\n\nif ($scan.error -ne $null) {\n throw $scan.error\n}\n\nwhile ($scan.state -ne 'FINISHED') {\n Write-Output \"Waiting 5 seconds...\"\n Start-Sleep -Seconds 5\n Write-Output \"GET $url\"\n $scan = Invoke-RestMethod -Method Get -Uri $url\n\n Write-Output $scan\n}\n\n# Anything lower than a 'B' is a fail\nif ($scan.grade -notin ('B', 'B+', 'A-', 'A', 'A+')) {\n throw \"HTTP Observatory Test failed. Grade = $($scan.grade)\"\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix typo in test project name.\n"
},
{
"from": "human",
"value": "Param(\n\t[switch] $Verbose\n)\n\nIf (!$Verbose) {\n\t$quietFlag = '-quiet'\n}\nElse {\n\t$quietFlag = '-appveyor'\n}\n\n$dnx = Get-Command dnx\n\nFunction Invoke-DnxTests([string] $ProjectName) {\n\t& $dnx -p \".\\test\\$ProjectName\" test $quietFlag\n}\n\nInvoke-DnxTests -ProjectName HTTPlease.Core.Tests\nInvoke-DnxTests -ProjectName HTTPlease.Formaters.Tests\n"
},
{
"from": "gpt",
"value": "Param(\n\t[switch] $Verbose\n)\n\nIf (!$Verbose) {\n\t$quietFlag = '-quiet'\n}\nElse {\n\t$quietFlag = '-appveyor'\n}\n\n$dnx = Get-Command dnx\n\nFunction Invoke-DnxTests([string] $ProjectName) {\n\t& $dnx -p \".\\test\\$ProjectName\" test $quietFlag\n}\n\nInvoke-DnxTests -ProjectName HTTPlease.Core.Tests\nInvoke-DnxTests -ProjectName HTTPlease.Formatters.Tests\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Fix a minor issue with the build script\n\n(Azure Websites deployment doesn't like Write-Host)\n"
},
{
"from": "human",
"value": "function Set-AppSetting($x, [string]$name, [string]$value) {\n $setting = $x.configuration.appSettings.add | where { $_.key -eq $name }\n if($setting) {\n $setting.value = $value\n \"Set $name = $value.\"\n } else {\n \"Unknown App Setting: $name.\"\n }\n}\n\n# Gather deployment info\npushd $env:DEPLOYMENT_SOURCE\nWrite-Host \"In Deployment Source: $(Get-Location)\"\n$Commit = git rev-parse --short HEAD\n$Branch = $env:branch\n$Date = [TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTimeOffset]::UtcNow, \"Pacific Standard Time\")\npopd\n\n# Load web.config\n$webConfigPath = Join-Path $env:DEPLOYMENT_TEMP \"web.config\"\nif(!(Test-Path $webConfigPath)) {\n throw \"Web.config not found at $webConfigPath!\"\n}\n$webConfig = [xml](cat $webConfigPath)\nSet-AppSetting $webConfig \"Gallery.ReleaseBranch\" $Branch\nSet-AppSetting $webConfig \"Gallery.ReleaseSha\" $Commit\nSet-AppSetting $webConfig \"Gallery.ReleaseTime\" ($Date.ToString(\"yyyy-MM-dd hh:mm:ss tt\") + \" Pacific\")\n$webConfig.Save($webConfigPath)"
},
{
"from": "gpt",
"value": "function Set-AppSetting($x, [string]$name, [string]$value) {\n $setting = $x.configuration.appSettings.add | where { $_.key -eq $name }\n if($setting) {\n $setting.value = $value\n \"Set $name = $value.\"\n } else {\n \"Unknown App Setting: $name.\"\n }\n}\n\n# Gather deployment info\npushd $env:DEPLOYMENT_SOURCE\n\"In Deployment Source: $(Get-Location)\"\n$Commit = git rev-parse --short HEAD\n$Branch = $env:branch\n$Date = [TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTimeOffset]::UtcNow, \"Pacific Standard Time\")\npopd\n\n# Load web.config\n$webConfigPath = Join-Path $env:DEPLOYMENT_TEMP \"web.config\"\nif(!(Test-Path $webConfigPath)) {\n throw \"Web.config not found at $webConfigPath!\"\n}\n$webConfig = [xml](cat $webConfigPath)\nSet-AppSetting $webConfig \"Gallery.ReleaseBranch\" $Branch\nSet-AppSetting $webConfig \"Gallery.ReleaseSha\" $Commit\nSet-AppSetting $webConfig \"Gallery.ReleaseTime\" ($Date.ToString(\"yyyy-MM-dd hh:mm:ss tt\") + \" Pacific\")\n$webConfig.Save($webConfigPath)"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add PowerShell script for build\n"
},
{
"from": "gpt",
"value": "Push-Location $PSScriptRoot\n\n$nuget_path = (join-path (join-path $env:LOCALAPPDATA \"Nuget\") \"nuget.exe\")\nif ((test-path (join-path $env:LOCALAPPDATA \"Nuget\")) -eq $false) {\n New-Item -Path (join-path $env:LOCALAPPDATA \"Nuget\") -ItemType Directory | Out-Null\n}\n\nif ((test-path $nuget_path) -eq $false -or [System.Version](Get-Item $nuget_path).VersionInfo.FileVersion -lt [System.Version]\"3.4.4\") {\n try {\n Invoke-WebRequest \"https://dist.nuget.org/win-x86-commandline/latest/nuget.exe\" -OutFile $nuget_path\n } catch [System.Net.WebException] {\n Write-Error \"Could not access nuget.org, aborting.\"\n exit 1\n }\n}\n\nif ((test-path .\\packages\\vswhere\\tools\\vswhere.exe -ErrorAction SilentlyContinue) -eq $false) {\n $nuget_params = 'install', 'vswhere', '-ExcludeVersion', '-OutputDirectory', 'packages'\n & $nuget_path $nuget_params\n}\n\n$ids = 'Community', 'Professional', 'Enterprise', 'BuildTools' | foreach { 'Microsoft.VisualStudio.Product.' + $_ }\n$instance = .\\packages\\vswhere\\tools\\vswhere.exe -latest -products $ids -requires 'Microsoft.Component.MSBuild' -format json `\n | convertfrom-json `\n | select-object -first 1\n\n$msbuild = join-path $instance.installationPath 'MSBuild\\15.0\\Bin\\MSBuild.exe'\nif ((test-path $msbuild) -eq $false) {\n Write-Error \"Could not find msbuild.\"\n exit 2\n}\n\n&$msbuild Cassette\\Cassette.csproj /t:Build,Pack /p:Configuration=Release /p:PackageOutputPath=..\\artifacts\n&$msbuild Cassette.Types\\Cassette.Types.csproj /t:Build,Pack /p:Configuration=Release /p:PackageOutputPath=..\\artifacts\n\nPop-Location\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update subset of approval tests\n"
},
{
"from": "human",
"value": "## This script is related to approval tests that protect developers from unintentional changes to the public API\n## If your change does change the API on purpose and you double-checked correctness of the changes you can use this script to change the \"approved\" state of the API\n## Make sure that you run the approval tests before running this script, because the tests generate *.received.txt files.\n\n$ApprovalFiles = \".\\Tests\\Approval.Tests\\ApprovedApi\\FluentAssertions\\\";\n\n## Remove current \"approved\" API \nRemove-Item \"$ApprovalFiles\\*.verified.txt\"\n\n## Copy new API from .received.txt files to .verified.txt files\n## Note that .received.txt files are ignored in git and are not part of the repository\nGet-ChildItem -Path $ApprovalFiles -Filter \"*received.txt\" | ForEach-Object {\n\t$NewName = $_.FullName -replace 'received.txt', 'verified.txt'\n\tCopy-Item $_.FullName $NewName\n}\n\nRemove-Item \"$ApprovalFiles\\*.received.txt\"\n\n"
},
{
"from": "gpt",
"value": "## This script is related to approval tests that protect developers from unintentional changes to the public API\n## If your change does change the API on purpose and you double-checked correctness of the changes you can use this script to change the \"approved\" state of the API\n## Make sure that you run the approval tests before running this script, because the tests generate *.received.txt files.\n\n$ApprovalFiles = \".\\Tests\\Approval.Tests\\ApprovedApi\\FluentAssertions\\\";\n\n## Copy new API from .received.txt files to .verified.txt files\n## Note that .received.txt files are ignored in git and are not part of the repository\nGet-ChildItem -Path $ApprovalFiles -Filter \"*received.txt\" | ForEach-Object {\n\t$NewName = $_.FullName -replace 'received.txt', 'verified.txt'\n\tMove-Item $_.FullName $NewName -Force\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Switch to latest version of Docker & base images\n"
},
{
"from": "human",
"value": "Set-ExecutionPolicy Bypass -scope Process\nInvoke-WebRequest \"https://get.docker.com/builds/Windows/x86_64/docker-1.12.0.zip\" -OutFile \"$env:TEMP\\docker-1.12.0.zip\" -UseBasicParsing\nExpand-Archive -Path \"$env:TEMP\\docker-1.12.0.zip\" -DestinationPath $env:ProgramFiles\n[Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";$env:ProgramFiles\\docker\\\", [EnvironmentVariableTarget]::Machine)\n. 'C:\\Program Files\\docker\\dockerd' --register-service -H npipe:// -H 0.0.0.0:2375 -G docker\nStart-Service Docker\n\nWrite-Host \"Installing WindowsServerCore container image...\"\n& \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/windowsservercore:10.0.14300.1030\n& \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/windowsservercore:latest\n\nif ((get-windowsfeature Hyper-V | where installed).count) {\n Write-Host \"Installing NanoServer container image...\"\n & \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/nanoserver:10.0.14300.1030\n & \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/nanoserver:latest\n\n} else {\n Write-Host \"Skipping NanoServer container image\"\n}\n"
},
{
"from": "gpt",
"value": "Set-ExecutionPolicy Bypass -scope Process\nInvoke-WebRequest \"https://master.dockerproject.org/windows/amd64/docker-1.13.0-dev.zip\" -OutFile \"$env:TEMP\\docker-1.13.0-dev.zip\" -UseBasicParsing\nExpand-Archive -Path \"$env:TEMP\\docker-1.13.0-dev.zip\" -DestinationPath $env:ProgramFiles\n[Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";$env:ProgramFiles\\docker\\\", [EnvironmentVariableTarget]::Machine)\n. 'C:\\Program Files\\docker\\dockerd' --register-service -H npipe:// -H 0.0.0.0:2375 -G docker\nStart-Service Docker\n\nWrite-Host \"Installing WindowsServerCore container image...\"\n& \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/windowsservercore:latest\n\nif ((get-windowsfeature Hyper-V | where installed).count) {\n Write-Host \"Installing NanoServer container image...\"\n & \"C:\\Program Files\\docker\\docker.exe\" pull microsoft/nanoserver:latest\n\n} else {\n Write-Host \"Skipping NanoServer container image\"\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add a script to setup Windows services\n"
},
{
"from": "gpt",
"value": "# Install the Windows Subsystem for Linux\n# https://docs.microsoft.com/en-us/windows/wsl/install-win10 )\nEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux\n\n# stop SuperFetch\nStop-Service -Force -Name \"SysMain\"; Set-Service -Name \"SysMain\" -StartupType Disabled\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Change VisualStudio15 to ISO-based install\n"
},
{
"from": "human",
"value": "\r\n$ErrorActionPreference = 'Stop';\r\n\r\n\r\n$packageName= 'VisualStudio15'\r\n$toolsDir = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\r\n$url = 'http://download.microsoft.com/download/7/e/9/7e931754-39ee-4bbf-9e31-12a193943c62/vs_enterprise.exe'\r\n$url64 = $url\r\n\r\n$packageArgs = @{\r\n packageName = $packageName\r\n unzipLocation = $toolsDir\r\n fileType = 'EXE'\r\n url = $url\r\n url64bit = $url64\r\n\r\n silentArgs\t=\t\"/Q /L `\"$($env:TEMP)\\chocolatey\\$($packageName)\\$($packageName).MsiInstall.log`\" /norestart /passive /S\"\r\n validExitCodes= @(0, 3010, 1641)\r\n\r\n softwareName = 'Microsoft Visual Studio Enterprise 15*'\r\n checksum = ''\r\n checksumType = 'md5'\r\n checksum64 = ''\r\n checksumType64= 'md5'\r\n}\r\n\r\nInstall-ChocolateyPackage @packageArgs"
},
{
"from": "gpt",
"value": "\r\n$ErrorActionPreference = 'Stop';\r\n\r\n\r\n$packageName= 'VisualStudio15'\r\n$toolsDir = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\r\n$url = \r\n$url64 = $url\r\n\r\nGet-ChocolateyWebFile 'VisualStudio15' \"$env:temp\\vs15.preview2.ent_enu.iso\" 'http://download.microsoft.com/download/f/a/5/fa54602e-9782-45d9-a410-a837da46acc3/vs15.preview2.ent_enu.iso'\r\nimdisk -a -f \"$env:temp\\vs15.preview2.ent_enu.iso\" -m \"w:\"\r\nInstall-ChocolateyInstallPackage 'VisualStudio15' 'exe' '/q' 'w:\\Setup.exe'\r\nimdisk -d -m w:"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Move installer to root project directory\n"
},
{
"from": "human",
"value": "$script = $env:APPVEYOR_BUILD_FOLDER + \"\\Build\\Tabster.nsi\"\n& \"C:\\Program Files (x86)\\NSIS\\makensis.exe\" /DAPPLICATION_VERSION=\"$env:APPVEYOR_BUILD_VERSION\" /DSOLUTION_DIRECTORY=\"$env:APPVEYOR_BUILD_FOLDER\" \"$script\""
},
{
"from": "gpt",
"value": "$script = $env:APPVEYOR_BUILD_FOLDER + \"\\Build\\Tabster.nsi\"\n& \"C:\\Program Files (x86)\\NSIS\\makensis.exe\" /DAPPLICATION_VERSION=\"$env:APPVEYOR_BUILD_VERSION\" /DSOLUTION_DIRECTORY=\"$env:APPVEYOR_BUILD_FOLDER\" \"$script\"\nMove-Item .\\*.exe .\\"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update bundler version for windows verifcation\n\nSigned-off-by: Jaymala Sinha <a04666c8f252cd920997ac90b34d2eff29d09ccc@chef.io>\n"
},
{
"from": "human",
"value": "echo \"--- system details\"\n$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'\nGet-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize\n\n# Install winrm\nwinrm quickconfig -q\n\n# Install cmake\nchoco install cmake\n$Env:path += \";C:\\Program Files\\CMake\\bin\"\n\necho $Env:path\n\nruby -v\nbundle --version\n\necho \"--- bundle install\"\nbundle install\n\necho \"+++ bundle exec rake\"\nbundle exec rake spec\n\nexit $LASTEXITCODE"
},
{
"from": "gpt",
"value": "echo \"--- system details\"\n$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'\nGet-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize\n\n# Install winrm\nwinrm quickconfig -q\n\n# Install cmake\nchoco install cmake\n$Env:path += \";C:\\Program Files\\CMake\\bin\"\n\necho $Env:path\n\ngem update bundler\n\nruby -v\nbundle --version\n\necho \"--- bundle install\"\nbundle install\n\necho \"+++ bundle exec rake\"\nbundle exec rake spec\n\nexit $LASTEXITCODE"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add source parameter to nuget\n"
},
{
"from": "human",
"value": "param([String]$key)\n\n$span = New-TimeSpan -Start 2010/1/1 -End (Get-Date)\n$version = \"beta-\" + $span.Days.ToString() + ($span.Hours * 60 + $span.Minutes).ToString(\"0000\")\n& dotnet restore\ncd .\\src\\Folke.CsTsService\n& dotnet pack --version-suffix $version\n$file = Get-Item \"bin\\Debug\\*-$version.nupkg\"\nnuget push $file.FullName $key \ncd ..\\..\n"
},
{
"from": "gpt",
"value": "param([String]$key)\n\n$span = New-TimeSpan -Start 2010/1/1 -End (Get-Date)\n$version = \"beta-\" + $span.Days.ToString() + ($span.Hours * 60 + $span.Minutes).ToString(\"0000\")\n& dotnet restore\ncd .\\src\\Folke.CsTsService\n& dotnet pack --version-suffix $version\n$file = Get-Item \"bin\\Debug\\*-$version.nupkg\"\nnuget push $file.FullName $key -Source https://api.nuget.org/v3/index.json\ncd ..\\..\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Split out admin mode tasks\n"
},
{
"from": "human",
"value": "@\"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \"iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\" && SET \"PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin\"\nSET PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin\n\nchoco install kitty 7zip virtualbox -y\n\nsetlocal\n:PROMPT\nSET /P AREYOUSURE=Do you want to install developer tools (Y/[N])?\nIF /I \"%AREYOUSURE%\" NEQ \"Y\" GOTO END\n\n\n\n\n:END\nendlocal\n"
},
{
"from": "gpt",
"value": "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force\n\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\nSET \"PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin\"\n$Env:PATH=\"$Env:PATH;$Env:ALLUSERSPROFILE\\chocolatey\\bin\"\n\nchoco install kitty 7zip virtualbox -y\n\n$Reply = Read-Host \"Do you want to install developer tools (Y/[N])?\"\n\nif ($Reply -eq \"y\" -or $Reply -eq \"Y\") {\n choco install git jdk8 ant visualstudiocode -y\n }\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Revert \"Let Jenkins download the new branch so the build doesn't blow up\"\n\nThis reverts commit 4c34a653bdfd6dd050f29de8bb381480721a507f.\n"
},
{
"from": "human",
"value": "pushd\n\n$steamData = \"C:/Steam/Data/\"\n$steamCMDPath = \"C:/Steam/steamcmd/\"\n$steamCMDZip = \"C:/Steam/steamcmd.zip\"\n\nAdd-Type -AssemblyName System.IO.Compression.FileSystem\n\nif (!(Test-Path $steamData)) {\n\tmkdir \"$steamData\"\n}\nif (!(Test-Path $steamCMDPath)) {\n\tif (!(Test-Path $steamCMDZip)) {\n\t\t(New-Object System.Net.WebClient).DownloadFile(\"https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip\", \"$steamCMDZip\");\n\t}\n\t[System.IO.Compression.ZipFile]::ExtractToDirectory($steamCMDZip, $steamCMDPath)\n}\n\ncd \"$steamData\"\n& \"$steamCMDPath/steamcmd.exe\" \"+login anonymous\" \"+force_install_dir $steamData\" \"+app_update 298740 -branch mptest -branchpassword nt7WuDw9kdvB\" \"+quit\"\n\npopd"
},
{
"from": "gpt",
"value": "pushd\n\n$steamData = \"C:/Steam/Data/\"\n$steamCMDPath = \"C:/Steam/steamcmd/\"\n$steamCMDZip = \"C:/Steam/steamcmd.zip\"\n\nAdd-Type -AssemblyName System.IO.Compression.FileSystem\n\nif (!(Test-Path $steamData)) {\n\tmkdir \"$steamData\"\n}\nif (!(Test-Path $steamCMDPath)) {\n\tif (!(Test-Path $steamCMDZip)) {\n\t\t(New-Object System.Net.WebClient).DownloadFile(\"https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip\", \"$steamCMDZip\");\n\t}\n\t[System.IO.Compression.ZipFile]::ExtractToDirectory($steamCMDZip, $steamCMDPath)\n}\n\ncd \"$steamData\"\n& \"$steamCMDPath/steamcmd.exe\" \"+login anonymous\" \"+force_install_dir $steamData\" \"+app_update 298740\" \"+quit\"\n\npopd"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Change the integration tests to import the module\n"
},
{
"from": "human",
"value": "param\n(\n [Parameter(Mandatory = $true)]\n [String]\n $ConfigurationName\n)\n\nConfiguration $ConfigurationName\n{\n param\n (\n [Parameter(Mandatory = $true)]\n [ValidateNotNullOrEmpty()]\n [System.String]\n $DestinationPath,\n\n [Parameter(Mandatory = $true)]\n [ValidateNotNullOrEmpty()]\n [System.String]\n $SourcePath\n )\n\n xFileUpload UploadFileOrFolder\n {\n DestinationPath = $DestinationPath\n SourcePath = $SourcePath\n }\n}\n"
},
{
"from": "gpt",
"value": "param\n(\n [Parameter(Mandatory = $true)]\n [String]\n $ConfigurationName\n)\n\nConfiguration $ConfigurationName\n{\n param\n (\n [Parameter(Mandatory = $true)]\n [ValidateNotNullOrEmpty()]\n [System.String]\n $DestinationPath,\n\n [Parameter(Mandatory = $true)]\n [ValidateNotNullOrEmpty()]\n [System.String]\n $SourcePath\n )\n\n Import-DscResource -ModuleName 'xPSDesiredStateConfiguration'\n\n xFileUpload UploadFileOrFolder\n {\n DestinationPath = $DestinationPath\n SourcePath = $SourcePath\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add a commit to test\n"
},
{
"from": "human",
"value": "Write-Host \"Writing .npmrc with token\"\nSet-Content -Path \".npmrc\" -Value \"registry=https://devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/\"\nAdd-Content -Path \".npmrc\" -Value \"always-auth=true\"\nAdd-Content -Path \".npmrc\" -Value \"; begin auth token\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:username=devdiv\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:email=npm requires email to be set but doesn't use the value\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:username=devdiv\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:email=npm requires email to be set but doesn't use the value\"\nAdd-Content -Path \".npmrc\" -Value \"; end auth token\""
},
{
"from": "gpt",
"value": "Write-Host \"Writing .npmrc with token from environment\"\nSet-Content -Path \".npmrc\" -Value \"registry=https://devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/\"\nAdd-Content -Path \".npmrc\" -Value \"always-auth=true\"\nAdd-Content -Path \".npmrc\" -Value \"; begin auth token\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:username=devdiv\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/registry/:email=npm requires email to be set but doesn't use the value\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:username=devdiv\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:_password=$Env:MAPPED_AZURE_DEVOPS_TOKEN\"\nAdd-Content -Path \".npmrc\" -Value \"//devdiv.pkgs.visualstudio.com/_packaging/Pylance/npm/:email=npm requires email to be set but doesn't use the value\"\nAdd-Content -Path \".npmrc\" -Value \"; end auth token\""
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Add backup and roling backup options\n"
},
{
"from": "human",
"value": "Write-Host \"Ensconce - BackupHelper Loading\"\n\nFunction CleanBackups([string]$backupDir, [int]$daysToKeep)\n{\n\t$backupDate = Get-Date -Format yyyy-MM-dd_HH-mm-ss\n\t$backupPurgedate = (get-date).AddDays($daysToKeep * -1)\n\n\tif (@(Get-ChildItem $backupDir -Recurse | Where-Object { (-Not ($_.PSIsContainer)) }).Count -gt 0) {\n\t\tWrite-Host \"Remove backups in $backupDir older than $daysToKeep days\"\n\t\tGet-ChildItem -Path $backupDir -Recurse -Force | Where-Object { $_.CreationTime -lt $backupPurgedate -and (-Not ($_.PSIsContainer)) } | Remove-Item -Force\n\t}\n}\n\nWrite-Host \"Ensconce - BackupHelper Loaded\"\n$backupHelperLoaded = $true\n"
},
{
"from": "gpt",
"value": "if($deployHelpLoaded -eq $null)\n{\n\t$currentPath = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\t. $currentPath\\deployHelp.ps1\n}\n\nWrite-Host \"Ensconce - BackupHelper Loading\"\n\nFunction CleanBackupsWithDate([string]$backupDir, [int]$daysToKeep, [DateTime]$backupDate)\n{\n\t$backupPurgedate = (get-date).AddDays($daysToKeep * -1)\n\n\tif (@(Get-ChildItem $backupDir -Recurse | Where-Object { (-Not ($_.PSIsContainer)) }).Count -gt 0) {\n\t\tWrite-Host \"Remove backups in $backupDir older than $daysToKeep days\"\n\t\tGet-ChildItem -Path $backupDir -Recurse -Force | Where-Object { $_.CreationTime -lt $backupPurgedate -and (-Not ($_.PSIsContainer)) } | Remove-Item -Force\n\t}\n}\n\nFunction CleanBackups([string]$backupDir, [int]$daysToKeep)\n{\n\t$backupDate = Get-Date -Format yyyy-MM-dd_HH-mm-ss\n\tCleanBackupsWithDate $backupDir $backupDate\n}\n\nFunction CreateDatedBackup([string]$destFolder, [string]$baseName, [string[]]$sources)\n{\n\t$backupDate = Get-Date -Format yyyy-MM-dd_HH-mm-ss\n\n\tforeach($source in $sources)\n\t{\n\t\t$args += \"--backupSource\"\n\t\t$args += $source\n\t}\n\n\t$args += \"--backupDestination\"\n\t$args += \"$destFolder\\$baseName-$backupDate.zip\"\n\tensconceWithArgs $args\n}\n\nFunction Create7DayRollingDatedBackup([string]$destFolder, [string]$baseName, [string[]]$sources)\n{\n\t$backupDate = Get-Date -Format yyyy-MM-dd_HH-mm-ss\n\tCleanBackupsWithDate $destFolder 7 $backupDate\n\tCreateDatedBackup $destFolder $baseName $sources\n}\n\nWrite-Host \"Ensconce - BackupHelper Loaded\"\n$backupHelperLoaded = $true\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Set the right settings for Stroustrup.\n"
},
{
"from": "human",
"value": "# Inspired by http://eslint.org/docs/rules/brace-style#stroustrup\n@{\n IncludeRules = @(\n 'PSPlaceOpenBrace',\n 'PSPlaceCloseBrace',\n 'PSUseConsistentWhitespace',\n 'PSUseConsistentIndentation',\n 'PSAlignAssignmentStatement'\n )\n\n Rules = @{\n PSPlaceOpenBrace = @{\n Enable = $true\n OnSameLine = $false\n NewLineAfter = $true\n IgnoreOneLineBlock = $true\n }\n\n PSPlaceCloseBrace = @{\n Enable = $true\n NewLineAfter = $false\n IgnoreOneLineBlock = $true\n NoEmptyLineBefore = $false\n }\n\n PSUseConsistentIndentation = @{\n Enable = $true\n IndentationSize = 4\n }\n\n PSUseConsistentWhitespace = @{\n Enable = $true\n CheckOpenBrace = $true\n CheckOpenParen = $true\n CheckOperator = $true\n CheckSeparator = $true\n }\n\n PSAlignAssignmentStatement = @{\n Enable = $true\n CheckHashtable = $true\n }\n }\n}\n"
},
{
"from": "gpt",
"value": "# Inspired by http://eslint.org/docs/rules/brace-style#stroustrup\n@{\n IncludeRules = @(\n 'PSPlaceOpenBrace',\n 'PSPlaceCloseBrace',\n 'PSUseConsistentWhitespace',\n 'PSUseConsistentIndentation',\n 'PSAlignAssignmentStatement'\n )\n\n Rules = @{\n PSPlaceOpenBrace = @{\n Enable = $true\n OnSameLine = $true\n NewLineAfter = $true\n IgnoreOneLineBlock = $true\n }\n\n PSPlaceCloseBrace = @{\n Enable = $true\n NewLineAfter = $true\n IgnoreOneLineBlock = $true\n NoEmptyLineBefore = $false\n }\n\n PSUseConsistentIndentation = @{\n Enable = $true\n IndentationSize = 4\n }\n\n PSUseConsistentWhitespace = @{\n Enable = $true\n CheckOpenBrace = $true\n CheckOpenParen = $true\n CheckOperator = $true\n CheckSeparator = $true\n }\n\n PSAlignAssignmentStatement = @{\n Enable = $true\n CheckHashtable = $true\n }\n }\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Update build script for v.2.24 release.\n"
},
{
"from": "human",
"value": "# constants\n$version = \"2.23\"\n$driverName = \"chromedriver.exe\"\n$zipName = \"chromedriver_win32.$version.zip\"\n$downloadUrl = \"https://chromedriver.storage.googleapis.com/$version/chromedriver_win32.zip\"\n\n# move current folder to where contains this .ps1 script file.\n$scriptDir = Split-Path $MyInvocation.MyCommand.Path\npushd $scriptDir\n\n$currentPath = Convert-Path \".\"\n$zipPath = Join-Path $currentPath $zipName\n\n# download driver .zip file if not exists.\nif (-not (Test-Path \".\\$zipName\")){\n (New-Object Net.WebClient).Downloadfile($downloadurl, $zipPath)\n if (Test-Path \".\\$driverName\") { del \".\\$driverName\" }\n}\n\n# Decompress .zip file to extract driver .exe file.\nif (-not (Test-Path \".\\$driverName\")) {\n $shell = New-Object -com Shell.Application\n $zipFile = $shell.NameSpace($zipPath)\n\n $zipFile.Items() | `\n where {(Split-Path $_.Path -Leaf) -eq $driverName} | `\n foreach {\n $cuurentDir = $shell.NameSpace((Convert-Path \".\"))\n $cuurentDir.copyhere($_.Path)\n }\n sleep(2)\n}\n"
},
{
"from": "gpt",
"value": "# constants\n$version = \"2.24\"\n$driverName = \"chromedriver.exe\"\n$zipName = \"chromedriver_win32.$version.zip\"\n$downloadUrl = \"https://chromedriver.storage.googleapis.com/$version/chromedriver_win32.zip\"\n\n# move current folder to where contains this .ps1 script file.\n$scriptDir = Split-Path $MyInvocation.MyCommand.Path\npushd $scriptDir\n\n$currentPath = Convert-Path \".\"\n$zipPath = Join-Path $currentPath $zipName\n\n# download driver .zip file if not exists.\nif (-not (Test-Path \".\\$zipName\")){\n (New-Object Net.WebClient).Downloadfile($downloadurl, $zipPath)\n if (Test-Path \".\\$driverName\") { del \".\\$driverName\" }\n}\n\n# Decompress .zip file to extract driver .exe file.\nif (-not (Test-Path \".\\$driverName\")) {\n $shell = New-Object -com Shell.Application\n $zipFile = $shell.NameSpace($zipPath)\n\n $zipFile.Items() | `\n where {(Split-Path $_.Path -Leaf) -eq $driverName} | `\n foreach {\n $cuurentDir = $shell.NameSpace((Convert-Path \".\"))\n $cuurentDir.copyhere($_.Path)\n }\n sleep(2)\n}\n"
}
] |
powershell
|
chosen
|
[
{
"from": "human",
"value": "Add script for creating docker compose environment when developing in Windows\n"
},
{
"from": "gpt",
"value": "<#\n .DESCRIPTION\n Create a docker compose .env file\n#>\n$scriptPath = Split-Path -parent $PSCommandPath\n$envFilePath = \"$scriptPath\\..\\.env\"\n$getEnvCommand = Resolve-Path \"$scriptPath\\..\\lib\\killrvideo-docker-common\\get-environment.ps1\"\n\n# Base environment variables to be written\n$dockerEnv = @(\"COMPOSE_PROJECT_NAME=killrvideo\", \"COMPOSE_FILE=.\\lib\\killrvideo-docker-common\\docker-compose.yaml\")\n\n# Get the docker environment using the common script and add to array\n& \"$getEnvCommand\" |% { $dockerEnv += $_ }\n\n# We have to use .NET to do this so it gets written as UTF-8 without the BOM\n$Utf8NoBom = New-Object System.Text.UTF8Encoding($false)\n[System.IO.File]::WriteAllLines($envFilePath, $dockerEnv, $Utf8NoBom)\n$envFilePath = Resolve-Path $envFilePath\nWrite-Host \"Environment file written to $envFilePath\" "
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Remove old GitVersion env variable\n"
},
{
"from": "human",
"value": "# Params\nparam (\n [string]$Configuration = $env:Configuration,\n [string]$PrereleaseTag = $env:PrereleaseTag\n)\n\nif (-not $Configuration) {\n $Configuration = \"Release\"\n}\n\nif (-not $PrereleaseTag) {\n $PrereleaseTag = \"dev\"\n}\n\n# Download the SDK\n& ./tools/dotnet-install.ps1 -Version 1.0.0-rc4-004771 -Architecture x64\n\n# Setup\n$ErrorActionPreference = \"Stop\"\n\n# Helpers\nfunction Test-ExitCode {\n if ($LASTEXITCODE -ne 0) {\n exit $LASTEXITCODE \n }\n}\n\n# Build script\ndotnet clean\nTest-ExitCode\n\ndotnet restore\nTest-ExitCode\n\ndotnet build --configuration $Configuration\nTest-ExitCode\n\ndotnet test ./test/DataLoader.Tests/DataLoader.Tests.csproj --configuration $Configuration\nTest-ExitCode\n\ndotnet pack ./src/DataLoader/DataLoader.csproj --configuration $Configuration --no-build --include-symbols /p:PackageVersion=${GitVersion.FullSemVer}\nTest-ExitCode\n"
},
{
"from": "gpt",
"value": "# Params\nparam (\n [string]$Configuration = $env:Configuration,\n [string]$PrereleaseTag = $env:PrereleaseTag\n)\n\nif (-not $Configuration) {\n $Configuration = \"Release\"\n}\n\nif (-not $PrereleaseTag) {\n $PrereleaseTag = \"dev\"\n}\n\n# Download the SDK\n& ./tools/dotnet-install.ps1 -Version 1.0.0-rc4-004771 -Architecture x64\n\n# Setup\n$ErrorActionPreference = \"Stop\"\n\n# Helpers\nfunction Test-ExitCode {\n if ($LASTEXITCODE -ne 0) {\n exit $LASTEXITCODE \n }\n}\n\n# Build script\ndotnet clean\nTest-ExitCode\n\ndotnet restore\nTest-ExitCode\n\ndotnet build --configuration $Configuration\nTest-ExitCode\n\ndotnet test ./test/DataLoader.Tests/DataLoader.Tests.csproj --configuration $Configuration\nTest-ExitCode\n\ndotnet pack ./src/DataLoader/DataLoader.csproj --configuration $Configuration --no-build --include-symbols\nTest-ExitCode\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Switch back to choco poshgit version\n"
},
{
"from": "human",
"value": "## Development Tools - Git\n\nchoco install TortoiseGit\nchoco install github-desktop\n\nmkdir \"$($env:USERPROFILE)\\.ssh\" # Create .ssh folder for keys\n\nGet-Service -Name ssh-agent | Set-Service -StartupType Manual\n\nWrite-Output \"Installing PoshGit\"\n\nInstall-Module posh-git -Scope CurrentUser -Force -AllowClobber\n\nRefreshEnv\n\nWrite-Output \"Installing PoshGit to Profile\"\n\nAdd-PoshGitToProfile"
},
{
"from": "gpt",
"value": "## Development Tools - Git\n\nchoco install TortoiseGit\nchoco install github-desktop\n\nmkdir \"$($env:USERPROFILE)\\.ssh\" # Create .ssh folder for keys\n\nGet-Service -Name ssh-agent | Set-Service -StartupType Manual\n\nWrite-Output \"Installing PoshGit\"\n\nchoco install poshgit\n\nRefreshEnv\n\nWrite-Output \"Installing PoshGit to Profile\"\n\nAdd-PoshGitToProfile"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Remove packages directory after build\n"
},
{
"from": "human",
"value": "param(\n [string] $packageVersion = $env:PackageVersion,\n [bool] $fakeBuildRunner = $false\n)\n\n\nInvoke-Expression \".\\paket restore -f\"\n\nImport-Module -Force .\\PowershellDSCWorkflow.psm1\nImport-Module -Force .\\packages\\Plaster\\Plaster.psm1\n\nExport-DSCModule -Version $packageVersion\n"
},
{
"from": "gpt",
"value": "param(\n [string] $packageVersion = $env:PackageVersion,\n [bool] $fakeBuildRunner = $false\n)\n\n\nInvoke-Expression \".\\paket restore -f\"\n\nImport-Module -Force .\\PowershellDSCWorkflow.psm1\nImport-Module -Force .\\packages\\Plaster\\Plaster.psm1\n\nExport-DSCModule -Version $packageVersion\nRemove-Item -Recurse .\\packages\n"
}
] |
powershell
|
chosen
|
[
{
"from": "system",
"value": "Move building and pushing image to Jenkins plugin\n"
},
{
"from": "human",
"value": "# Build turbobrowsers/block-ad-routes image\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# update routes.txt file\n& turbo build --overwrite \"$PsScriptRoot\\extract_routes.me\" --mount $PsScriptRoot=C:\\mount\n& turbo rmi extract_routes\n\n# build block-ad-routes image\n& turbo build --overwrite --route-file=\"$PsScriptRoot\\routes.txt\" \"$PsScriptRoot\\turbo.me\"\n& turbo config --hub=stage.turbo.net\n& turbo push turbobrowsers/block-ad-routes\n& turbo config --hub=turbo.net\n& turbo push turbobrowsers/block-ad-routes"
},
{
"from": "gpt",
"value": "# Build turbobrowsers/block-ad-routes image\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# update routes.txt file\n& turbo build --overwrite \"$PsScriptRoot\\extract_routes.me\" --mount $PsScriptRoot=C:\\mount\n& turbo rmi extract_routes"
}
] |
powershell
|
chosen
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.