conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add /p:TargetVSIXContainer to tools build script" }, { "from": "human", "value": "Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1' -OutFile .\\build\\dotnet-install.ps1\n.\\build\\dotnet-install.ps1 -channel Current -version 2.1.3 -InstallDir dotnetsdk\ndotnet --version\ndotnet pack Blazor.sln --configuration Release\ncmd /c \"C:\\Program Files (x86)\\Microsoft Visual Studio\\aspnetci\\Enterprise\\MSBuild\\15.0\\Bin\\MSBuild.exe\" BlazorTooling.sln /t:Restore\ncmd /c \"C:\\Program Files (x86)\\Microsoft Visual Studio\\aspnetci\\Enterprise\\MSBuild\\15.0\\Bin\\MSBuild.exe\" BlazorTooling.sln /p:DeployExtension=false\n" }, { "from": "gpt", "value": "Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1' -OutFile .\\build\\dotnet-install.ps1\n.\\build\\dotnet-install.ps1 -channel Current -version 2.1.3 -InstallDir dotnetsdk\ndotnet --version\ndotnet pack Blazor.sln --configuration Release\ncmd /c \"C:\\Program Files (x86)\\Microsoft Visual Studio\\aspnetci\\Enterprise\\MSBuild\\15.0\\Bin\\MSBuild.exe\" BlazorTooling.sln /t:Restore\ncmd /c \"C:\\Program Files (x86)\\Microsoft Visual Studio\\aspnetci\\Enterprise\\MSBuild\\15.0\\Bin\\MSBuild.exe\" BlazorTooling.sln /p:DeployExtension=false /p:TargetVSIXContainer=..\\..\\artifacts\\build\\Microsoft.VisualStudio.BlazorExtension.vsix\n" } ]
powershell
chosen
[ { "from": "system", "value": "Check for clean tree and add commit for Windows\n" }, { "from": "human", "value": "# creates a .zip file with the file structure to run UVa-ITS-gopherbot\n\n$version = \"\" + (Select-String -Path .\\bot\\bot.go -pattern \"var Version = \") \n\n$Start = $version.IndexOf('\"')\n$end = $version.LastIndexOf('\"')\n\n$version = $version.Substring($start + 1, $end - $start - 1)\n\nWrite-Output \"Building for Windows 64bit\"\ngo build\n\n$fileName = \"gopherbot-\" + $version + \"-windows-amd64.zip\"\n\n$list = \"gopherbot.exe\", \"LICENSE\", \"README.md\", \".\\brain\", \".\\conf\", \".\\doc\", \".\\example.gopherbot\", \".\\lib\", \".\\licenses\", \".\\misc\", \".\\plugins\" \n\nWrite-Output \"Creating archive $filename\"\nCompress-Archive -path $list -DestinationPath $fileName -force" }, { "from": "gpt", "value": "# creates a .zip file with the file structure to run UVa-ITS-gopherbot\n\n[String]$clean = git status | select-string -pattern \"nothing to commit, working tree clean\"\nif ( $clean -eq \"\" ) {\n write-output \"Your working tree isn't clean, aborting build\"\n exit 1\n}\n\n$version = \"\" + (Select-String -Path .\\bot\\bot.go -pattern \"var Version = \")\n\n$Start = $version.IndexOf('\"')\n$end = $version.LastIndexOf('\"')\n\n$version = $version.Substring($start + 1, $end - $start - 1)\n[String]$commit = git log -1 | select-string -pattern \"commit \"\n$commit = $commit.split(\" \")[1]\n$gofile = @\"\npackage bot\n\nfunc init(){\n\tcommit=\"$commit\"\n}\n\"@\n\nWrite-Output \"Building for Windows 64bit\"\ngo build\n\n$fileName = \"gopherbot-\" + $version + \"-windows-amd64.zip\"\n\n$list = \"gopherbot.exe\", \"LICENSE\", \"README.md\", \".\\brain\", \".\\conf\", \".\\doc\", \".\\example.gopherbot\", \".\\lib\", \".\\licenses\", \".\\misc\", \".\\plugins\"\n\nWrite-Output \"Creating archive $filename\"\nCompress-Archive -path $list -DestinationPath $fileName -force\n" } ]
powershell
chosen
[ { "from": "system", "value": "Upgrade to Dolphin VM 7.0.28\n\nFixes part of issue #238 (the more impactful empty block case). The actual\nfix is in the compiler.\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.27\"\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.28\"\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 run code formatter\n" }, { "from": "gpt", "value": "$codeFormatterDownloadUri = \"https://github.com/dotnet/codeformatter/releases/download/v1.0.0-alpha6/CodeFormatter.zip\"\n$codeFormatterDownloadLocation = \"$env:TEMP\\code-formatter.zip\"\n$codeFormatterExtractLocation = \"$env:TEMP\\code-formatter\\\"\n\n# Check that there are no outstanding changes as we will use git status to test if CodeFormatter applied any changes\nWrite-Host \"Checking for changes...\"\n$gitOutput = $(git status)\n$gitHasChanges = ($gitOutput | ?{ $_.Contains(\"nothing to commit\") } | measure).Count -eq 0 # counts lines with \"nothing to commit\" message\nif($gitHasChanges)\n{\n Write-Error \"Outstanding changes to workspace (before code formatting) - aborting!\"\n git status\n exit 10\n}\nWrite-Host \"No changes, downloading CodeFormatter...\"\n\n# Download CodeFormatter\n(New-Object Net.WebClient).DownloadFile($codeFormatterDownloadUri, $codeFormatterDownloadLocation)\nExpand-Archive -Path $codeFormatterDownloadLocation -DestinationPath $codeFormatterExtractLocation -Force\n\n# Run CodeFormatter\nWrite-Host \"Running CodeFormatter...\"\n&\"$codeFormatterExtractLocation\\CodeFormatter\\CodeFormatter.exe\" code-formatter.csproj /copyright:code-formatter.license.txt\n\n# Check for changes, i.e. did CodeFormatter make changes?\nWrite-Host \"Checking for changes...\"\ngit add -A | out-null # add all files as this avoids changes due to CRLF/LF issues (providing we're set up to normalize to LF)\n$gitOutput = $(git status)\n$gitHasChanges = ($gitOutput | ?{ $_.Contains(\"nothing to commit\") } | measure).Count -eq 0 # counts lines with \"nothing to commit\" message\nif($gitHasChanges)\n{\n Write-Error \"Outstanding changes to workspace - aborting!\"\n Write-Error \"Run CodeFormatter and resubmit the pull request\"\n git status\n git diff\n exit 20\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Change AppVeyor Node version to 5.10.0\n" }, { "from": "human", "value": "$client = New-Object System.Net.WebClient\n\n# Install PHP\n$phpUrl = \"http://windows.php.net/downloads/releases/$env:PHP.zip\"\nWrite-Output \"Downloading $phpUrl\"\n$client.DownloadFile($phpUrl, (Join-Path $PWD 'php.zip'))\n7z e php.zip -ophp\nRename-Item .\\php\\php.ini-development php.ini\n$env:PATH += ';' + (Join-Path $PWD 'php')\n\n# Install XDebug\n$xdebugUrl = \"https://xdebug.org/files/$env:XDEBUG.dll\"\nWrite-Output \"Downloading $xdebugUrl\"\n$xdebugPath = Join-Path $PWD 'php\\ext\\xdebug.dll'\n$client.DownloadFile($xdebugUrl, $xdebugPath)\nAdd-Content .\\php\\php.ini @\"\nextension_dir=ext\nzend_extension=$xdebugPath\nxdebug.remote_enable=1\nxdebug.remote_autostart=1\n\"@\n\n# Install Node\nWrite-Output 'Installing Node'\nInstall-Product node 4.1.1 x64\nnpm config -g set progress=false\nnpm config -g set unicode=false\nnpm install -g typings\n\n# Install dependencies\nWrite-Output 'Installing dependencies'\nnpm install\ntypings install\n" }, { "from": "gpt", "value": "$client = New-Object System.Net.WebClient\n\n# Install PHP\n$phpUrl = \"http://windows.php.net/downloads/releases/$env:PHP.zip\"\nWrite-Output \"Downloading $phpUrl\"\n$client.DownloadFile($phpUrl, (Join-Path $PWD 'php.zip'))\n7z e php.zip -ophp\nRename-Item .\\php\\php.ini-development php.ini\n$env:PATH += ';' + (Join-Path $PWD 'php')\n\n# Install XDebug\n$xdebugUrl = \"https://xdebug.org/files/$env:XDEBUG.dll\"\nWrite-Output \"Downloading $xdebugUrl\"\n$xdebugPath = Join-Path $PWD 'php\\ext\\xdebug.dll'\n$client.DownloadFile($xdebugUrl, $xdebugPath)\nAdd-Content .\\php\\php.ini @\"\nextension_dir=ext\nzend_extension=$xdebugPath\nxdebug.remote_enable=1\nxdebug.remote_autostart=1\n\"@\n\n# Install Node\nWrite-Output 'Installing Node'\nInstall-Product node 5.10.0 x64\nnpm config -g set progress=false\nnpm config -g set unicode=false\nnpm install -g typings\n\n# Install dependencies\nWrite-Output 'Installing dependencies'\nnpm install\ntypings install\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix xunit path in opencover args\n" }, { "from": "human", "value": "\"PR: '$env:APPVEYOR_PULL_REQUEST_NUMBER'\"\nif($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) {\n OpenCover.Console.exe -register:user -filter:\"+[ScriptCs.ComponentModel.Composition]*\" -excludebyattribute:*.ExcludeFromCodeCoverage* -target:\"$env:xunit20\\xunit.console.x86\" -targetargs:\"\"src\\ScriptCs.ComponentModel.Composition.Test\\bin\\Release\\ScriptCs.ComponentModel.Composition.Test.dll\" -noshadow -appveyor\" -output:coverage.xml -returntargetcode\n coveralls.net --opencover coverage.xml\n}\nelse\n{\n & \"$env:xunit20\\xunit.console.x86\" \"src\\ScriptCs.ComponentModel.Composition.Test\\bin\\Release\\ScriptCs.ComponentModel.Composition.Test.dll\" -noshadow -appveyor\n}" }, { "from": "gpt", "value": "if($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) {\n OpenCover.Console.exe -register:user -filter:\"+[ScriptCs.ComponentModel.Composition]*\" -excludebyattribute:*.ExcludeFromCodeCoverage* -target:\"$env:xunit20\\xunit.console.x86.exe\" -targetargs:\"\"src\\ScriptCs.ComponentModel.Composition.Test\\bin\\Release\\ScriptCs.ComponentModel.Composition.Test.dll\" -noshadow -appveyor\" -output:coverage.xml -returntargetcode\n coveralls.net --opencover coverage.xml\n}\nelse\n{\n & \"$env:xunit20\\xunit.console.x86\" \"src\\ScriptCs.ComponentModel.Composition.Test\\bin\\Release\\ScriptCs.ComponentModel.Composition.Test.dll\" -noshadow -appveyor\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix a small bug, and add some code to help debug another odd problem.\n" }, { "from": "human", "value": "param($newVersion)\r\n#\r\n# We expect to be run from a root directory! And \"$newVersion\" is \"v5.30.01\" or\r\n# similar.\r\n#\r\n\r\n#\r\n# Get a list of all packages.config files.\r\n#\r\n\r\n$allConfigfiles = Get-ChildItem -Recurse packages.config\r\n\r\nif (-not $allConfigfiles)\r\n{\r\n Write-Host \"No packages.config files found!\"\r\n}\r\n\r\n#\r\n# Find all the ROOT version numbers that are in those files.\r\n# We will replace all of them and update them to the version that\r\n# was passed in on the command line.\r\n#\r\n\r\n$oldVersions = $allConfigfiles | Get-Content | ? {$_ -match \"-(v[\\.0-9]+)\\.win32\"} | % {$Matches[1]} | Sort-Object -Unique\r\n\r\n#\r\n# We have to do this replacement in the project files as well as the\r\n# nuget files.\r\n#\r\n\r\n$projectFiles = Get-ChildItem -Recurse *.csproj,*.vcxproj\r\n$allfiles = $allConfigfiles + $projectFiles\r\n\r\n#\r\n# For each old version, update the file! :-)\r\n#\r\n\r\nforeach ($oldV in $oldVersions)\r\n{\r\n foreach ($f in $allfiles)\r\n {\r\n $newFile = Get-Content $f | % {$_ -replace $oldV, $newVersion}\r\n Write-Host \"Updating $f\"\r\n $newFile | Set-Content $f\r\n }\r\n}" }, { "from": "gpt", "value": "param($newVersion)\r\n#\r\n# We expect to be run from a root directory! And \"$newVersion\" is \"v5.30.01\" or\r\n# similar.\r\n#\r\n\r\n#\r\n# Get a list of all packages.config files.\r\n#\r\n\r\n$allConfigfiles = Get-ChildItem -Recurse packages.config\r\n\r\nls\r\nif (-not $allConfigfiles)\r\n{\r\n Write-Host \"No packages.config files found!\"\r\n return\r\n}\r\n\r\n#\r\n# Find all the ROOT version numbers that are in those files.\r\n# We will replace all of them and update them to the version that\r\n# was passed in on the command line.\r\n#\r\n\r\n$oldVersions = $allConfigfiles | Get-Content | ? {$_ -match \"-(v[\\.0-9]+)\\.win32\"} | % {$Matches[1]} | Sort-Object -Unique\r\n\r\n#\r\n# We have to do this replacement in the project files as well as the\r\n# nuget files.\r\n#\r\n\r\n$projectFiles = Get-ChildItem -Recurse *.csproj,*.vcxproj\r\n$allfiles = $allConfigfiles + $projectFiles\r\n\r\n#\r\n# For each old version, update the file! :-)\r\n#\r\n\r\nforeach ($oldV in $oldVersions)\r\n{\r\n foreach ($f in $allfiles)\r\n {\r\n $newFile = Get-Content $f | % {$_ -replace $oldV, $newVersion}\r\n Write-Host \"Updating $f\"\r\n $newFile | Set-Content $f\r\n }\r\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix module reloading where cmdlets are unloaded but types not\n" }, { "from": "human", "value": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\n# Add the relevant binary module\ntry\n{\n $null = [Microsoft.PowerShell.CrossCompatibility.Commands.NewPSCompatibilityProfileCommand]\n $compatibilityLoaded = $true\n}\ncatch\n{\n $compatibilityLoaded = $false\n}\nif (-not $compatibilityLoaded)\n{\n if ($PSVersionTable.PSVersion.Major -ge 6)\n {\n Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll'))\n }\n else\n {\n Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll'))\n }\n}" }, { "from": "gpt", "value": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n\n# Add the relevant binary module\nif ($PSVersionTable.PSVersion.Major -ge 6)\n{\n Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll'))\n}\nelse\n{\n Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll'))\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Swap usage of share name and id for consistent behavior\n" }, { "from": "human", "value": "# The names of the user are language dependent!\r\n$objSID = New-Object System.Security.Principal.SecurityIdentifier(\"S-1-1-0\")\r\n$objUser = $objSID.Translate([System.Security.Principal.NTAccount])\r\n\r\n$grant = \"$objUser,Full\"\r\n\r\nfor ($i=0; $i -le $args.length; $i = $i + 3) {\r\n $path = $args[$i]\r\n $share_name = $args[$i+1]\r\n $share_id = $args[$i+2]\r\n\r\n\r\n if ($path -eq $null) {\r\n Write-Warning \"empty path argument encountered - complete\"\r\n exit 0\r\n }\r\n\r\n if ($share_name -eq $null) {\r\n Write-Output \"share path: ${path}\"\r\n Write-Error \"error - no share name provided\"\r\n exit 1\r\n }\r\n\r\n if ($share_id -eq $null) {\r\n Write-Output \"share path: ${path}\"\r\n Write-Error \"error - no share ID provided\"\r\n exit 1\r\n }\r\n\r\n $result = net share $share_name=$path /unlimited /GRANT:$grant /REMARK:\"${share_id}\"\r\n if ($LastExitCode -ne 0) {\r\n $host.ui.WriteLine(\"share path: ${path}\")\r\n $host.ui.WriteErrorLine(\"error ${result}\")\r\n exit 1\r\n }\r\n}\r\nexit 0\r\n" }, { "from": "gpt", "value": "# The names of the user are language dependent!\r\n$objSID = New-Object System.Security.Principal.SecurityIdentifier(\"S-1-1-0\")\r\n$objUser = $objSID.Translate([System.Security.Principal.NTAccount])\r\n\r\n$grant = \"$objUser,Full\"\r\n\r\nfor ($i=0; $i -le $args.length; $i = $i + 3) {\r\n $path = $args[$i]\r\n $share_name = $args[$i+1]\r\n $share_id = $args[$i+2]\r\n\r\n\r\n if ($path -eq $null) {\r\n Write-Warning \"empty path argument encountered - complete\"\r\n exit 0\r\n }\r\n\r\n if ($share_name -eq $null) {\r\n Write-Output \"share path: ${path}\"\r\n Write-Error \"error - no share name provided\"\r\n exit 1\r\n }\r\n\r\n if ($share_id -eq $null) {\r\n Write-Output \"share path: ${path}\"\r\n Write-Error \"error - no share ID provided\"\r\n exit 1\r\n }\r\n\r\n $result = net share $share_id=$path /unlimited /GRANT:$grant /REMARK:\"${share_name}\"\r\n if ($LastExitCode -ne 0) {\r\n $host.ui.WriteLine(\"share path: ${path}\")\r\n $host.ui.WriteErrorLine(\"error ${result}\")\r\n exit 1\r\n }\r\n}\r\nexit 0\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Set PSReadLine edit mode to Emacs\n" }, { "from": "human", "value": "function prompt {\n $location = ([string]$(get-location)).Replace($HOME, '~')\n \"$location |-/ \"\n}\n\nSet-Alias g git\n\nfunction e {\n emacsclient --alternate-editor=\"\" $Args\n}\n\n$local = \"$PSScriptRoot/profile_local.ps1\"\n(Test-Path $local) -And (. $local) > $null\n" }, { "from": "gpt", "value": "if (Get-Module PSReadLine) {\n Set-PSReadLineOption -EditMode Emacs\n}\n\nfunction prompt {\n $location = ([string]$(get-location)).Replace($HOME, '~')\n \"$location |-/ \"\n}\n\nSet-Alias g git\n\nfunction e {\n emacsclient --alternate-editor=\"\" $Args\n}\n\n$local = \"$PSScriptRoot/profile_local.ps1\"\n(Test-Path $local) -And (. $local) > $null\n" } ]
powershell
chosen
[ { "from": "system", "value": "Upgrade to 7.0.43 VM build for new stubs without insecure CRT 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.42\"\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.43\"\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": "Improve script to create linux machine\n" }, { "from": "human", "value": "param(\n [string]$name\n)\n\nif (! $name) {\n $name = \"dev\"\n}\n\n# create a virtual switch\nNew-VMSwitch -NetAdapterInterfaceDescription \"vmxnet3 Ethernet Adapter\" -Name \"docker\"\n\n# create a Hyper-V Linux docker machine\ndocker-machine -D create -d hyperv --hyperv-virtual-switch \"docker\" $name\n\n# known issues\n# https://github.com/docker/machine/issues/2267\n# https://github.com/docker/machine/issues/2362\n# workaround: https://github.com/docker/machine/issues/2267#issuecomment-156426874\ndocker-machine start $name\ndocker-machine regenerate-certs -f $name\n\n# windows docker client has different API version\n# workaround: update the docker engine in the Hyper-V Linux docker machine\ndocker-machine ssh $name sudo /etc/init.d/docker stop\ndocker-machine ssh $name sudo curl -o /usr/local/bin/docker https://master.dockerproject.org/linux/amd64/docker\ndocker-machine ssh $name sudo /etc/init.d/docker start\n" }, { "from": "gpt", "value": "param(\n [string]$name\n)\n\nif (! $name) {\n $name = \"dev\"\n}\n\n# ensure that we are running as administrator\nif (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] \"Administrator\")) {#\n Start-Process powershell.exe \"-NoProfile -ExecutionPolicy Bypass -File `\"$PSCommandPath`\" -Name $name\" -Verb RunAs; exit\n}\n\n# create a virtual switch\nif (((Get-VMSwitch).name | grep docker) -ne \"docker\") {\n $description=(Get-NetAdapter).InterfaceDescription | grep -v Hyper-V\n New-VMSwitch -NetAdapterInterfaceDescription $description -Name \"docker\"\n\n Write-Host \"Waiting for internet connectivity\"\n Sleep 15\n}\n\n# create a Hyper-V Linux docker machine\ndocker-machine create -d hyperv --hyperv-virtual-switch \"docker\" $name\n\n# known issues\n# https://github.com/docker/machine/issues/2267\n# https://github.com/docker/machine/issues/2362\n# workaround: https://github.com/docker/machine/issues/2267#issuecomment-156426874\ndocker-machine start $name\ndocker-machine regenerate-certs -f $name\n\n# windows docker client has different API version\n# workaround: update the docker engine in the Hyper-V Linux docker machine\ndocker-machine ssh $name sudo /etc/init.d/docker stop\ndocker-machine ssh $name sudo curl -o /usr/local/bin/docker https://master.dockerproject.org/linux/amd64/docker\ndocker-machine ssh $name sudo /etc/init.d/docker start\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add sl functions as aliases\n" }, { "from": "human", "value": "sal gh help\n\nfunction prompt {\n\t$Host.UI.RawUI.WindowTitle = \"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($NestedPromptLevel + 1))\"\n\treturn 'PS> '\n}\n" }, { "from": "gpt", "value": "sal gh help\nfunction sl.. { sl .. }\nfunction sl~ { sl ~ }\n\nfunction prompt {\n\t$Host.UI.RawUI.WindowTitle = \"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($NestedPromptLevel + 1))\"\n\treturn 'PS> '\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Disable Unicode for NPM in AppVeyor\n" }, { "from": "human", "value": "$OutputEncoding = [Text.Encoding]::UTF8\n\n$client = New-Object System.Net.WebClient\n\n# Install PHP\n$phpUrl = \"http://windows.php.net/downloads/releases/$env:PHP.zip\"\nWrite-Output \"Downloading $phpUrl\"\n$client.DownloadFile($phpUrl, (Join-Path $PWD 'php.zip'))\n7z e php.zip -ophp\nRename-Item .\\php\\php.ini-development php.ini\n$env:PATH += ';' + (Join-Path $PWD 'php')\n\n# Install XDebug\n$xdebugUrl = \"https://xdebug.org/files/$env:XDEBUG.dll\"\nWrite-Output \"Downloading $xdebugUrl\"\n$xdebugPath = Join-Path $PWD 'php\\ext\\xdebug.dll'\n$client.DownloadFile($xdebugUrl, $xdebugPath)\nAdd-Content .\\php\\php.ini @\"\nextension_dir=ext\nzend_extension=$xdebugPath\nxdebug.remote_enable=1\nxdebug.remote_autostart=1\n\"@\n\n# Install Node\nWrite-Output 'Installing Node'\nInstall-Product node 4.1.1 x64\nnpm install -g typings --no-progress\n\n# Install dependencies\nWrite-Output 'Installing dependencies'\nnpm install --no-progress\ntypings install\n" }, { "from": "gpt", "value": "$client = New-Object System.Net.WebClient\n\n# Install PHP\n$phpUrl = \"http://windows.php.net/downloads/releases/$env:PHP.zip\"\nWrite-Output \"Downloading $phpUrl\"\n$client.DownloadFile($phpUrl, (Join-Path $PWD 'php.zip'))\n7z e php.zip -ophp\nRename-Item .\\php\\php.ini-development php.ini\n$env:PATH += ';' + (Join-Path $PWD 'php')\n\n# Install XDebug\n$xdebugUrl = \"https://xdebug.org/files/$env:XDEBUG.dll\"\nWrite-Output \"Downloading $xdebugUrl\"\n$xdebugPath = Join-Path $PWD 'php\\ext\\xdebug.dll'\n$client.DownloadFile($xdebugUrl, $xdebugPath)\nAdd-Content .\\php\\php.ini @\"\nextension_dir=ext\nzend_extension=$xdebugPath\nxdebug.remote_enable=1\nxdebug.remote_autostart=1\n\"@\n\n# Install Node\nWrite-Output 'Installing Node'\nInstall-Product node 4.1.1 x64\nnpm config -g set progress=false\nnpm config -g set unicode=false\nnpm install -g typings\n\n# Install dependencies\nWrite-Output 'Installing dependencies'\nnpm install\ntypings install\n" } ]
powershell
chosen
[ { "from": "system", "value": "Implement Restore Git Remote task\n" }, { "from": "human", "value": "[cmdletbinding()]\nparam(\n [string]$remoteName\n)\n\nWrite-Verbose \"Entering script RestoreGitRemote.ps1\"\nWrite-Verbose \"Parameter Values\"\nforeach($key in $PSBoundParameters.Keys)\n{\n Write-Verbose ($key + ' = ' + $PSBoundParameters[$key])\n}\n\nif(!$remoteName)\n{\n throw (\"RemoteName parameter must be set.\")\n}\n\nWrite-Verbose \"Leaving script RestoreGitRemote.ps1\"" }, { "from": "gpt", "value": "[cmdletbinding()]\nparam(\n [string]$remoteName\n)\n\nWrite-Verbose \"Entering script RestoreGitRemote.ps1\"\nWrite-Verbose \"Parameter Values\"\nforeach($key in $PSBoundParameters.Keys)\n{\n Write-Verbose ($key + ' = ' + $PSBoundParameters[$key])\n}\n\nif(!$remoteName)\n{\n throw (\"RemoteName parameter must be set.\")\n}\n\nimport-module \"Microsoft.TeamFoundation.DistributedTask.Task.Common\"\n\n# Get the original remote URL from the context variable.\n$originalRemoteUrl = Get-TaskVariable -Context $distributedTaskContext -Name IOZ.GitTools.OriginalRemote.$remoteName -Global $FALSE\n\nif ([string]::IsNullOrEmpty($originalRemoteUrl) -eq $true)\n{\n throw (\"Could not find original URL of the remote '$remoteName'. Make sure you have called 'Enable Git Remote Access' Task for the remote '$remoteName' before the 'Restore Git Remote' task.\")\n}\n\ngit remote set-url $remoteName $originalRemoteUrl\nWrite-Verbose \"Updated remote for $remoteName is $originalRemoteUrl\"\n\nWrite-Verbose \"Leaving script RestoreGitRemote.ps1\"" } ]
powershell
chosen
[ { "from": "system", "value": "Remove Octopus error hack now that it breaks Octopus.\n" }, { "from": "human", "value": "$deployToolsDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif (Test-Path variable:\\OctopusParameters)\n{\n foreach($kp in $OctopusParameters.GetEnumerator())\n {\n Set-Content (\"env:\\\" + $kp.Key) ($kp.Value) -Force\n }\n}\n\nif(!(Test-Path \"env:\\ConfigOnly\"))\n{\n Set-Content \"env:\\ConfigOnly\" $false\n}\n\nfunction ensconce\n{\n if (@($input).Count -ne 0)\n {\n $input.Reset()\n $results = $input | & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n else {\n $results = & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n if ($LASTEXITCODE -ne 0)\n {\n\t Write-Host \"##teamcity[buildStatus status='FAILURE' text='{build.status.text}; Ensconce failure']\"\n\t $results\n\t exit $LASTEXITCODE\n }\n $results\n}\n\nfunction EnsurePath([string]$name)\n{\n\t$path = $name | ensconce -i\n\t\n\tif ((Test-Path $path) -eq $False)\n\t{\n\t\tmd $path\n\t}\n}\n\nfunction is64bit() {\n return ( (Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq \"64-bit\")\n}\n" }, { "from": "gpt", "value": "$deployToolsDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif (Test-Path variable:\\OctopusParameters)\n{\n foreach($kp in $OctopusParameters.GetEnumerator())\n {\n Set-Content (\"env:\\\" + $kp.Key) ($kp.Value) -Force\n }\n}\n\nif(!(Test-Path \"env:\\ConfigOnly\"))\n{\n Set-Content \"env:\\ConfigOnly\" $false\n}\n\nfunction ensconce\n{\n if (@($input).Count -ne 0)\n {\n $input.Reset()\n $results = $input | & \"$deployToolsDir\\ensconce.exe\" $args\n }\n else {\n $results = & \"$deployToolsDir\\ensconce.exe\" $args\n }\n if ($LASTEXITCODE -ne 0)\n {\n Write-Host \"##teamcity[buildStatus status='FAILURE' text='{build.status.text}; Ensconce failure']\"\n $results\n exit $LASTEXITCODE\n }\n $results\n}\n\nfunction EnsurePath([string]$name)\n{\n $path = $name | ensconce -i\n \n if ((Test-Path $path) -eq $False)\n {\n md $path\n }\n}\n\nfunction is64bit() {\n return ( (Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq \"64-bit\")\n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add script for generation of Coverity Scan upload package\n" }, { "from": "gpt", "value": "# Move to the project root folder (parent from current script folder)\n\nfunction Get-ScriptDirectory\n{ \n $Invocation = (Get-Variable MyInvocation -Scope 1).Value \n Split-Path $Invocation.MyCommand.Path \n}\n\n$rootFolder = (Get-Item (Get-ScriptDirectory)).Parent.FullName\nSet-Location $rootFolder\n\n# --- Initialization ---\n\n# Check NuGet is installed and updated\n\nIf (!(Test-Path .\\.nuget\\nuget.exe))\n{\n New-Item .\\.nuget -type directory -Force | Out-Null\n Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '.\\.nuget\\nuget.exe'\n}\n\n.\\.nuget\\NuGet.exe update -self\n\n# Install required NuGet packages\n\n.\\.nuget\\NuGet.exe install DotNetZip -OutputDirectory .\\packages -Version 1.9.3\n\n# --- Functions ---\n\nfunction Write-Zip( $sourcefiles, $zipPath )\n{\n $item = New-Item .\\artifacts\\ziptemp -type directory\n Copy-item $sourcefiles .\\artifacts\\ziptemp -Recurse\n\n $zipFullPath = Join-Path (pwd) $zipPath\n\n Add-Type -Path \".\\packages\\DotNetZip.1.9.3\\lib\\net20\\Ionic.zip.dll\"\n\n $zip = new-object Ionic.Zip.ZipFile\n $zip.AddDirectory($item.FullName)\n $zip.Save($zipFullPath)\n $zip.Dispose()\n\n Remove-Item .\\artifacts\\ziptemp -Recurse -Force\n return $zipPath\n}\n\n# --- Script ---\n\n# Clean the solution\n\n./scripts/Clean.ps1\n\n# Run the Coverity Build tool\n\n& \"C:\\Program Files\\cov-analysis-win64-7.5.0\\bin\\cov-build\" --dir artifacts\\cov-int powershell ./scripts/BuildRelease.ps1\n\n# Zip the resulting files\n\nWrite-Zip .\\artifacts\\cov-int .\\artifacts\\Okra.Data-cov-int.zip" } ]
powershell
chosen
[ { "from": "human", "value": "Add TEPP for MailAccount\nOriginally named just Account\n" }, { "from": "gpt", "value": "#region Initialize Cache\nif (-not [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"]) {\n\t[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"] = @{ }\n}\n#endregion Initialize Cache\n\n#region Tepp Data return\n$ScriptBlock = {\n param (\n $commandName,\n \n $parameterName,\n \n $wordToComplete,\n \n $commandAst,\n \n $fakeBoundParameter\n )\n \n $start = Get-Date\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"mailaccount\"].LastExecution = $start\n\t\n\t$server = $fakeBoundParameter['SqlInstance']\n\t\n\tif (-not $server) {\n\t\t$server = $fakeBoundParameter['Source']\n\t}\n\t\n\tif (-not $server) {\n\t\t$server = $fakeBoundParameter['ComputerName']\n\t}\n\t\n\tif (-not $server) { return }\n\t\n try\n {\n [DbaInstanceParameter]$parServer = $server | Select-Object -First 1\n }\n catch\n {\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"mailaccount\"].LastDuration = (Get-Date) - $start\n return\n }\n \n if ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"][$parServer.FullSmoName.ToLower()])\n {\n foreach ($name in ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"][$parServer.FullSmoName.ToLower()] | Where-DbaObject -Like \"$wordToComplete*\"))\n {\n New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name\n }\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"mailaccount\"].LastDuration = (Get-Date) - $start\n return\n }\n \n try\n {\n $serverObject = Connect-SqlInstance -SqlInstance $parServer -SqlCredential $fakeBoundParameter['SqlCredential'] -ErrorAction Stop\n foreach ($name in ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"][$parServer.FullSmoName.ToLower()] | Where-DbaObject -Like \"$wordToComplete*\"))\n {\n New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name\n }\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"mailaccount\"].LastDuration = (Get-Date) - $start\n return\n }\n catch\n {\n [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[\"mailaccount\"].LastDuration = (Get-Date) - $start\n return\n }\n}\n\nRegister-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name MailAccount\n#endregion Tepp Data return\n\n#region Update Cache\n$ScriptBlock = {\n\n\t[Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache[\"mailaccount\"][$FullSmoName] = $server.Mail.Accounts.Name\n}\nRegister-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock\n#endregion Update Cache\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix path to updatenuget script\n" }, { "from": "human", "value": "\n$currentScriptDirectory = Get-Location\n[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)\n\nSet-Location -Path ${PSScriptRoot}\n$solutiondir = Resolve-Path -Path \"$currentScriptDirectory\"\n\nWrite-Host \"Solution dir is \" $solutiondir\n\n$path = \"$solutiondir\\ReactiveDomain\\ReactiveDomain.nuspec\"\nWrite-Host \"NuSpec File is\" $path\n\n$dll = \"$solutiondir\\ReactiveDomain\\bin\\x64\\Debug\\ReactiveDomain.dll\" \nWrite-Host \"Loading dll: \" $dll\n\n$Assembly = [Reflection.Assembly]::Loadfile($dll)\n$AssemblyName = $Assembly.GetName()\n$Assemblyversion = $AssemblyName.version.ToString()\n\nWrite-Host \"Assembly version is\" $Assemblyversion\n\n#Modify the nuspec file to get the assembly version of this build\n$xml = [xml](Get-Content $path)\n$node = $xml.package.metadata\n$node.version = $Assemblyversion\n$xml.Save($path)\n\n\n\n\n\n\n\n\n" }, { "from": "gpt", "value": "\n$currentScriptDirectory = Get-Location\n[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)\n\nSet-Location -Path ${PSScriptRoot}\n$solutiondir = Resolve-Path -Path \"$currentScriptDirectory\\src\\ReactiveDomain\"\n\nWrite-Host \"Solution dir is \" $solutiondir\n\n$path = \"$solutiondir\\ReactiveDomain\\ReactiveDomain.nuspec\"\nWrite-Host \"NuSpec File is\" $path\n\n$dll = \"$solutiondir\\ReactiveDomain\\bin\\x64\\Debug\\ReactiveDomain.dll\" \nWrite-Host \"Loading dll: \" $dll\n\n$Assembly = [Reflection.Assembly]::Loadfile($dll)\n$AssemblyName = $Assembly.GetName()\n$Assemblyversion = $AssemblyName.version.ToString()\n\nWrite-Host \"Assembly version is\" $Assemblyversion\n\n#Modify the nuspec file to get the assembly version of this build\n$xml = [xml](Get-Content $path)\n$node = $xml.package.metadata\n$node.version = $Assemblyversion\n$xml.Save($path)\n\n\n\n\n\n\n\n\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix typo: installes -> installed" }, { "from": "human", "value": "#Script based on https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/visual-studio-dev-vm-chocolatey/scripts/SetupChocolatey.ps1\nparam([Parameter(Mandatory=$true)][string]$chocoPackages)\n\nWrite-Host \"File packages URL: $linktopackages\"\n\n#Changing ExecutionPolicy\nSet-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force\n\n#Change securoty protocol\n[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072\n\n# Install Choco\n$sb = { iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) }\nInvoke-Command -ScriptBlock $sb \n\n$sb = { Set-ItemProperty -path HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -name EnableLua -value 0 }\nInvoke-Command -ScriptBlock $sb \n\n#Install Chocolatey Packages\n$chocoPackages.Split(\";\") | ForEach {\n choco install $_ -y -force\n}\n\nWrite-Host \"Packages from choco.org were installes\"\n" }, { "from": "gpt", "value": "#Script based on https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/visual-studio-dev-vm-chocolatey/scripts/SetupChocolatey.ps1\nparam([Parameter(Mandatory=$true)][string]$chocoPackages)\n\nWrite-Host \"File packages URL: $linktopackages\"\n\n#Changing ExecutionPolicy\nSet-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force\n\n#Change securoty protocol\n[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072\n\n# Install Choco\n$sb = { iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) }\nInvoke-Command -ScriptBlock $sb \n\n$sb = { Set-ItemProperty -path HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System -name EnableLua -value 0 }\nInvoke-Command -ScriptBlock $sb \n\n#Install Chocolatey Packages\n$chocoPackages.Split(\";\") | ForEach {\n choco install $_ -y -force\n}\n\nWrite-Host \"Packages from choco.org were installed\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix for C++/CLI to ensure that the assembly gets removed\n" }, { "from": "human", "value": "param($installPath, $toolsPath, $package, $project)\n\n$obj = $project.Object\n$getRefsMethod = [Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCProjectShim].GetMethod(\"get_References\")\n$refs = $getRefsMethod.Invoke($obj, $null)\n$assemblyRef = $refs.Find(\"RestSharp.Portable.Encodings\")\nif ($assemblyRef -ne $NULL) {\n\t$assemblyRef.Remove();\n}\n" }, { "from": "gpt", "value": "param($installPath, $toolsPath, $package, $project)\n\n$obj = $project.Object\n$getRefsMethod = [Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCProjectShim].GetMethod(\"get_References\")\n$refs = $getRefsMethod.Invoke($obj, $null)\n$assemblyRef = $refs.Find(\"RestSharp.Portable\")\nif ($assemblyRef -ne $NULL) {\n\t$assemblyRef.Remove();\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove build step to generate .psm1\n" }, { "from": "human", "value": "$ErrorActionPreference = \"Stop\"\n\n$env:DOTNET_CLI_TELEMETRY_OPTOUT=1\ndotnet build --configuration Release PSFzf.sln\n$dllPaths = Get-ChildItem PSFzf.dll -Recurse\nif ($null -eq $dllPaths) {\n throw 'Unable to find PSFzf.dll'\n}\nCopy-Item $dllPaths[0].FullName . -Force -Verbose\n\n& (Join-Path $PSScriptRoot 'helpers' 'Join-ModuleFiles.ps1') " }, { "from": "gpt", "value": "$ErrorActionPreference = \"Stop\"\n\n$env:DOTNET_CLI_TELEMETRY_OPTOUT=1\ndotnet build --configuration Release PSFzf.sln\n$dllPaths = Get-ChildItem PSFzf.dll -Recurse\nif ($null -eq $dllPaths) {\n throw 'Unable to find PSFzf.dll'\n}\nCopy-Item $dllPaths[0].FullName . -Force -Verbose" } ]
powershell
chosen
[ { "from": "system", "value": "Update error handling in the talk preparation script\n" }, { "from": "human", "value": "param (\n [string] $yarn = 'yarn',\n [string] $RepoPath = \"$PSScriptRoot/../ForneverMind/wwwroot/talks\"\n)\n\n$ErrorActionPreference = 'Stop'\n\nfunction log($text, $header) {\n if (-not $header) {\n $header = 'Prepare-Talks'\n }\n Write-Output \"[$header] $text\"\n}\n\nfunction exec($command) {\n log \"$command $args\" 'Prepare-Talks.exec'\n & $command $args\n if (!$?) {\n throw \"[build error] $command $args = $LASTEXITCODE\"\n }\n}\n\nfunction execIgnoreStdErr($command) {\n log \"$command $args\" 'Prepare-Talks.execIgnoreStdErr'\n cmd /c \"$command $args 2>&1\"\n if (!$?) {\n throw \"[build error] $command $args = $LASTEXITCODE\"\n }\n}\n\nfunction yarnInstall($name, $flags) {\n $output = \"$RepoPath/$name\"\n Push-Location $output\n try {\n log \"Installing $name\"\n exec $yarn install $flags\n } finally {\n Pop-Location\n }\n}\n\nfunction npmInstall($name) {\n $output = \"$RepoPath/$name\"\n Push-Location $output\n try {\n log \"Installing $name\"\n execIgnoreStdErr npm install\n } finally {\n Pop-Location\n }\n}\n\nyarnInstall modern-programming --ignore-engines\nyarnInstall net-core-slides\nyarnInstall git-basics\nnpmInstall talk-javascriptservices\n" }, { "from": "gpt", "value": "param (\n [string] $yarn = 'yarn',\n [string] $RepoPath = \"$PSScriptRoot/../ForneverMind/wwwroot/talks\"\n)\n\n$ErrorActionPreference = 'Stop'\n\nfunction log($text, $header) {\n if (-not $header) {\n $header = 'Prepare-Talks'\n }\n Write-Output \"[$header] $text\"\n}\n\nfunction exec($command) {\n log \"$command $args\" 'Prepare-Talks.exec'\n & $command $args\n if ($LASTEXITCODE -ne 0) {\n throw \"[build error] $command $args = $LASTEXITCODE\"\n }\n}\n\nfunction yarnInstall($name, $flags) {\n $output = \"$RepoPath/$name\"\n Push-Location $output\n try {\n log \"Installing $name\"\n exec $yarn install $flags\n } finally {\n Pop-Location\n }\n}\n\nfunction npmInstall($name) {\n $output = \"$RepoPath/$name\"\n Push-Location $output\n try {\n log \"Installing $name\"\n exec npm install\n } finally {\n Pop-Location\n }\n}\n\nyarnInstall modern-programming --ignore-engines\nyarnInstall net-core-slides\nyarnInstall git-basics\nnpmInstall talk-javascriptservices\n" } ]
powershell
chosen
[ { "from": "system", "value": "Check version without turbo client\n" }, { "from": "human", "value": "# Extract the latest version of Turbo repository\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\nfunction Get-LatestHubVersion\n{\n [CmdletBinding()]\n param\n (\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [string] $imageToCheck,\n\n [Parameter(Mandatory=$False,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [string] $versionToCheck\n )\n process\n {\n $hubResponse = turbo releases $imageToCheck\n\n if($versionToCheck) {\n return ([string]$hubResponse) -match $versionToCheck\n }\n else {\n return $hubResponse[2]\n }\n }\n}" }, { "from": "gpt", "value": "# Extract the latest version of Turbo repository\n# \n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-2.0\n\nfunction Get-LatestHubVersion\n{\n [CmdletBinding()]\n param\n (\n [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [string] $imageToCheck,\n\n [Parameter(Mandatory=$False,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]\n [string] $versionToCheck\n )\n process\n {\n [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n $hubResponse = Invoke-WebRequest -Uri \"https://turbo.net/io/_hub/repo/$imageToCheck\"\n $tags = $hubResponse | ConvertFrom-Json | Select -expand tags\n\n if($versionToCheck) {\n return ([string]$tags[0]) -match $versionToCheck\n }\n else {\n return $tags[0]\n }\n }\n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add scan option to monitor file share permissions" }, { "from": "gpt", "value": "$all_shares = Get-WmiObject win32_LogicalShareSecuritySetting\n$shares = @()\nif($all_shares){\n foreach($s in $all_shares){\n $obj = New-Object –TypeName PSObject\n $obj | Add-Member -MemberType NoteProperty –Name Name –Value $s.name\n $ACLS = $s.GetSecurityDescriptor().Descriptor.DACL\n $permissions = @{}\n foreach($ACL in $ACLS){\n $User = $ACL.Trustee.Name\n if(!($user)){$user = $ACL.Trustee.SID}\n $Domain = $ACL.Trustee.Domain\n switch($ACL.AccessMask)\n {\n 2032127 {$Perm = \"Full Control\"}\n 1245631 {$Perm = \"Change\"}\n 1179817 {$Perm = \"Read\"}\n }\n # Write-Host \"$($s.Name) $Domain\\$user $Perm\"\n if($Domain){\n $permissions.Add(\"$($Domain)\\\\$($user)\", $Perm)\n }else{\n $permissions.Add($user, $Perm)\n }\n }\n $obj | Add-Member -MemberType NoteProperty -Name Permissions -Value $permissions\n $shares += $obj\n }\n}\n$shares\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update script to get proper incremental versions in develop branch" }, { "from": "human", "value": "$publishVersion = $Env:GitVersion_MajorMinorPatch\n\n# Regular expression pattern to find the version in the build number \n# and then apply it to the assemblies\n$versionRegex = \"\\d+\\.\\d+\\.\\d+\\.\\d+\"\n\n$vsixManifestSearchPattern = \"./source.extension.vsixmanifest\"\n$vsixManifestCollection = (Get-ChildItem $vsixManifestSearchPattern -Recurse)\n\nforeach($file in $vsixManifestCollection)\n{\n $filecontent = Get-Content($file)\n attrib $file -r\n $filecontent -replace $versionRegex, $publishVersion | Out-File $file -Encoding utf8\n \"Update version in VSIX manifest to $publishVersion\"| Write-Host -ForegroundColor White\n}\n" }, { "from": "gpt", "value": "$publishVersion = $Env:GitVersion_MajorMinorPatch+\".\"+$Env:GitVersion_PreReleaseNumber\n\n# Regular expression pattern to find the version in the build number \n# and then apply it to the assemblies\n$versionRegex = \"\\d+\\.\\d+\\.\\d+\\.\\d+\"\n\n$vsixManifestSearchPattern = \"./source.extension.vsixmanifest\"\n$vsixManifestCollection = (Get-ChildItem $vsixManifestSearchPattern -Recurse)\n\nforeach($file in $vsixManifestCollection)\n{\n $filecontent = Get-Content($file)\n attrib $file -r\n $filecontent -replace $versionRegex, $publishVersion | Out-File $file -Encoding utf8\n \"Update version in VSIX manifest to $publishVersion\"| Write-Host -ForegroundColor White\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Leverage the Module Autoload path and save doing it ourselves.\n\nThis should be faster too as we won't automatically import all functions\nto the session. Powershell now knows where to look before declaring they\ndon't exist.\n" }, { "from": "human", "value": "# Global modules directory\n$global:PsGetDestinationModulePath = $PSScriptRoot + \"\\..\\vendor\\psmodules\"\n\n# Push to modules location\nPush-Location -Path ($PsGetDestinationModulePath)\n\n# Load modules from current directory\nImport-Module .\\PsGet\\PsGet\nGet-ChildItem -Exclude \"PsGet\" -Directory -Name | Foreach-Object {\n Import-Module .\\$_\\$_\n}\n\n# Come back to PWD\nPop-Location\n\n# Set up a Cmder prompt, adding the git prompt parts inside git repos\nfunction global:prompt {\n $realLASTEXITCODE = $LASTEXITCODE\n $Host.UI.RawUI.ForegroundColor = \"White\"\n Write-Host(\"`n\" + $pwd.ProviderPath) -NoNewLine -ForegroundColor Green\n if (Get-Module posh-git) {\n Write-VcsStatus\n }\n $global:LASTEXITCODE = $realLASTEXITCODE\n Write-Host \"`nλ\" -NoNewLine -ForegroundColor \"DarkGray\"\n return \" \"\n}\n\n# Load special features come from posh-git\nif (Get-Module posh-git) {\n Enable-GitColors\n Start-SshAgent -Quiet\n}\n\n# Move to the wanted location\nif (Test-Path Env:\\CMDER_START) {\n Set-Location -Path $Env:CMDER_START\n} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {\n Set-Location -Path $Env:USERPROFILE\n}\n" }, { "from": "gpt", "value": "# Add Cmder modules directory to the autoload path.\n$CmderModulePath = Join-path $PSScriptRoot \"psmodules/\"\n\nif( -not $env:PSModulePath.Contains($CmderModulePath) ){\n $env:PSModulePath = $env:PSModulePath.Insert(0, \"$CmderModulePath;\")\n}\n\n# Set up a Cmder prompt, adding the git prompt parts inside git repos\nfunction global:prompt {\n $realLASTEXITCODE = $LASTEXITCODE\n $Host.UI.RawUI.ForegroundColor = \"White\"\n Write-Host(\"`n\" + $pwd.ProviderPath) -NoNewLine -ForegroundColor Green\n if (Get-Module posh-git) {\n Write-VcsStatus\n }\n $global:LASTEXITCODE = $realLASTEXITCODE\n Write-Host \"`nλ\" -NoNewLine -ForegroundColor \"DarkGray\"\n return \" \"\n}\n\n# Load special features come from posh-git\nif (Get-Module posh-git) {\n Enable-GitColors\n Start-SshAgent -Quiet\n}\n\n# Move to the wanted location\nif (Test-Path Env:\\CMDER_START) {\n Set-Location -Path $Env:CMDER_START\n} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {\n Set-Location -Path $Env:USERPROFILE\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update docker-compose 1.6.0, docker-machine 0.6.0\n" }, { "from": "human", "value": "# install docker tools\nchoco install -y docker-machine -version 0.5.6\nchoco install -y docker-compose -version 1.5.2\n" }, { "from": "gpt", "value": "# install docker tools\nchoco install -y docker-machine -version 0.6.0\nchoco install -y docker-compose -version 1.6.0\n" } ]
powershell
chosen
[ { "from": "system", "value": "Revert \"I don't even know anymore\"\n\nThis reverts commit 63f504feb78892038ac6ee4b134e34f93d2ad786.\n" }, { "from": "human", "value": "pushd\n\n$steamData = \"C:/Steam/DataMP/\"\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 -beta mptest -betapassword 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 +beta mptest +betapassword nt7WuDw9kdvB\" \"+quit\"\n\npopd" } ]
powershell
chosen
[ { "from": "system", "value": "Correct PSProvideDefaultParameterValue NoViolations test script\n" }, { "from": "human", "value": "function GoodFunc\n{\n param(\n [parmaeter(mandatory=$false)]\n [string]$Param1=$null\n )\n $Param1\n}" }, { "from": "gpt", "value": "function GoodFunc\n{\n param(\n [Parameter(Mandatory=$false)]\n [ValidateNotNullOrEmpty()] \n [string]\n $Param1=$null\n )\n $Param1\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix root directory generation on failed access\n" }, { "from": "human", "value": "#Requires -Modules VagrantMessages, VagrantVM\n\nparam(\n [parameter (Mandatory=$true)]\n [string] $Path\n)\n\n$check = Check-VagrantHyperVAccess -Path $Path\n$result = @{\n root_dir = ($Path -split '\\\\')[0,2] -join '\\';\n result = $check\n}\n\nWrite-OutputMessage $(ConvertTo-Json $result)\n" }, { "from": "gpt", "value": "#Requires -Modules VagrantMessages, VagrantVM\n\nparam(\n [parameter (Mandatory=$true)]\n [string] $Path\n)\n\n$check = Check-VagrantHyperVAccess -Path $Path\n$result = @{\n root_dir = ($Path -split '\\\\')[0,1] -join '\\';\n result = $check\n}\n\nWrite-OutputMessage $(ConvertTo-Json $result)\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove debug console output in test\n" }, { "from": "human", "value": ". \"$PSScriptRoot/utils/WebConfig.ps1\"\n. \"$PSScriptRoot/utils/MSBuild.ps1\"\n. \"$PSScriptRoot/utils/MSDeploy.ps1\"\n\n$fixtures = @{\n default = @{\n Solution = \"$PSScriptRoot\\fixtures/default/HelixBuild.Sample.Web.sln\";\n Project1 = \"$PSScriptRoot\\fixtures/default/Projects\\HelixBuild.Sample.Web\\HelixBuild.Sample.Web.csproj\";\n }\n \n}\n\n$count = 1\n\nDescribe \"CollectFilesFromHelixModules.Content\" {\n\n Context \"collecting helix modules for a project\" {\n $projectPath = $fixtures.default.Project1\n\n $result = Invoke-MSBuildWithOutput -Project $projectPath -TargetName \"CollectFilesFromHelixModulesContent\" -OutputItem \"FilesForPackagingFromHelixModules -> '%(DestinationRelativePath)'\"\n\n Write-Host $result\n\n It \"should include content from module projects\" {\n $result -contains \"App_Config\\Include\\HelixBuild.Feature1.config\" | Should Be $true\n }\n }\n}" }, { "from": "gpt", "value": ". \"$PSScriptRoot/utils/WebConfig.ps1\"\n. \"$PSScriptRoot/utils/MSBuild.ps1\"\n. \"$PSScriptRoot/utils/MSDeploy.ps1\"\n\n$fixtures = @{\n default = @{\n Solution = \"$PSScriptRoot\\fixtures/default/HelixBuild.Sample.Web.sln\";\n Project1 = \"$PSScriptRoot\\fixtures/default/Projects\\HelixBuild.Sample.Web\\HelixBuild.Sample.Web.csproj\";\n }\n \n}\n\n$count = 1\n\nDescribe \"CollectFilesFromHelixModules.Content\" {\n\n Context \"collecting helix modules for a project\" {\n $projectPath = $fixtures.default.Project1\n\n $result = Invoke-MSBuildWithOutput -Project $projectPath -TargetName \"CollectFilesFromHelixModulesContent\" -OutputItem \"FilesForPackagingFromHelixModules -> '%(DestinationRelativePath)'\"\n\n It \"should include content from module projects\" {\n $result -contains \"App_Config\\Include\\HelixBuild.Feature1.config\" | Should Be $true\n }\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Install Postman and NodeJS LTS\n\nThe LTS version of Node seems to be sufficient for what I do" }, { "from": "human", "value": "### Install handy tools and apps for my dev machine\n### Run this script from an administrative shell\n\nSet-ExecutionPolicy RemoteSigned\n\n# Install Chocolatey\nInvoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n# Install some software\nchoco install -y 7zip\nchoco install -y git\n#choco install -y github-desktop # Github Desktop gets updates so often that it's hard for the Chocolatey package to keep up\nchoco install -y gitkraken\nchoco install -y googlechrome\nchoco install -y hyper\nchoco install -y keepass\nchoco install -y linqpad\nchoco install -y nodejs\nchoco install -y notepadplusplus\nchoco install -y poshgit\nchoco install -y rdcman\nchoco install -y slack\nchoco install -y sql-server-management-studio\n#choco install -y toggl # The Toggl Desktop Chocolatey package is significantly behind as of May 2017, so I'll install it manually\n#choco install -y visualstudiocode # VS Code gets updates so often that it's hard for the Chocolatey package to keep up\nRefreshEnv.cmd\n" }, { "from": "gpt", "value": "### Install handy tools and apps for my dev machine\n### Run this script from an administrative shell\n\nSet-ExecutionPolicy RemoteSigned\n\n# Install Chocolatey\nInvoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n# Install some software\nchoco install -y 7zip\nchoco install -y git\n#choco install -y github-desktop # Github Desktop gets updates so often that it's hard for the Chocolatey package to keep up\nchoco install -y gitkraken\nchoco install -y googlechrome\nchoco install -y hyper\nchoco install -y keepass\nchoco install -y linqpad\nchoco install -y nodejs-lts\nchoco install -y notepadplusplus\nchoco install -y poshgit\nchoco install -y postman\nchoco install -y rdcman\nchoco install -y slack\nchoco install -y sql-server-management-studio\n#choco install -y toggl # The Toggl Desktop Chocolatey package is significantly behind as of May 2017, so I'll install it manually\n#choco install -y visualstudiocode # VS Code gets updates so often that it's hard for the Chocolatey package to keep up\nRefreshEnv.cmd\n" } ]
powershell
chosen
[ { "from": "system", "value": "feat: Add bash-like autocomplete features using PSReadline\n" }, { "from": "human", "value": "#\r\n# Install Powershell modules, if not already installed\r\n#\r\nfunction Test-Installed\r\n{\r\n $Name = $args[0]\r\n Get-Module -ListAvailable -Name $Name\r\n}\r\nif (Test-Installed posh-git) {\r\n Import-Module posh-git\r\n}\r\nif (Test-Installed oh-my-posh) {\r\n Import-Module oh-my-posh\r\n}\r\nif (Test-Installed Get-ChildItemColor) {\r\n Import-Module Get-ChildItemColor\r\n}\r\nif (Test-Installed pwsh-handy-helpers) {\r\n Import-Module pwsh-handy-helpers\r\n}\r\n#\r\n# Set Oh-my-posh theme\r\n#\r\nSet-Theme Agnoster\r\n#\r\n# Import Chocolatey profile\r\n#\r\n$ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\r\nif (Test-Path $ChocolateyProfile) {\r\n Import-Module \"$ChocolateyProfile\"\r\n}\r\n#\r\n# Directory traversal shortcuts\r\n#\r\nfor($i = 1; $i -le 5; $i++) {\r\n $u = \"\".PadLeft($i,\"u\")\r\n $d = $u.Replace(\"u\",\"../\")\r\n Invoke-Expression \"function $u { push-location $d }\"\r\n}" }, { "from": "gpt", "value": "#\r\n# Install Powershell modules, if not already installed\r\n#\r\nfunction Test-Installed\r\n{\r\n $Name = $args[0]\r\n Get-Module -ListAvailable -Name $Name\r\n}\r\nif (Test-Installed PSReadLine) {\r\n Import-Module PSReadLine\r\n Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete\r\n Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward\r\n Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward\r\n}\r\nif (Test-Installed posh-git) {\r\n Import-Module posh-git\r\n}\r\nif (Test-Installed oh-my-posh) {\r\n Import-Module oh-my-posh\r\n}\r\nif (Test-Installed Get-ChildItemColor) {\r\n Import-Module Get-ChildItemColor\r\n}\r\nif (Test-Installed pwsh-handy-helpers) {\r\n Import-Module pwsh-handy-helpers\r\n}\r\n#\r\n# Set Oh-my-posh theme\r\n#\r\nSet-Theme Agnoster\r\n#\r\n# Import Chocolatey profile\r\n#\r\n$ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\r\nif (Test-Path $ChocolateyProfile) {\r\n Import-Module \"$ChocolateyProfile\"\r\n}\r\n#\r\n# Directory traversal shortcuts\r\n#\r\nfor($i = 1; $i -le 5; $i++) {\r\n $u = \"\".PadLeft($i,\"u\")\r\n $d = $u.Replace(\"u\",\"../\")\r\n Invoke-Expression \"function $u { push-location $d }\"\r\n}" } ]
powershell
chosen
[ { "from": "human", "value": "Add basic examples using Pester\n" }, { "from": "gpt", "value": "Describe \"Basic\" {\r\n Context \"Arithmetic\" {\r\n It \"1 + 1 shoukd be 2\" {\r\n 1 + 1 | Should -Be 2\r\n }\r\n }\r\n\r\n Context \"String\" {\r\n It \"An i letter should not be in team - like\" {\r\n \"team\" | Should -Not -BeLike \"*i*\"\r\n }\r\n\r\n It \"An i letter should not be in team - match\" {\r\n \"team\" | Should -Not -Match \"i\"\r\n }\r\n }\r\n\r\n Context \"AAA Aproach\" {\r\n $stringToTest = \"team\"\r\n\r\n It \"An i letter should not be in team - like\" {\r\n $stringToTest | Should -Not -BeLike \"*i*\"\r\n }\r\n\r\n It \"An e letter should be in team - like\" {\r\n $stringToTest | Should -BeLike \"*e*\"\r\n }\r\n\r\n It \"An i letter should not be in team - match\" {\r\n $stringToTest | Should -Not -Match \"i\"\r\n }\r\n }\r\n}\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add flag for running tests in Release\n" }, { "from": "human", "value": "param([String]$Tests=\"Functional\", [switch]$Parallel, [switch]$Build);\n\n$paths = Get-ChildItem Tests -Directory | % { Join-Path $_.FullName -ChildPath (\"bin/Debug/netcoreapp2.2/$($_.Name).dll\") };\n$filter = \"\";\n$execute = \"\";\n\nif ($Tests -eq \"functional\" -or $Tests -eq \"f\")\n{\n $filter = \"--TestCaseFilter:Category=Functional\";\n}\nelseif ($Tests -eq \"performance\" -or $Tests -eq \"p\")\n{\n $filter = \"--TestCaseFilter:Category=Performance\";\n}\n\nif ($Parallel)\n{\n $execute = \"--Parallel\";\n}\n\nif ($Build)\n{\n dotnet build AppBrix.sln;\n}\n\ndotnet vstest $paths $filter $execute;\n" }, { "from": "gpt", "value": "param([String]$Tests=\"Functional\", [switch]$Parallel, [switch]$Build, [switch]$Release);\n\n$version = \"netcoreapp2.2\"\n\n$configuration = \"Debug\";\nif ($Release)\n{\n $configuration = \"Release\";\n}\n\nif ($Build)\n{\n dotnet build AppBrix.sln --configuration $($configuration);\n}\n\n$filter = \"\";\nif ($Tests -eq \"functional\" -or $Tests -eq \"f\")\n{\n $filter = \"--TestCaseFilter:Category=Functional\";\n}\nelseif ($Tests -eq \"performance\" -or $Tests -eq \"p\")\n{\n $filter = \"--TestCaseFilter:Category=Performance\";\n}\n\n$execute = \"\";\nif ($Parallel)\n{\n $execute = \"--Parallel\";\n}\n\n$paths = Get-ChildItem Tests -Directory | % { Join-Path $_.FullName -ChildPath (\"bin/$($configuration)/$($version)/$($_.Name).dll\") };\ndotnet vstest $paths $filter $execute;\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update of is64bit so it's not dependent on version of Powershell being used\n" }, { "from": "human", "value": "$deployToolsDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif (Test-Path variable:\\OctopusParameters)\n{\n foreach($kp in $OctopusParameters.GetEnumerator())\n {\n Set-Content (\"env:\\\" + $kp.Key) ($kp.Value) -Force\n }\n}\n\nif(!(Test-Path \"env:\\ConfigOnly\"))\n{\n Set-Content \"env:\\ConfigOnly\" $false\n}\n\nfunction ensconce\n{\n if (@($input).Count -ne 0)\n {\n $input.Reset()\n $results = $input | & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n else {\n $results = & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n if ($LASTEXITCODE -ne 0)\n {\n if (Test-Path env:\\TEAMCITY_VERSION)\n {\n Write-Host \"##teamcity[buildStatus status='FAILURE' text='{build.status.text}; Ensconce failure']\"\n $results\n exit $LASTEXITCODE\n }\n else {\n throw (\n\"Ensconce operation failed.\n$results\")\n }\n }\n $results\n}\n\nfunction EnsurePath([string]$name)\n{\n\t$path = $name | ensconce -i\n\t\n\tif ((Test-Path $path) -eq $False)\n\t{\n\t\tmd $path\n\t}\n}\n\nfunction is64bit() {\n return ([IntPtr]::Size -eq 8)\n}" }, { "from": "gpt", "value": "$deployToolsDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif (Test-Path variable:\\OctopusParameters)\n{\n foreach($kp in $OctopusParameters.GetEnumerator())\n {\n Set-Content (\"env:\\\" + $kp.Key) ($kp.Value) -Force\n }\n}\n\nif(!(Test-Path \"env:\\ConfigOnly\"))\n{\n Set-Content \"env:\\ConfigOnly\" $false\n}\n\nfunction ensconce\n{\n if (@($input).Count -ne 0)\n {\n $input.Reset()\n $results = $input | & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n else {\n $results = & \"$deployToolsDir\\ensconce.exe\" $args 2>&1\n }\n if ($LASTEXITCODE -ne 0)\n {\n if (Test-Path env:\\TEAMCITY_VERSION)\n {\n Write-Host \"##teamcity[buildStatus status='FAILURE' text='{build.status.text}; Ensconce failure']\"\n $results\n exit $LASTEXITCODE\n }\n else {\n throw (\n\"Ensconce operation failed.\n$results\")\n }\n }\n $results\n}\n\nfunction EnsurePath([string]$name)\n{\n\t$path = $name | ensconce -i\n\t\n\tif ((Test-Path $path) -eq $False)\n\t{\n\t\tmd $path\n\t}\n}\n\nfunction is64bit() {\n return ( (Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq \"64-bit\")\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Add Write-breakline cmdlet to utils.psm1\n" }, { "from": "human", "value": "<#\n\tMy Function\n#>\nfunction Get-Function {\n\n}" }, { "from": "gpt", "value": "\nfunction Write-Breakline () {\n\tParam(\n\t\t[string]$Title = \"\"\n\t)\n\n\t$line = \"`n----------------------------------------------------------------------\";\n\t$limit = $line.Length;\n\tif (-not [String]::IsNullOrEmpty($Title))\n\t{\n\t\t$line = $line.Insert(4, \" $Title \");\n\t\tif ($line.Length -gt $limit) { $line = $line.Substring(0, $limit); }\n\t}\n\n\tWrite-Host $line;\n\tWrite-Host \"\";\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix production image build script.\n\nPretty sure the sysinternals strings command used to take \"-q\" to turn off\nthe startup banner, now it takes \"-nobanner\". We filter the output anyway,\nso don't pass anything.\n" }, { "from": "human", "value": "[CmdletBinding()]\r\nParam(\r\n [Parameter(Position=1)]$IARRoot = \"${env:ProgramFiles(x86)}\\IAR Systems\\Embedded Workbench 7.3\"\r\n)\r\n\r\n# NOTE: Also requires the \"strings\" tool from sysinternals on your path\r\n# choco install -y sysinternals is an easy way to make that happen.\r\n\r\n$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition\r\n\r\n# Build with IAR\r\nStart-Process (Join-Path $IARRoot \"common\\bin\\IarBuild.exe\") -ArgumentList @('Project.ewp', '-build', 'Production') -WorkingDirectory $PSScriptRoot -NoNewWindow -Wait\r\n\r\n# Generate the config file by grepping for the build string in the elf file.\r\n# Couldn't find any better way to extract this from the object files or final elf file...\r\n$BuildString = (strings -q (Join-Path $PSScriptRoot 'Production\\Exe\\Project.out') | Select-String -Pattern '\\[Sensics')\r\nOut-File (Join-Path $PSScriptRoot 'Production\\Exe\\Config.txt') -InputObject $BuildString\r\n\r\nWrite-Host 'Completed build identified as:'\r\nWrite-Host $BuildString\r\nWrite-Host \"See the .hex and Config.txt files in $(Join-Path $PSScriptRoot 'Production\\Exe')\"\r\n" }, { "from": "gpt", "value": "[CmdletBinding()]\r\nParam(\r\n [Parameter(Position=1)]$IARRoot = \"${env:ProgramFiles(x86)}\\IAR Systems\\Embedded Workbench 7.3\"\r\n)\r\n\r\n# NOTE: Also requires the \"strings\" tool from sysinternals on your path\r\n# choco install -y sysinternals is an easy way to make that happen.\r\n\r\n$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition\r\n\r\n# Build with IAR\r\nStart-Process (Join-Path $IARRoot \"common\\bin\\IarBuild.exe\") -ArgumentList @('Project.ewp', '-build', 'Production') -WorkingDirectory $PSScriptRoot -NoNewWindow -Wait\r\n\r\n# Generate the config file by grepping for the build string in the elf file.\r\n# Couldn't find any better way to extract this from the object files or final elf file...\r\n$BuildString = (strings (Join-Path $PSScriptRoot 'Production\\Exe\\Project.out') | Select-String -Pattern '\\[Sensics')\r\nOut-File (Join-Path $PSScriptRoot 'Production\\Exe\\Config.txt') -InputObject $BuildString\r\n\r\nWrite-Host 'Completed build identified as:'\r\nWrite-Host $BuildString\r\nWrite-Host \"See the .hex and Config.txt files in $(Join-Path $PSScriptRoot 'Production\\Exe')\"\r\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(\"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\n# Write-Host \"Rebooting..\"\n# shutdown /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(\"C:\\Windows\\Temp\\master\").copyhere($item)\n}\n\ncd .\\master\\windows-setup-master\n\nGet-ChildItem | ForEach-Object {\n Write-Host \"Executing \" + $_.FullName\n & $_.FullName\n}\n\n# Write-Host \"Rebooting..\"\n# shutdown /r /t 0\n" } ]
powershell
chosen
[ { "from": "system", "value": "Use the registry to stop Windows Updates\n" }, { "from": "human", "value": "$mgr = New-Object -ComObject Microsoft.Update.ServiceManager -Strict\n$mgr.ClientApplicationID = \"packer\"\n$mgr.RemoveService('7971f918-a847-4430-9279-4a52d1efe18d')\n" }, { "from": "gpt", "value": "$WindowsUpdateKey = \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\"\n\n$Update_Never = 1\n$Update_Check = 2\n$Update_Download = 3\n$Update_Auto = 4\n\nSet-ItemProperty -Path $WindowsUpdateKey -Name AUOptions -Value $Update_Never -Force -Confirm:$false\nSet-ItemProperty -Path $WindowsUpdateKey -Name CachedAUOptions -Value $Update_Never -Force -Confirm:$false\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix nightly (dev) package versioning.\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}-final-${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-Information \"version:'${version}', AssemblyBaseVersion:'${AssemblyBaseVersion}', PackageVersion:'${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}-dev-{0:yy}{1:000}\" -f @( $now, $daysSpan.Days )\n\t}\n\telseif ( ${version} -match \"^[\\d.]+$\" )\n\t{\n\t\t$env:PackageVersion = \"${version}-final-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n\telse\n\t{\n\t\t$env:PackageVersion = \"${version}-dev-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n}\nelse\n{\n\t$env:PackageVersion = $version\n}\n\nWrite-Information \"version:'${version}', AssemblyBaseVersion:'${AssemblyBaseVersion}', PackageVersion:'${PackageVersion}'\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Make Jenkins download playtest branch\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\" \"+quit\"\n\npopd" }, { "from": "gpt", "value": "pushd\n\n$steamData = \"C:/Steam/Data-playtest/\"\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 -beta playtest -betapassword nt7WuDw9kdvC\" \"+quit\"\n\npopd" } ]
powershell
chosen
[ { "from": "system", "value": "Throw exception if script for patching TFS task version is called with invalid arguments.\n" }, { "from": "human", "value": "param (\n[string] $filePath,\n[string] $major,\n[string] $minor,\n[string] $patch\n)\n\n# Get the task.json as a powershell object\n$task = Get-Content -Raw -Path $filePath | ConvertFrom-Json\n\n$task.version.Major = $major\n$task.version.Minor = $minor\n$task.version.Patch = $patch\n\n# get this as a string again\n\nConvertTo-Json $task -Depth 100 | Set-Content -Path $filePath" }, { "from": "gpt", "value": "param (\n[string] $filePath,\n[string] $major,\n[string] $minor,\n[string] $patch\n)\n\nif ([string]::IsNullOrWhiteSpace($filePath)) {\n throw \"File path needs to be provided.\"\n}\n\nif ([string]::IsNullOrWhiteSpace($major)) {\n throw \"Major version number needs to be provided.\"\n}\n\nif ([string]::IsNullOrWhiteSpace($minor)) {\n throw \"Minor version number needs to be provided.\"\n}\n\nif ([string]::IsNullOrWhiteSpace($patch)) {\n throw \"Patch level needs to be provided.\"\n}\n\nWrite-Host \"Set version in '$filePath' to $major.$minor.$patch\"\n\n# Get the task.json as a powershell object\n$task = Get-Content -Raw -Path $filePath | ConvertFrom-Json\n\n$task.version.Major = $major\n$task.version.Minor = $minor\n$task.version.Patch = $patch\n\n# get this as a string again\n\nConvertTo-Json $task -Depth 100 | Set-Content -Path $filePath" } ]
powershell
chosen
[ { "from": "system", "value": "Downgrade docker version for windows to 20.10.7\n\nThe windows build failed on version 20.10.9, as that\nversion isn't available to windows. 20.10.7 is the most\nrecent availble version: [souce](https://dockermsft.azureedge.net/dockercontainer/DockerMsftIndex.json)\n" }, { "from": "human", "value": "# Stop script execution when a non-terminating error occurs\n$ErrorActionPreference = \"Stop\"\n\n$docker_version=\"20.10.9\"\n$docker_compose_version=\"1.29.2\"\n\nWrite-Output \"Upgrading DockerMsftProvider module\"\nUpdate-Module -Name DockerMsftProvider -Force\n\nWrite-Output \"Printing available docker versions\"\nFind-Package -providerName DockerMsftProvider -AllVersions\n\nWrite-Output \"Installing docker enterprise edition\"\nStop-Service docker\nInstall-Package -Name docker -ProviderName DockerMsftProvider -Force -RequiredVersion $docker_version\nStart-Service docker\n\nWrite-Output \"Installing docker-compose\"\nchoco install -y docker-compose --version $docker_compose_version\nIf ($lastexitcode -ne 0) { Exit $lastexitcode }\n\nWrite-Output \"Installing jq\"\nchoco install -y jq\nIf ($lastexitcode -ne 0) { Exit $lastexitcode }\n" }, { "from": "gpt", "value": "# Stop script execution when a non-terminating error occurs\n$ErrorActionPreference = \"Stop\"\n\n$docker_version=\"20.10.7\"\n$docker_compose_version=\"1.29.2\"\n\nWrite-Output \"Upgrading DockerMsftProvider module\"\nUpdate-Module -Name DockerMsftProvider -Force\n\nWrite-Output \"Printing available docker versions\"\nFind-Package -providerName DockerMsftProvider -AllVersions\n\nWrite-Output \"Installing docker enterprise edition\"\nStop-Service docker\nInstall-Package -Name docker -ProviderName DockerMsftProvider -Force -RequiredVersion $docker_version\nStart-Service docker\n\nWrite-Output \"Installing docker-compose\"\nchoco install -y docker-compose --version $docker_compose_version\nIf ($lastexitcode -ne 0) { Exit $lastexitcode }\n\nWrite-Output \"Installing jq\"\nchoco install -y jq\nIf ($lastexitcode -ne 0) { Exit $lastexitcode }\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add a recurse to the delete\n" }, { "from": "human", "value": "$scriptDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif(Test-Path $DeployToolsDir)\n{\n Write-Host \"Removing Deploy Tools Directory Found at $DeployToolsDir\"\n Remove-Item $DeployToolsDir -force\n}\n\nWrite-Host \"Creating Deploy Tools Directory at $DeployToolsDir\"\nNew-Item $DeployToolsDir -Type container\n\nWrite-Host \"Deploying Tools to $DeployToolsDir\"\nCopy-Item \"$scriptDir\\Content\\*\" $DeployToolsDir -Force -Recurse" }, { "from": "gpt", "value": "$scriptDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)\n\nif(Test-Path $DeployToolsDir)\n{\n Write-Host \"Removing Deploy Tools Directory Found at $DeployToolsDir\"\n Remove-Item $DeployToolsDir -Force -Recurse\n}\n\nWrite-Host \"Creating Deploy Tools Directory at $DeployToolsDir\"\nNew-Item $DeployToolsDir -Type container\n\nWrite-Host \"Deploying Tools to $DeployToolsDir\"\nCopy-Item \"$scriptDir\\Content\\*\" $DeployToolsDir -Force -Recurse" } ]
powershell
chosen
[ { "from": "human", "value": "Build script for CI server (properties don't work there)\n" }, { "from": "gpt", "value": "Framework \"4.0x86\"\n\nTask Build-Master {\n\tInvoke-Psake default.ps1 -properties @{autoVersion = $false}\n}\n\nTask Build-Develop {\n\tInvoke-Psake default.ps1\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Update text on the Bootstrapping script\n\nUpdate the text in the Bootstrapping script to say \"Google Cloud Tools for PowerShell\", which is the official name for the project." }, { "from": "human", "value": "# Copyright 2015 Google Inc. All Rights Reserved.\n# Licensed under the Apache License Version 2.0.\n#\n# Bootstraps the Google Cloud cmdlets into the current PowerShell session.\n\nfunction Get-ScriptDirectory\n{\n $invocation = (Get-Variable MyInvocation -Scope 1).Value\n return Split-Path $invocation.MyCommand.Path\n}\n\n$modulePath = Join-Path (Get-ScriptDirectory) \"GoogleCloudPowerShell.psd1\"\nImport-Module $modulePath\n\n$Env:UserProfile\nclear\n\n$welcomeBanner = \"Google Cloud PowerShell\"\nWrite-Output $welcomeBanner\n" }, { "from": "gpt", "value": "# Copyright 2015 Google Inc. All Rights Reserved.\n# Licensed under the Apache License Version 2.0.\n#\n# Bootstraps the Google Cloud cmdlets into the current PowerShell session.\n\nfunction Get-ScriptDirectory\n{\n $invocation = (Get-Variable MyInvocation -Scope 1).Value\n return Split-Path $invocation.MyCommand.Path\n}\n\n$modulePath = Join-Path (Get-ScriptDirectory) \"GoogleCloudPowerShell.psd1\"\nImport-Module $modulePath\n\n$Env:UserProfile\nclear\n\nWrite-Output \"Google Cloud Tools for PowerShell\"\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add basic PowerShell script for building images.\n" }, { "from": "gpt", "value": "Param(\n [Parameter(Mandatory=$true)]\n [string] $Repo,\n\n [Parameter()]\n [string] $Version = '1.0.0-dev'\n)\n\n$Components = @(\n 'api',\n 'sql-executor',\n 'provisioning',\n 'ui'\n)\n\n$docker = Get-Command docker\n\nWrite-Host 'Building images...'\nForEach ($Component in $Components) {\n & $docker build -t \"${Repo}/${Component}:${Version}\" -f Dockerfile.${Component} .\n}\n\nWrite-Host 'Pushing images...'\nForEach ($Component in $Components) {\n & $docker push \"${Repo}/${Component}:${Version}\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "pwsh: Remove alias of curl & wget if defined\n" }, { "from": "human", "value": "# \"dot source\" this file in my $PROFILE\n\n# Define git related functions for aliases\nfunction GitDiff { git diff }\nfunction GitLog { git log --graph --oneline --decorate }\nfunction GitShowBranch { git show-branch }\nfunction GitStatus { git status -s }\n\n# Define git related aliases. Note, \"gl\" is for Get-Location by default.\nSet-Alias gd GitDiff\nSet-Alias gb GitShowBranch\nSet-Alias gs GitStatus\nif ($Host.Version.Major -ge 7) {\n Set-Alias -Force gl GitLog\n} else {\n Set-Alias -Force -Option AllScope gl GitLog\n}\n\n# Use Emacs keybindings\nSet-PSReadLineOption -EditMode Emacs\n\n# Use standard-ish prompt using \"~\" for user profile directory\nfunction prompt {\n \"PS \" + \"$(Get-Location)\".Replace($env:USERPROFILE, \"~\") + \"> \"\n}\n" }, { "from": "gpt", "value": "# \"dot source\" this file in my $PROFILE\n\n# Define git related functions for aliases\nfunction GitDiff { git diff }\nfunction GitLog { git log --graph --oneline --decorate }\nfunction GitShowBranch { git show-branch }\nfunction GitStatus { git status -s }\n\n# Define git related aliases. Note, \"gl\" is for Get-Location by default.\nSet-Alias gd GitDiff\nSet-Alias gb GitShowBranch\nSet-Alias gs GitStatus\nif ($Host.Version.Major -ge 7) {\n Set-Alias -Force gl GitLog\n} else {\n Set-Alias -Force -Option AllScope gl GitLog\n}\n\n# Remove unnecessary aliases\nGet-ChildItem Alias: | Where-Object -Property Name -in @(\"curl\", \"wget\") | Remove-Item\n\n# Use Emacs keybindings\nSet-PSReadLineOption -EditMode Emacs\n\n# Use standard-ish prompt using \"~\" for user profile directory\nfunction prompt {\n \"PS \" + \"$(Get-Location)\".Replace($env:USERPROFILE, \"~\") + \"> \"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Build all non-test projects as both release and prerelease artifacts\n" }, { "from": "human", "value": "dotnet restore;\ndotnet build -c Release;\ndotnet pack --no-build -c Release ShopifySharp/ShopifySharp.csproj;\ndotnet pack --no-build -c Release ShopifySharp.Experimental/ShopifySharp.Experimental.fsproj;\n\n$nupkg = (Get-ChildItem \"ShopifySharp/bin/Release/*.nupkg\")[0];\n$experimentalNupkg = (Get-ChildItem \"ShopifySharp.Experimental/bin/Release/*.nupkg\")[0];\n\n# Push the nuget packages to AppVeyor's artifact list.\nPush-AppveyorArtifact $nupkg.FullName -FileName $nupkg.Name -DeploymentName \"ShopifySharp.nupkg\";\nPush-AppveyorArtifact $experimentalNupkg.FullName -FileName $experimentalNupkg.Name -DeploymentName \"ShopifySharp.Experimental.nupkg\";\n" }, { "from": "gpt", "value": "#! /bin/pwsh\n\n$artifacts = \"./artifacts\";\n\ndotnet restore;\ndotnet build -c Release;\n\n# Get the prerelease version suffix from AppVeyor's build revision\n# Source: https://github.com/another-guy/Mirror/blob/9034cd0d6ee6ec072469f6c0f07bdb16b4b5764e/Build.ps1\n$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];\n$revision = \"b{0:D5}\" -f [convert]::ToInt32($revision, 10)\n\n# Get a list of the projects that will be built and packed (those that aren't test projects)\n$projects = gci \"./ShopifySharp*/*.*sproj\" | where-object -filterscript { $_ -inotmatch \"tests\" } \n\n# Pack the projects as both release and prerelease versions\n# TODO: use the following source to create a script that knows when to pack as release or prerelease\n# example script: https://github.com/another-guy/Mirror/blob/9034cd0d6ee6ec072469f6c0f07bdb16b4b5764e/Build.ps1\n$projects | % { dotnet pack --no-build -c Release -o $artifacts $_ }\n$projects | % { dotnet pack --no-build -c Release -o $artifacts --version-suffix $revision $_ }\n\n# Gather all nuget packages and push them to AppVeyor artifacts\ngci \"./ShopifySharp*/$artifacts/*.nupkg\" | % {\n Push-AppveyorArtifact $_.FullName -FileName $_.Name -DeploymentName $_.Name\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add EnableSSL to the main Reviewbot Jenkins job script\n" }, { "from": "human", "value": "$ErrorActionPreference = 'Stop'\n\n$paramsFile = Join-Path $env:WORKSPACE \"mesos-build-parameters.txt\"\n$consoleLogFile = Join-Path $env:WORKSPACE \"mesos-build-${env:BRANCH}-${env:BUILD_NUMBER}.log\"\n$windowsBuildScript = (Resolve-Path \"$PSScriptRoot\\..\\start-windows-build.ps1\").Path\n& \"$windowsBuildScript\" -Branch $env:BRANCH -CommitID $env:COMMIT_ID -ReviewID $env:REVIEW_ID -ParametersFile $paramsFile | Tee-Object -FilePath $consoleLogFile\n$exitCode = $LASTEXITCODE\nRemove-Item -Force -ErrorAction SilentlyContinue -Path $consoleLogFile\nexit $exitCode\n" }, { "from": "gpt", "value": "$ErrorActionPreference = 'Stop'\n\n$paramsFile = Join-Path $env:WORKSPACE \"mesos-build-parameters.txt\"\n$consoleLogFile = Join-Path $env:WORKSPACE \"mesos-build-${env:BRANCH}-${env:BUILD_NUMBER}.log\"\n$windowsBuildScript = (Resolve-Path \"$PSScriptRoot\\..\\start-windows-build.ps1\").Path\n& \"$windowsBuildScript\" -Branch $env:BRANCH -CommitID $env:COMMIT_ID -ReviewID $env:REVIEW_ID -ParametersFile $paramsFile -EnableSSL | Tee-Object -FilePath $consoleLogFile\n$exitCode = $LASTEXITCODE\nRemove-Item -Force -ErrorAction SilentlyContinue -Path $consoleLogFile\nexit $exitCode\n" } ]
powershell
chosen
[ { "from": "system", "value": "pwsh: Allow adding args for Git related aliases\n" }, { "from": "human", "value": "# \"dot source\" this file in my $PROFILE\n\n# Define git related functions for aliases\nfunction GitDiff { git diff }\nfunction GitLog { git log --graph --oneline --decorate }\nfunction GitShowBranch { git show-branch }\nfunction GitStatus { git status -s }\n\n# Define git related aliases. Note, \"gl\" is for Get-Location by default.\nSet-Alias gd GitDiff\nSet-Alias gb GitShowBranch\nSet-Alias gs GitStatus\nif ($Host.Version.Major -ge 7) {\n Set-Alias -Force gl GitLog\n} else {\n Set-Alias -Force -Option AllScope gl GitLog\n}\n\n# Remove unnecessary aliases\nGet-ChildItem Alias: | Where-Object -Property Name -in @(\"curl\", \"wget\") | Remove-Item\n\n# Use Emacs keybindings\nSet-PSReadLineOption -EditMode Emacs\n\n# Use standard-ish prompt using \"~\" for user profile directory\nfunction prompt {\n \"PS \" + \"$(Get-Location)\".Replace($env:USERPROFILE, \"~\") + \"> \"\n}\n" }, { "from": "gpt", "value": "# \"dot source\" this file in my $PROFILE\n\n# Define git related functions for aliases\nfunction GitDiff { git diff $args }\nfunction GitLog { git log --graph --oneline --decorate $args }\nfunction GitShowBranch { git show-branch $args }\nfunction GitStatus { git status -s $args }\n\n# Define git related aliases. Note, \"gl\" is for Get-Location by default.\nSet-Alias gd GitDiff\nSet-Alias gb GitShowBranch\nSet-Alias gs GitStatus\nif ($Host.Version.Major -ge 7) {\n Set-Alias -Force gl GitLog\n} else {\n Set-Alias -Force -Option AllScope gl GitLog\n}\n\n# Remove unnecessary aliases\nGet-ChildItem Alias: | Where-Object -Property Name -in @(\"curl\", \"wget\") | Remove-Item\n\n# Use Emacs keybindings\nSet-PSReadLineOption -EditMode Emacs\n\n# Use standard-ish prompt using \"~\" for user profile directory\nfunction prompt {\n \"PS \" + \"$(Get-Location)\".Replace($env:USERPROFILE, \"~\") + \"> \"\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add Account psd1 with proper encoding\n\nAdd account monitoring and control psd1 to support proper encoding.\n" }, { "from": "gpt", "value": "@{\n\n# Script module or binary module file associated with this manifest.\nModuleToProcess = 'account-monitoring-control.psm1'\n\n# Version number of this module.\nModuleVersion = '2.0.0'\n\n# ID used to uniquely identify this module\nGUID = '2cf86856-3550-4150-8aaa-b72e83f819b0'\n\n# Author of this module\nAuthor = 'PoshSec'\n\n# Copyright statement for this module\nCopyright = 'BSD 3-Clause'\n\n# Description of the functionality provided by this module\nDescription = 'PoshSec Account Monitoring and Control Module'\n\n# Minimum version of the Windows PowerShell engine required by this module\nPowerShellVersion = '2.0'\n\n# Cmdlets to export from this module\nCmdletsToExport = '*'\n\n# Functions to export from this module\nFunctionsToExport = '*'\n\n# List of all modules packaged with this module.\nModuleList = @(@{ModuleName = 'account-monitoring-control'; ModuleVersion = '1.0.0.0'; GUID = '2cf86856-3550-4150-8aaa-b72e83f819b0'})\n\n# List of all files packaged with this module\nFileList = 'account-monitoring-control.psm1', 'account-monitoring-control.psd1', 'Get-SecAccountThatDontExpire.ps1',\n 'Get-SecAccountThatExpire.ps1', 'Get-SecAllAccount.ps1', 'Get-SecDisabledAccount.ps1',\n 'Get-SecLockedOutAccount.ps1', 'Get-SecPasswordOverExpireDate.ps1', 'Show-SecDisabledAccountAccess.ps1', \n 'Get-SecInactiveAccount.ps1', 'Find-SecAccountNameChecker.ps1', 'Get-SecAdminAccount.ps1', 'Enable-SecVulnAccount.ps1'\n}\n\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add simple Enable-PSBreakpoint and Disable-PSBreakpoint cmdlet tests\n" }, { "from": "gpt", "value": "Describe \"Enable and Disable PSBreakpoints\" -Tag \"CI\" {\n BeforeAll {\n $path = Setup -F testbp.ps1 -content \"get-command`nget-date`nget-location\" -pass\n $bp = set-psbreakpoint -script $path -line 2\n disable-psbreakpoint $bp\n }\n AfterAll {\n $bp | remove-psbreakpoint\n }\n It \"Enable-PSBreakpoint should enable the breakpoint\" {\n $bp.Enabled | should be $false\n Enable-PSBreakpoint $bp\n $bp.Enabled | Should be $true\n }\n It \"Disable-PSBreakpoint should disable the breakpoint\" {\n Enable-PSBreakpoint $bp\n $bp.Enabled | Should be $true\n Disable-PSBreakpoint $bp\n $bp.Enabled | Should be $false\n }\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script to source VC env into powershell\n" }, { "from": "gpt", "value": "# Setups VC environment from bat.\n# It runs environment in cmd and extract all variables into temp file.\n# which then is used to source environment.\nfunction set_vc($arch) {\n $vc_env = \"vcvars$arch.bat\"\n if (Get-Command $vc_env -errorAction SilentlyContinue)\n {\n $tempFile = [IO.Path]::GetTempFileName()\n\n ## Store the output of cmd.exe. We also ask cmd.exe to output\n ## the environment table after the batch file completes\n cmd /Q /c \" $vc_env && set > $tempFile \" | out-null\n\n ## Go through the environment variables in the temp file.\n ## For each of them, set the variable in our local environment.\n Get-Content $tempFile | Foreach-Object {\n if($_ -match \"^(.*?)=(.*)$\")\n {\n Set-Content \"env:\\$($matches[1])\" $matches[2]\n }\n }\n\n Remove-Item $tempFile\n }\n else {\n echo \"Cannot find vcvars.bat for your arch '$arch'\"\n }\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script to ease project name change\n" }, { "from": "gpt", "value": "<#\n\n.SYNOPSIS\nThis is a simple Powershell script to ease change of the .NET Project name\n\n.DESCRIPTION\nChanges project name to the new one by renaming all files, folders and text occurences of the default project name.\n\n.EXAMPLE\n./RenameProject.ps1 \"MyNewWebSite\"\n\n#>\nParam(\n [Parameter(Mandatory=$true, HelpMessage=”You must provide a project name”)]\n [String]$ProjectName\n )\n\n $oldProjectName = \"CloudBoilerplateNet\"\n\n# Replace occurences within a files\n$files = Get-ChildItem . -Recurse -File\nforeach ($file in $files)\n{\n (Get-Content $file.PSPath) | \n Foreach-Object { $_ -replace $oldProjectName, $NewProjectName } | \n Set-Content $file.PSPath\n}\n\n# Rename files & directories\nGet-ChildItem . -Recurse -Filter *$oldProjectName* | \n Rename-Item -NewName { $_.Name -replace $oldProjectName, $NewProjectName }\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove PoSh wget alias if the real deal is present\n" }, { "from": "human", "value": "Write-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" }, { "from": "gpt", "value": "Write-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" } ]
powershell
chosen
[ { "from": "system", "value": "Add dotnet command completion for PowerShell\n" }, { "from": "human", "value": "if (Get-Command -Name dotnet -ErrorAction Ignore) {\n Write-Verbose -Message '[dotfiles] Loading .NET Core settings ...'\n\n # Opt-out of telemetry\n Set-Item -Path Env:\\DOTNET_CLI_TELEMETRY_OPTOUT -Value 'true'\n} else {\n Write-Verbose -Message '[dotfiles] Skipping .NET Core settings as unable to locate dotnet.'\n}\n" }, { "from": "gpt", "value": "if (Get-Command -Name dotnet -ErrorAction Ignore) {\n Write-Verbose -Message '[dotfiles] Loading .NET Core settings ...'\n\n # Opt-out of telemetry\n Set-Item -Path Env:\\DOTNET_CLI_TELEMETRY_OPTOUT -Value 'true'\n\n # Command completion for the dotnet CLI\n # https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete\n Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {\n Param($CommandName, $WordToComplete, $CursorPosition)\n dotnet complete --position $CursorPosition, \"$WordToComplete\" | ForEach-Object {\n [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)\n }\n }\n} else {\n Write-Verbose -Message '[dotfiles] Skipping .NET Core settings as unable to locate dotnet.'\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove timer from PowerScript - doesn't work\n" }, { "from": "human", "value": "# Create timer for window title\n$count = 0\n$timer = New-Object System.Timers.Timer\n$timer.Interval = 1000\n# Write runtime to window title\nRegister-ObjectEvent -InputObject $timer -EventName Elapsed -Action {\n $count++\n $runtime = [timespan]::fromseconds($count).ToString(\"mm\\:ss\")\n $host.ui.RawUI.WindowTitle = \"NESA PP Scraper - Runtime $runtime\"\n}\n# Run crawler\nscrapy crawl nesapp\n# Stop timer\n$timer.Stop()\n# Print meta.json\nwrite-host (Get-Content meta.json) -ForegroundColor Yellow\n# Push to git\ngit add data.json\ngit add meta.json\ngit commit -S -m \"Update data: %date% %time%\"\ngit push\n" }, { "from": "gpt", "value": "# Change title\n$host.ui.RawUI.WindowTitle = \"NESA PP Scraper - Started $(Get-Date -UFormat %T)\"\n# Run crawler\nscrapy crawl nesapp\n# Print meta.json\nwrite-host (Get-Content meta.json) -ForegroundColor Yellow\n# Push to git\ngit add data.json\ngit add meta.json\ngit commit -S -m \"Update data: $(Get-Date -Format g)\"\ngit push\n# Prompt\nRead-Host -Prompt \"Press Enter to exit\"" } ]
powershell
chosen
[ { "from": "system", "value": "Remove pointless management -pre in package.ps1\n" }, { "from": "human", "value": "$root = (split-path -parent $MyInvocation.MyCommand.Definition)\n$lib = \"$root\\.package\\lib\\45\\\"\nif (Test-Path $lib)\n{\n\tRemove-Item $lib -recurse\n}\nnew-item -Path $lib -ItemType directory\nnew-item -Path $root\\.nupkg -ItemType directory -force\nCopy-Item $root\\Idunn.SqlServer.Console\\bin\\Debug\\* $lib\n\n$version = $env:GitVersion_NuGetVersion\nif ($env:APPVEYOR_REPO_BRANCH -ne \"master\" -and $env:APPVEYOR_REPO_TAG)\n{\n $version += '-pre'\n}\nWrite-Host \"Setting .nuspec version tag to $version\"\n\n$content = (Get-Content $root\\Idunn.SqlServer.nuspec -Encoding UTF8) \n$content = $content -replace '\\$version\\$',$version\n\n$content | Out-File $root\\.package\\Idunn.SqlServer.compiled.nuspec -Encoding UTF8\n\n& NuGet.exe pack $root\\.package\\Idunn.SqlServer.compiled.nuspec -Version $version -OutputDirectory $root\\.nupkg\n" }, { "from": "gpt", "value": "$root = (split-path -parent $MyInvocation.MyCommand.Definition)\n$lib = \"$root\\.package\\lib\\45\\\"\nif (Test-Path $lib)\n{\n\tRemove-Item $lib -recurse\n}\nnew-item -Path $lib -ItemType directory\nnew-item -Path $root\\.nupkg -ItemType directory -force\nCopy-Item $root\\Idunn.SqlServer.Console\\bin\\Debug\\* $lib\n\n$version = $env:GitVersion_NuGetVersion\nWrite-Host \"Setting .nuspec version tag to $version\"\n\n$content = (Get-Content $root\\Idunn.SqlServer.nuspec -Encoding UTF8) \n$content = $content -replace '\\$version\\$',$version\n\n$content | Out-File $root\\.package\\Idunn.SqlServer.compiled.nuspec -Encoding UTF8\n\n& NuGet.exe pack $root\\.package\\Idunn.SqlServer.compiled.nuspec -Version $version -OutputDirectory $root\\.nupkg\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add killrvideo-data to subtree pull script\n" }, { "from": "human", "value": "<#\n .DESCRIPTION\n Pull the latest from the projects that are git subtrees.\n#>\n\ngit subtree pull --prefix lib/killrvideo-docker-common git@github.com:KillrVideo/killrvideo-docker-common.git master --squash\ngit subtree pull --prefix lib/killrvideo-service-protos git@github.com:KillrVideo/killrvideo-service-protos.git master --squash" }, { "from": "gpt", "value": "<#\n .DESCRIPTION\n Pull the latest from the projects that are git subtrees.\n#>\n\ngit subtree pull --prefix lib/killrvideo-docker-common git@github.com:KillrVideo/killrvideo-docker-common.git master --squash\ngit subtree pull --prefix lib/killrvideo-service-protos git@github.com:KillrVideo/killrvideo-service-protos.git master --squash\ngit subtree pull --prefix lib/killrvideo-data git@github.com:KillrVideo/killrvideo-data.git master --squash" } ]
powershell
chosen
[ { "from": "human", "value": "Add powershell script to build installer.\n" }, { "from": "gpt", "value": "$launcherExe = \"../RXL.WPFClient/bin/Release/RXL.exe\"\n$versionObj = [System.Reflection.Assembly]::LoadFrom($launcherExe).GetName().Version\n$version = $versionObj.Major.ToString() + \".\" + $versionObj.Minor.ToString() + \".\" + $versionObj.Build.ToString()\n\n\"Building installer, setting version to \" + $version + \".\"\n\nRemove-Item -Force -Recurse \"AnyCPU_ReleaseSetupFiles\"\nRemove-Item -Force -Recurse \"out\"\nRemove-Item -Force -Recurse \"setup-cache\"\n\n$advInstallerExe = \"C:/Program Files (x86)/Caphyon/Advanced Installer 11.0/bin/x86/advinst.exe\"\n\nStart-Process -NoNewWindow -Wait $advInstallerExe (\"/edit setup.aip /SetVersion \" + $version.ToString())\nStart-Process -NoNewWindow -Wait $advInstallerExe \"/rebuild setup.aip\"\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add error stream and information stream tests\n\nfor native pipes\n" }, { "from": "human", "value": "# Minishell is a powershell concept.\n# It's primare use-case is when somebody executes a scriptblock in the new powershell process.\n# The objects are automatically marshelled back to the parent session, so users can avoid custom\n# serialization to pass objects between two processes.\n\nDescribe 'minishell for native executables' -Tag 'CI' {\n\t\n BeforeAll {\n $powershell = Join-Path -Path $PsHome -ChildPath \"powershell\"\n }\n\n It 'gets a hashtable object from minishell' {\n $output = & powershell { @{'a' = 'b'} }\n ($output | measure).Count | Should Be 1\n ($output.GetType().Name) | Should Be 'Hashtable'\n $output['a'] | Should Be 'b'\n }\n}\n" }, { "from": "gpt", "value": "# Minishell is a powershell concept.\n# It's primare use-case is when somebody executes a scriptblock in the new powershell process.\n# The objects are automatically marshelled back to the parent session, so users can avoid custom\n# serialization to pass objects between two processes.\n\nDescribe 'minishell for native executables' -Tag 'CI' {\n\t\n BeforeAll {\n $powershell = Join-Path -Path $PsHome -ChildPath \"powershell\"\n }\n\n It 'gets a hashtable object from minishell' {\n $output = & $powershell { @{'a' = 'b'} }\n ($output | measure).Count | Should Be 1\n ($output.GetType().Name) | Should Be 'Hashtable'\n $output['a'] | Should Be 'b'\n }\n\n It 'gets the error stream from minishell' {\n $output = & $powershell { Write-Error 'foo' } 2>&1\n ($output | measure).Count | Should Be 1\n ($output.GetType().Name) | Should Be 'ErrorRecord'\n $output.FullyQualifiedErrorId | Should Be 'Microsoft.PowerShell.Commands.WriteErrorException'\n }\n\n It 'gets the information stream from minishell' {\n $output = & $powershell { Write-Information 'foo' } 6>&1\n ($output.GetType().Name) | Should Be 'InformationRecord'\n $output | Should Be 'foo'\n }\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add test validate the IsAccessible property\n" }, { "from": "human", "value": "Describe \"Get-DbaDatabase Integration Tests\" -Tags \"Integrationtests\" {\n\n Context \"Count system databases on localhost\" {\n $results = Get-DbaDatabase -SqlInstance localhost -NoUserDb \n It \"Should report the right number of databases\" {\n $results.Count | Should Be 4\n }\n }\n\n Context \"Check that master database is in Simple recovery mode\" {\n $results = Get-DbaDatabase -SqlInstance localhost -Database master\n It \"Should say the recovery mode of master is Simple\" {\n $results.RecoveryModel | Should Be \"Simple\"\n }\n }\n}\n" }, { "from": "gpt", "value": "Describe \"Get-DbaDatabase Integration Tests\" -Tags \"Integrationtests\" {\n\n\tContext \"Count system databases on localhost\" {\n\t\t$results = Get-DbaDatabase -SqlInstance localhost -NoUserDb \n\t\tIt \"Should report the right number of databases\" {\n\t\t\t$results.Count | Should Be 4\n\t\t}\n\t}\n\n\tContext \"Check that master database is in Simple recovery mode\" {\n\t\t$results = Get-DbaDatabase -SqlInstance localhost -Database master\n\t\tIt \"Should say the recovery mode of master is Simple\" {\n\t\t\t$results.RecoveryModel | Should Be \"Simple\"\n\t\t}\n\t}\n\t\n\tContext \"Check that master database is accessible\" {\n\t\t$results = Get-DbaDatabase -SqlInstance localhost -Database master\n\t\tIt \"Should return true that master is accessible\" {\n\t\t\t$results.IsAccessible | Should Be $true\n\t\t}\n\t}\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Hide dotnet utility output on build.\n" }, { "from": "human", "value": "param(\n [string] $Configuration,\n [string] $ExtensionProjectRoot,\n [string] $ExtensionOutputRoot)\n\n\"Publishing all extensions under $ExtensionProjectRoot to $ExtensionOutputRoot using the $Configuration configuration.\"\n\n$outputDir = New-Item $ExtensionOutputRoot -ItemType Directory -Force\nforeach ($projectDir in Get-ChildItem $ExtensionProjectRoot -Directory)\n{\n $extensionName = $projectDir.Name -replace \"AudioWorks.Extensions.\", \"\"\n $projectOutputDir = $outputDir.CreateSubdirectory($extensionName)\n Start-Process \"dotnet\" -ArgumentList \"publish -c $Configuration -o \"\"$($projectOutputDir.FullName)\"\"\" -WorkingDirectory $projectDir.FullName -Wait\n}" }, { "from": "gpt", "value": "param(\n [string] $Configuration,\n [string] $ExtensionProjectRoot,\n [string] $ExtensionOutputRoot)\n\n\"Publishing all extensions under $ExtensionProjectRoot to $ExtensionOutputRoot using the $Configuration configuration.\"\n\n$outputDir = New-Item $ExtensionOutputRoot -ItemType Directory -Force\nforeach ($projectDir in Get-ChildItem $ExtensionProjectRoot -Directory)\n{\n $extensionName = $projectDir.Name -replace \"AudioWorks.Extensions.\", \"\"\n $projectOutputDir = $outputDir.CreateSubdirectory($extensionName)\n Start-Process \"dotnet\" -ArgumentList \"publish -v quiet -c $Configuration -o \"\"$($projectOutputDir.FullName)\"\"\" -WorkingDirectory $projectDir.FullName -Wait -WindowStyle Hidden\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix an issue with accessing projects within a solution folder.\n" }, { "from": "human", "value": "<#\nVS.psm1 - Visual Studio utilities.\n\nCopyright (c) 2013 Precision Mojo, LLC.\nCopyright (c) 2017 Marcus R. Brown <me@igetgam.es>\n\nThis file is part of the Unity3D.DLLs project (http://precisionmojo.github.io/Unity3D.DLLs/) which is distributed\nunder the MIT License. Refer to the LICENSE.MIT.md document located in the project directory for licensing terms.\n\nSome functions are based on code found in David Fowler's NuGetPowerTools package (https://github.com/davidfowl/NuGetPowerTools).\nNuGetPowerTools is licensed under the Apache License 2.0 (https://nuget.codeplex.com/license).\n#>\n\nfunction Resolve-ProjectName\n{\n\tparam\n\t(\n\t\t[Parameter(ValueFromPipelineByPropertyName=$true)]\n\t\t[String[]] $ProjectName\n\t)\n\n\tif ($ProjectName)\n\t{\n\t\t$projects = Get-Project $ProjectName\n\t}\n\telse\n\t{\n\t\t$projects = Get-Project\n\t}\n\n\t$projects\n}\n\nExport-ModuleMember Resolve-ProjectName\n" }, { "from": "gpt", "value": "<#\nVS.psm1 - Visual Studio utilities.\n\nCopyright (c) 2013 Precision Mojo, LLC.\nCopyright (c) 2017 Marcus R. Brown <me@igetgam.es>\n\nThis file is part of the Unity3D.DLLs project (http://precisionmojo.github.io/Unity3D.DLLs/) which is distributed\nunder the MIT License. Refer to the LICENSE.MIT.md document located in the project directory for licensing terms.\n\nSome functions are based on code found in David Fowler's NuGetPowerTools package (https://github.com/davidfowl/NuGetPowerTools).\nNuGetPowerTools is licensed under the Apache License 2.0 (https://nuget.codeplex.com/license).\n#>\n\nfunction Resolve-ProjectName\n{\n\tparam\n\t(\n\t\t[Parameter(ValueFromPipelineByPropertyName=$true)]\n\t\t[String[]] $ProjectName\n\t)\n\n\tif ($ProjectName)\n\t{\n\t\t$projects = Get-Project (Split-Path -Leaf $ProjectName)\n\t}\n\telse\n\t{\n\t\t$projects = Get-Project\n\t}\n\n\t$projects\n}\n\nExport-ModuleMember Resolve-ProjectName\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update nuget packaging script to remove EventStore\n" }, { "from": "human", "value": "mkdir NuGet\nnuget pack \".\\Domain\\Domain.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Api\\Domain.Api.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.EventStore\\Domain.EventStore.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Sql\\Domain.Sql.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Testing\\Domain.Testing.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\EventStore\\EventStore.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Recipes\\Recipes.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\n\n\n" }, { "from": "gpt", "value": "rm -Force -Recurse .\\NuGet\nmkdir NuGet\nnuget pack \".\\Domain\\Domain.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Api\\Domain.Api.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Sql\\Domain.Sql.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Domain.Testing\\Domain.Testing.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\nnuget pack \".\\Recipes\\Recipes.csproj\" -Properties \"Configuration=Release;Platform=AnyCPU\" -OutputDirectory \".\\NuGet\"\n\n\n" } ]
powershell
chosen
[ { "from": "system", "value": "Call twine command without full path.\n" }, { "from": "human", "value": "if (($env:appveyor_repo_tag -eq \"True\") -and ($env:appveyor_repo_branch.StartsWith(\"v\"))) {\n Invoke-Expression \"$env:PYTHON/Scripts/twine upload -u landlab -p $env:PYPI_PASS dist/*\"\n}\n" }, { "from": "gpt", "value": "if (($env:appveyor_repo_tag -eq \"True\") -and ($env:appveyor_repo_branch.StartsWith(\"v\"))) {\n Invoke-Expression \"twine upload -u landlab -p $env:PYPI_PASS dist/*\"\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Create test for new command\n\nDependent upon #1977 being merged, but went ahead and tested my ability with Pester to create the test." }, { "from": "gpt", "value": "$CommandName = $MyInvocation.MyCommand.Name.Replace(\".ps1\", \"\")\nWrite-Host -Object \"Running $PSCommandpath\" -ForegroundColor Cyan\n. \"$PSScriptRoot\\constants.ps1\"\n\nDescribe \"$CommandName Integration Tests\" -Tags \"IntegrationTests\" {\n\tContext \"Verifying output\" {\n\t\tBeforeAll {\n\t\t\t$tfs = 3226,3604\n\t\t\tWrite-Host \"Quick check on current global TFs enabled\"\n\t\t\t$server = Connect-DbaSqlServer -SqlInstance $script:instance1\n\t\t\t$checkResults = $server.Query(\"DBCC TRACESTATUS(-1)\")\n\t\t\tif ($checkResults.Count -gt 0) {\n\t\t\t\tWrite-Host \"Found $($checkResults.Count) global TFs enabled, need to disable them\" -ForegroundColor Cyan\n\t\t\t\tforeach ($result in $checkResults) {\n\t\t\t\t\t$tf = $result.TraceFlag\n\t\t\t\t\t$sql = \"DBCC TRACEOFF($tf,-1);\"\n\t\t\t\t\t$server.Query($sql)\n\t\t\t\t}\n\t\t\t}\n\t\t\tWrite-Host \"Enabling global TFs for testing\"\n\t\t\tforeach ($tf in $tfs) {\n\t\t\t\t$sql = \"DBCC TRACEON($tf,-1) WITH NO_INFOMSGS;\"\n\t\t\t\t$server.Query($sql)\n\t\t\t\tWrite-Host \"$tf enabled\"\n\t\t\t}\n\t\t\t$checkResults = $server.Query(\"DBCC TRACESTATUS(-1)\")\n\t\t\tWrite-Host \"$($CheckResults.Count) TFs enabled.\"\n\t\t}\n\t\tAfterAll {\n\t\t\tWrite-Host \"Cleaning up TFs enabled\"\n\t\t\t$server = Connect-DbaSqlServer -SqlInstance $script:instance1\n\t\t\tforeach ($tf in $tfs) {\n\t\t\t\t$sql = \"DBCC TRACEOFF($tf,-1) WITH NO_INFOMSGS;\"\n\t\t\t\t$server.Query($sql)\n\t\t\t}\n\t\t}\n\n\t\tIt \"Has the right default properties\" {\n\t\t\t$expectedProps = 'ComputerName,InstanceName,SqlInstance,TraceFlag,Global,Status'.Split(',')\n\t\t\t$results = Get-DbaTraceFlag -SqlInstance $script:instance1\n\t\t\t($results[0].PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($expectedProps | Sort-Object)\n\t\t}\n\t\tIt \"Returns filtered results\" {\n\t\t\t$tf = $tfs[0]\n\t\t\tWrite-Host \"Checking for TF $tf\"\n\t\t\t$fResults = Get-DbaTraceFlag -SqlInstance $script:instance1 -TraceFlag $tf\n\t\t\t($fResults | Measure-Object).Count | Should Be 1\n\t\t}\n\t\tIt \"Returns following number of TFs: $($tfs.Count)\" {\n\t\t\t$results = Get-DbaTraceFlag -SqlInstance $script:instance1\n\t\t\t($results | Measure-Object).Count | Should Be 2\n\t\t}\n\t}\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Deploy test app for vnetRouteAllEnabled\n" }, { "from": "gpt", "value": "$location = 'Australia East'\n$loc = 'aue'\n$rg = 'hellovnetrouteall-rg'\n$plan = \"hellovnetrouteall-$loc-plan\"\n$tags = 'project=private-paas'\n$app = \"hellovnetrouteall-$loc\"\n$vnet = \"hellovnetrouteall-$loc-vnet\"\n$planSubnet = 'asp'\n$nsg = 'deny-all-internet-out'\n\n# Create resource group\naz group create -n $rg --location $location --tags $tags\n\n# Create App Service Plan\naz appservice plan create -n $plan -g $rg --location $location --sku S1 --tags $tags\n\n# Create App and deploy test app from Github\naz webapp create -n $app --plan $plan -g $rg --tags $tags `\n --deployment-source-url 'https://github.com/DanielLarsenNZ/HelloAspDotNetCore'\n\n# Create a VNet\naz network vnet create -n $vnet -g $rg --location $location --subnet-name $planSubnet --tags $tags\n\n# APP SERVICE PLAN Regional VNET Integration\naz webapp vnet-integration add --name $app -g $rg --subnet $planSubnet --vnet $vnet\n\n# Set Website VNET Route all and configure app to try to connect to Dropbox.com\naz webapp config appsettings set -n $app -g $rg --settings \"WEBSITE_VNET_ROUTE_ALL=1\" \"GetUrls=https://www.dropbox.com/\"\n\n# Create an NSG to deny all internet outbound\naz network nsg create -g $rg -n $nsg --tags $tags\naz network nsg rule create -g $rg --nsg-name $nsg -n 'DenyInternetOutbound' --priority 100 `\n --direction 'Outbound' --source-address-prefixes '*' --source-port-ranges '*' `\n --destination-address-prefixes 'Internet' --destination-port-ranges '*' --access Deny `\n --protocol '*' --description \"Deny any outbound to internet\"\n\n# Assign to subnet\naz network vnet subnet update -g $rg -n $planSubnet --vnet-name $vnet --network-security-group $nsg\n\n# Open the app in the browser\nstart \"https://$app.azurewebsites.net\"\n\n# Tear down\n# & az group delete -n $rg --yes" } ]
powershell
chosen
[ { "from": "system", "value": "Use absolute path for 7z\n" }, { "from": "human", "value": "$temp_directory = \"$env:APPVEYOR_BUILD_FOLDER\\Deploy\\Portable\\~TEMP\"\nNew-Item \"$temp_directory\" -type directory\n\n$zip_archive = \"$env:APPVEYOR_BUILD_FOLDER\\Deploy\\Portable\\Tabster $env:APPVEYOR_BUILD_VERSION Portable.exe\"\n\n# build using portable configuration\n& msbuild.exe \"$env:APPVEYOR_BUILD_FOLDER\\Tabster.sln\" /p:Configuration=Portable\n\n$output_directory = \"$env:APPVEYOR_BUILD_FOLDER\\Tabster\\bin\\Portable\"\n\n# copy .exe, .dll, .config files\nCopy-Item \"$output_directory\\*.exe\" \"$temp_directory\"\nCopy-Item \"$output_directory\\*.dll\" \"$temp_directory\"\nCopy-Item \"$output_directory\\*.config\" \"$temp_directory\"\n\n# copy subfolders recursively\nGet-ChildItem -Path \"$output_directory\" -Recurse | ?{ $_.PSIsContainer } | Copy-Item -Destination \"$temp_directory\" -Force -Container\n\n# zip contents in self-extracting archive\n& 7z a -r -mmt -mx5 -sfx7z.sfx \"$zip_archive\" \"$temp_directory\\*.*\"\n\n# move executable to project directory for clean AppVeyor artifact name\nMove-Item \"$zip_archive\" \"$env:APPVEYOR_BUILD_FOLDER\"" }, { "from": "gpt", "value": "$temp_directory = \"$env:APPVEYOR_BUILD_FOLDER\\Deploy\\Portable\\~TEMP\"\nNew-Item \"$temp_directory\" -type directory\n\n$zip_archive = \"$env:APPVEYOR_BUILD_FOLDER\\Deploy\\Portable\\Tabster $env:APPVEYOR_BUILD_VERSION Portable.exe\"\n\n# build using portable configuration\n& msbuild.exe \"$env:APPVEYOR_BUILD_FOLDER\\Tabster.sln\" /p:Configuration=Portable\n\n$output_directory = \"$env:APPVEYOR_BUILD_FOLDER\\Tabster\\bin\\Portable\"\n\n# copy .exe, .dll, .config files\nCopy-Item \"$output_directory\\*.exe\" \"$temp_directory\"\nCopy-Item \"$output_directory\\*.dll\" \"$temp_directory\"\nCopy-Item \"$output_directory\\*.config\" \"$temp_directory\"\n\n# copy subfolders recursively\nGet-ChildItem -Path \"$output_directory\" -Recurse | ?{ $_.PSIsContainer } | Copy-Item -Destination \"$temp_directory\" -Force -Container\n\n# zip contents in self-extracting archive\n& \"C:\\ProgramData\\chocolatey\\lib\\7zip.commandline\\7z.exe\" a -r -mmt -mx5 -sfx7z.sfx \"$zip_archive\" \"$temp_directory\\*.*\"\n\n# move executable to project directory for clean AppVeyor artifact name\nMove-Item \"$zip_archive\" \"$env:APPVEYOR_BUILD_FOLDER\"" } ]
powershell
chosen
[ { "from": "system", "value": "Make Add-Type test -Pending until it passes on Windows\n" }, { "from": "human", "value": "Describe \"Add-Type\" {\n It \"Should not throw given a simple class definition\" {\n { Add-Type -TypeDefinition \"public static class foo { }\" } | Should Not Throw\n }\n}\n" }, { "from": "gpt", "value": "Describe \"Add-Type\" {\n It -Pending \"Should not throw given a simple class definition\" {\n { Add-Type -TypeDefinition \"public static class foo { }\" } | Should Not Throw\n }\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script to remove Metro Apps\n\nScript will remove defined Metro Apps\n" }, { "from": "gpt", "value": "# Remove the default Windows Apps from the image\n#\n# Seriously, who uses these dumb things?\n#\n# To get the name of the packages:\n# - Dism.exe /online /get-ProvisionedAppxPackages \n#\n# Alternately, on a live machine, you can run:\n# - Dism.exe /online /Remove-ProvisionedAppxPackage /PackageName:microsoft.windowsphotos_16.4.4396.311_x64__8wekyb3d8bbwe\n# - Dism.exe /online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.ZuneVideo_1.5.802.0_x64__8wekyb3d8bbwe\n#\n$AppList = \"Microsoft.Reader\",\n \"Microsoft.WindowsScan\",\n \"microsoft.windowscommunicationsapps\",\n \"Microsoft.WindowsReadingList\",\n \"Microsoft.XboxLIVEGames\",\n \"Microsoft.ZuneMusic\",\n \"microsoft.windowsphotos\",\n \"Microsoft.bingTravel\",\n \"Microsoft.bingMaps\",\n \"Microsoft.bingFinance\",\n \"Microsoft.bingFoodAndDrink\",\n \"Microsoft.bingHealthAndFitness\",\n \"Microsoft.ZuneVideo\"\n\nForEach ($App in $AppList) {\n $AppxPackage = Get-AppxProvisionedPackage -online | Where {$_.DisplayName -eq $App}\n Remove-AppxProvisionedPackage -online -packagename ($AppxPackage.PackageName) -ErrorAction SilentlyContinue\n Remove-AppxPackage ($AppxPackage.PackageName) -ErrorAction SilentlyContinue\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove exit & duplicates from powershell history\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 (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\nif (Get-Command Import-Module -ErrorAction SilentlyContinue) {\n Import-Module PSReadLine\n\n Set-PSReadlineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit\n\n $ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\n if (Test-Path($ChocolateyProfile)) {\n Import-Module \"$ChocolateyProfile\"\n }\n\n}\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\nif (Get-Command Import-Module -ErrorAction SilentlyContinue) {\n Import-Module PSReadLine\n\n Set-PSReadlineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit\n\n $PSReadLineOptions = @{\n HistoryNoDuplicates = $true\n AddToHistoryHandler = {\n param($line)\n if ($line -eq 'exit') {\n return $false\n }\n $true\n }\n }\n Set-PSReadLineOption @PSReadLineOptions\n\n $ChocolateyProfile = \"$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1\"\n if (Test-Path($ChocolateyProfile)) {\n Import-Module \"$ChocolateyProfile\"\n }\n\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Update to latest working Docker 1.12.1 with TP5" }, { "from": "human", "value": "Set-ExecutionPolicy Bypass -scope Process\nNew-Item -Type Directory -Path \"$($env:ProgramFiles)\\docker\"\nwget -outfile $env:TEMP\\docker-1.12.0.zip https://get.docker.com/builds/Windows/x86_64/docker-1.12.0.zip\nExpand-Archive -Path $env:TEMP\\docker-1.12.0.zip -DestinationPath $env:TEMP -Force\ncopy $env:TEMP\\docker\\*.exe $env:ProgramFiles\\docker\nRemove-Item $env:TEMP\\docker-1.12.0.zip\n[Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";$($env:ProgramFiles)\\docker\", [EnvironmentVariableTarget]::Machine)\n$env:Path = $env:Path + \";$($env:ProgramFiles)\\docker\"\n. dockerd --register-service -H npipe:// -H 0.0.0.0:2375 -G docker\n\nStart-Service Docker\n\nWrite-Host \"Installing WindowsServerCore docker image...\"\ndocker pull microsoft/windowsservercore:10.0.14300.1030\ndocker pull microsoft/windowsservercore\n\nif ((get-windowsfeature Hyper-V | where installed).count) {\n Write-Host \"Installing NanoServer docker image...\"\n docker pull microsoft/nanoserver:10.0.14300.1030\n docker pull microsoft/nanoserver\n} else {\n Write-Host \"Skipping NanoServer docker image\"\n}\n" }, { "from": "gpt", "value": "Set-ExecutionPolicy Bypass -scope Process\nNew-Item -Type Directory -Path \"$($env:ProgramFiles)\\docker\"\nwget -outfile $env:TEMP\\docker-1.12.1.zip https://get.docker.com/builds/Windows/x86_64/docker-1.12.1.zip\nExpand-Archive -Path $env:TEMP\\docker-1.12.1.zip -DestinationPath $env:TEMP -Force\ncopy $env:TEMP\\docker\\*.exe $env:ProgramFiles\\docker\nRemove-Item $env:TEMP\\docker-1.12.1.zip\n[Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";$($env:ProgramFiles)\\docker\", [EnvironmentVariableTarget]::Machine)\n$env:Path = $env:Path + \";$($env:ProgramFiles)\\docker\"\n. dockerd --register-service -H npipe:// -H 0.0.0.0:2375 -G docker\n\nStart-Service Docker\n\nWrite-Host \"Installing WindowsServerCore docker image...\"\ndocker pull microsoft/windowsservercore:10.0.14300.1030\ndocker pull microsoft/windowsservercore\n\nif ((get-windowsfeature Hyper-V | where installed).count) {\n Write-Host \"Installing NanoServer docker image...\"\n docker pull microsoft/nanoserver:10.0.14300.1030\n docker pull microsoft/nanoserver\n} else {\n Write-Host \"Skipping NanoServer docker image\"\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Change test framework to use 4 chars of guid for random names.\n" }, { "from": "human", "value": "function New-Guid {\r\n [System.Guid]::NewGuid().ToString(\"d\").Substring(0, 6).Replace(\"-\", \"\")\r\n}\r\n" }, { "from": "gpt", "value": "function New-Guid {\r\n [System.Guid]::NewGuid().ToString(\"d\").Substring(0, 4).Replace(\"-\", \"\")\r\n}\r\n" } ]
powershell
chosen
[ { "from": "human", "value": "Test sql connect-ability from power shell script\n" }, { "from": "gpt", "value": "##Use this to test connections and firewalls to an SQL database when no sql client is installed on a computer.\r\n\r\n$conn = New-Object System.Data.SqlClient.SqlConnection\r\n$conn.ConnectionString = \"Server=tcp:cidatabaseserver.database.windows.net,1433;Database=******;User ID=*****;Password=*****);Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;\"\r\n$conn.open()\r\n$cmd = New-Object System.Data.SqlClient.SqlCommand\r\n$cmd.connection = $conn\r\n$cmd.commandtext = \"select * from sys.databases\"\r\n$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter\r\n\r\n$SqlAdapter.SelectCommand = $cmd\r\n\r\n$DataSet = New-Object System.Data.DataSet\r\n\r\n$SqlAdapter.Fill($DataSet)\r\n\r\nforeach ($row in $DataSet.Tables[0].Rows){\r\n\r\nwrite-Host ($row[1].ToString().Trim())\r\n\r\nwrite-Host ($row[2].ToString())\r\n\r\nWrite-Host ($row[3].ToString().Trim())\r\n\r\n}\r\n\r\n$conn.Close()" } ]
powershell
chosen
[ { "from": "system", "value": "Add codecov to the build\n" }, { "from": "human", "value": "MSBuild.SonarQube.Runner.exe end /d:\"sonar.login=$env:SONARQUBE_TOKEN\"" }, { "from": "gpt", "value": "MSBuild.SonarQube.Runner.exe end /d:\"sonar.login=$env:SONARQUBE_TOKEN\"\n\npip install codecov\ncodecov -f \"coverage.xml\" -t $env:CODECOV_TOKEN" } ]
powershell
chosen
[ { "from": "system", "value": "Fix Integrtion Test Config template by removing quotes\n" }, { "from": "human", "value": "<#\n.Synopsis\n DSC Configuration Template for DSC Resource Integration tests.\n.DESCRIPTION\n To Use:\n 1. Copy to \\Tests\\Integration\\ folder and rename MSFT_<ResourceName>.config.ps1 (e.g. MSFT_xFirewall.config.ps1)\n 2. Customize TODO sections.\n\n.NOTES\n#>\n\n\n# TODO: Modify ResourceName\nconfiguration 'MSFT_<ResourceName>_config' {\n Import-DscResource -Name 'MSFT_<ResourceName>'\n node localhost {\n # TODO: Modify ResourceName\n '<ResourceName>' Integration_Test {\n # TODO: Fill Configuration Code Here\n }\n }\n}\n\n# TODO: (Optional): Add More Configuration Templates\n" }, { "from": "gpt", "value": "<#\n.Synopsis\n DSC Configuration Template for DSC Resource Integration tests.\n.DESCRIPTION\n To Use:\n 1. Copy to \\Tests\\Integration\\ folder and rename MSFT_<ResourceName>.config.ps1 (e.g. MSFT_xFirewall.config.ps1)\n 2. Customize TODO sections.\n\n.NOTES\n#>\n\n\n# TODO: Modify ResourceName\nconfiguration 'MSFT_<ResourceName>_config' {\n Import-DscResource -Name 'MSFT_<ResourceName>'\n node localhost {\n # TODO: Modify ResourceName\n <ResourceName> Integration_Test {\n # TODO: Fill Configuration Code Here\n }\n }\n}\n\n# TODO: (Optional): Add More Configuration Templates\n" } ]
powershell
chosen
[ { "from": "system", "value": "Use basename instead of trim\n\nTrim removed function names that ended in p.\n\nDot source fixed. No need for .\\ when using full path\n" }, { "from": "human", "value": "$scripts = Get-ChildItem -Path $PSScriptRoot -Recurse -Filter *.ps1 | \n Where-Object FullName -NotMatch '.Tests.'\n\n\nDescribe -Tag 'Help' 'Help' {\n\n foreach ($script in $scripts) {\n\n Context \"[$(($script.Name).TrimEnd('.ps1'))] Validate Comment Based Help\" {\n # Dot Source script\n . .\\$script.FullName\n\n $functionHelp = Get-Help ($script.Name).TrimEnd('.ps1') -Full\n\n It 'Contains Description' {\n $functionHelp.Description | Should Not BeNullOrEmpty\n }\n \n It 'Contains Synopsis' {\n $functionHelp.Synopsis | Should Not BeNullOrEmpty\n }\n\n It 'Contains Examples' {\n $functionHelp.Examples | Should Not BeNullOrEmpty\n }\n\n It 'Contains Parameters' {\n $functionHelp.Parameters | Should Not BeNullOrEmpty\n }\n }\n }\n}\n\n" }, { "from": "gpt", "value": "$scripts = Get-ChildItem -Path $PSScriptRoot -Recurse -Filter *.ps1 | \n Where-Object FullName -NotMatch '.Tests.'\n\n\nDescribe -Tag 'Help' 'Help' {\n\n foreach ($script in $scripts) {\n\n Context \"[$($script.BaseName)] Validate Comment Based Help\" {\n # Dot Source script\n . $($script.FullName)\n\n $functionHelp = Get-Help ($script.Name).TrimEnd('.ps1') -Full\n\n It 'Contains Description' {\n $functionHelp.Description | Should Not BeNullOrEmpty\n }\n \n It 'Contains Synopsis' {\n $functionHelp.Synopsis | Should Not BeNullOrEmpty\n }\n\n It 'Contains Examples' {\n $functionHelp.Examples | Should Not BeNullOrEmpty\n }\n\n It 'Contains Parameters' {\n $functionHelp.Parameters | Should Not BeNullOrEmpty\n }\n }\n }\n}\n\n" } ]
powershell
chosen
[ { "from": "system", "value": "Remove editing start action for now\n" }, { "from": "human", "value": "param($installPath, $toolsPath, $package, $project)\n\n$project.Properties.Item(\"PostBuildEvent\").Value = \"if `$(ConfigurationName) == Debug \"\"`$(ProjectDir)CupCake.Debug.exe\"\" Deploy `$(TargetDir)\"\n\n$asms = $package.AssemblyReferences | %{$_.Name}\n\nforeach ($reference in $project.Object.References)\n{\n if ($asms -contains $reference.Name + \".dll\")\n {\n $reference.CopyLocal = $false;\n }\n}\n\n$project.Properties | where { $_.Name -eq \"StartAction\" } | foreach { $_.Value = \"Program\" }\n$project.Properties | where { $_.Name -eq \"StartProgram\" } | foreach { $_.Value = \"$(MSBuildProjectDirectory)\\CupCake.Debug.exe\" }\n$project.Properties | where { $_.Name -eq \"StartArguments\" } | foreach { $_.Value = \"Debug\" }" }, { "from": "gpt", "value": "param($installPath, $toolsPath, $package, $project)\n\n$project.Properties.Item(\"PostBuildEvent\").Value = \"if `$(ConfigurationName) == Debug \"\"`$(ProjectDir)CupCake.Debug.exe\"\" Deploy `$(TargetDir)\"\n\n$asms = $package.AssemblyReferences | %{$_.Name}\n\nforeach ($reference in $project.Object.References)\n{\n if ($asms -contains $reference.Name + \".dll\")\n {\n $reference.CopyLocal = $false;\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Remove ILRepacking from MyGet powershell script\n" }, { "from": "human", "value": "##Looks through the entire src directory and runs nuget pack with dependencies added on each csproj found\n##foreach file in src/*\nforeach($f in Get-ChildItem ./src/)\n{\n ##foreach file in the src/*/ directory that ends with the .csproj format\n foreach($ff in (Get-ChildItem (Join-Path ./src/ $f.Name) | Where-Object { $_.Name.EndsWith(\".csproj\") }))\n {\n ##Add the project path + the csproj name and add the include referenced projects argument which will\n ##force nuget dependencies\n $projectArgs = \"pack \" + (Join-Path (Join-Path src/ $f.Name) $ff.Name)## + \"-c Release -IncludeReferencedProjects\"\n Start-Process dotnet $projectArgs -Wait\n }\n}\n\nStart-Process ILRepack.exe \"/out:.\\src\\Reinterpret.Net\\bin\\Release\\net20\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net20\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net20\\UnsafeAs.Backport.dll\" -Wait\nStart-Process ILRepack.exe \"/out:.\\src\\Reinterpret.Net\\bin\\Release\\net30\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net30\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net30\\UnsafeAs.Backport.dll\" -Wait\nStart-Process ILRepack.exe \"/out:.\\src\\Reinterpret.Net\\bin\\Release\\net35\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net35\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net35\\UnsafeAs.Backport.dll\" -Wait\nStart-Process ILRepack.exe \"/out:.\\src\\Reinterpret.Net\\bin\\Release\\net40\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net40\\Reinterpret.Net.dll .\\src\\Reinterpret.Net\\bin\\Release\\net40\\UnsafeAs.Backport.dll\" -Wait\n" }, { "from": "gpt", "value": "##Looks through the entire src directory and runs nuget pack with dependencies added on each csproj found\n##foreach file in src/*\nforeach($f in Get-ChildItem ./src/)\n{\n ##foreach file in the src/*/ directory that ends with the .csproj format\n foreach($ff in (Get-ChildItem (Join-Path ./src/ $f.Name) | Where-Object { $_.Name.EndsWith(\".csproj\") }))\n {\n ##Add the project path + the csproj name and add the include referenced projects argument which will\n ##force nuget dependencies\n $projectArgs = \"pack \" + (Join-Path (Join-Path src/ $f.Name) $ff.Name)## + \"-c Release -IncludeReferencedProjects\"\n Start-Process dotnet $projectArgs -Wait\n }\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add Unit Test For Tee-Object\n" }, { "from": "human", "value": "Describe \"Tee-Object\" {\n\n Context \"Validate Tee-Object is correctly forking output\" {\n\n\t$testfile = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath testfile.txt\n\n\tIt \"Should return the output to the screen and to the variable\" {\n\t $teefile = $testfile\n\t echo teeobjecttest1 | Tee-Object -variable teeresults\n\t $teeresults | Should Be \"teeobjecttest1\"\n\t Remove-Item $teefile -ErrorAction SilentlyContinue\n\t}\n\n\tIt \"Should tee the output to a file\" {\n\t $teefile = $testfile\n\t echo teeobjecttest3 | Tee-Object $teefile\n\t Get-Content $teefile | Should Be \"teeobjecttest3\"\n\t Remove-Item $teefile -ErrorAction SilentlyContinue\n\t}\n }\n}\n" }, { "from": "gpt", "value": "Describe \"Tee-Object\" {\n\n Context \"Validate Tee-Object is correctly forking output\" {\n\n\t$testfile = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath testfile.txt\n\n\t It \"Should return the output to the screen and to the variable\" {\n\t $teefile = $testfile\n\t echo teeobjecttest1 | Tee-Object -variable teeresults\n\t $teeresults | Should Be \"teeobjecttest1\"\n\t Remove-Item $teefile -ErrorAction SilentlyContinue\n\t }\n\n\t It \"Should tee the output to a file\" {\n\t $teefile = $testfile\n\t echo teeobjecttest3 | Tee-Object $teefile\n\t Get-Content $teefile | Should Be \"teeobjecttest3\"\n\t Remove-Item $teefile -ErrorAction SilentlyContinue\n\t }\n }\n}\n\nDescribe \"Tee-Object DRT Unit Tests\" -Tags DRT {\n $tempDirectory = Join-Path $TestDrive -ChildPath \"TeeObjectTestsTempDir\"\n $tempFile = \"TeeObjectTestsTempFile\"\n New-Item $tempDirectory -ItemType Directory -Force\n\n It \"Positive File Test\" {\n $expected = \"1\", \"2\", \"3\"\n $filePath = Join-Path $tempDirectory -ChildPath $tempFile\n $results = $expected | Tee-Object -FilePath $filePath\n $results.Length | Should be 3\n $results | Should Be $expected\n $content = Get-Content $filePath\n $content | Should Be $expected\n }\n\n It \"Positive Var Test\" {\n $expected = \"1\", \"2\", \"3\" \n $varName = \"teeObjectTestVar\"\n $results = $expected | Tee-Object -Variable $varName\n $results.Length | Should be 3\n $results | Should Be $expected\n \n $results = Get-Variable -Name $varName -ValueOnly\n $results.Length | Should be 3\n $results | Should Be $expected\n }\n\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Build script updated to newest nuget.exe.\n" }, { "from": "human", "value": "\r\nPush-Location Equ\r\n\r\nnuget pack -Build -Prop Configuration=Release -Output ..\\..\\..\\LocalNugetFeed\r\n\r\nPop-Location\r\n" }, { "from": "gpt", "value": "\r\nPush-Location Equ\r\n\r\nnuget pack Equ.csproj -Build -Prop Configuration=Release -Output ..\\..\\..\\LocalNugetFeed\r\n\r\nPop-Location\r\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix CI settings which causes private nupkg creation failure due to suffix.\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\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" }, { "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}\" -f @( $now, $daysSpan.Days )\n\t}\n\telse if ( ${env:APPVEYOR_BUILD_NUMBER} -match \"^[a-zA-Z].+\" )\n\t{\n\t\t$env:PackageVersion = \"${version}-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n\telse\n\t{\n\t\t$env:PackageVersion = \"${version}-final-${env:APPVEYOR_BUILD_NUMBER}\"\n\t}\n}\nelse\n{\n\t$env:PackageVersion = $version\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add test for the existance of explorer.exe to guard against Server Core images\n" }, { "from": "human", "value": "$ErrorActionPreference = 'Stop'\n\n$toolsDir = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n$filePath = if ((Get-ProcessorBits 64) -and $env:chocolateyForceX86 -ne $true) {\n Write-Host \"Installing 64 bit version\" ; gi $toolsDir\\*_x64.exe }\nelse { Write-Host \"Installing 32 bit version\" ; gi $toolsDir\\*_x32.exe }\n\n$packageArgs = @{\n packageName = '7zip.install'\n fileType = 'exe'\n softwareName = '7-zip*'\n file = $filePath\n silentArgs = '/S'\n validExitCodes = @(0)\n}\nInstall-ChocolateyInstallPackage @packageArgs\nrm $toolsDir\\*.exe -ea 0 -force\n\n# 7z installer may close explorer\nif (!(ps explorer -ea 0)) { start explorer.exe }\n\n$installLocation = Get-AppInstallLocation $packageArgs.softwareName\nif (!$installLocation) { Write-Warning \"Can't find 7zip install location\"; return }\nWrite-Host \"7zip installed to '$installLocation'\"\n\nInstall-BinFile '7z' $installLocation\\7z.exe\n" }, { "from": "gpt", "value": "$ErrorActionPreference = 'Stop'\n\n$toolsDir = \"$(Split-Path -parent $MyInvocation.MyCommand.Definition)\"\n$filePath = if ((Get-ProcessorBits 64) -and $env:chocolateyForceX86 -ne $true) {\n Write-Host \"Installing 64 bit version\" ; gi $toolsDir\\*_x64.exe }\nelse { Write-Host \"Installing 32 bit version\" ; gi $toolsDir\\*_x32.exe }\n\n$packageArgs = @{\n packageName = '7zip.install'\n fileType = 'exe'\n softwareName = '7-zip*'\n file = $filePath\n silentArgs = '/S'\n validExitCodes = @(0)\n}\nInstall-ChocolateyInstallPackage @packageArgs\nrm $toolsDir\\*.exe -ea 0 -force\n\n# 7z installer may close explorer\nif (!(ps explorer -ea 0)) {\n # Only start explorer if the file exists; Server Core installs do not have it.\n if (!(Test-Path \"$env:windir\\explorer.exe\")) {\n start explorer.exe\n }\n}\n\n$installLocation = Get-AppInstallLocation $packageArgs.softwareName\nif (!$installLocation) { Write-Warning \"Can't find 7zip install location\"; return }\nWrite-Host \"7zip installed to '$installLocation'\"\n\nInstall-BinFile '7z' $installLocation\\7z.exe\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix check script because netcore45 becomes portable-windows8+wpa.\n" }, { "from": "human", "value": "param([Switch]$Rebuild)\n\n[string]$temp = '.\\nugettmp'\n[string]$builder = \"$env:windir\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe\"\n\n[string]$sln = 'MsgPack.sln'\n[string]$slnCompat = 'MsgPack.compats.sln'\n\n[string]$nuspec = 'MsgPack.nuspec'\n\n$buildOptions = @()\nif( $Rebuild )\n{\n $buildOptions += '/t:Rebuild'\n}\n\n$buildOptions += '/p:Configuration=Release'\n\n&$builder $sln $buildOptions\n&$builder $slnCompat $buildOptions\n\n$winFile = New-Object IO.FileInfo( \".\\bin\\netcore45\\MsgPack.dll\" )\n$xamarinFile = New-Object IO.FileInfo( \".\\bin\\monotouch\\MsgPack.dll\" )\nif( ( $winFile.LastWriteTime - $xamarinFile.LastWriteTime ).Days -ne 0 )\n{\n\t# It might that I forgot building in xamarin when winRT build and xamarin build last write time are differ more than 1day.\n\tWrite-Error \"Last write times between WinRT binary and Xamarin library are very differ. Do you forget to place latest Xamarin build (on Mac) or latest WinRT build (on Windows) on ./bin ?\"\n\treturn\n}\n\n.\\.nuget\\nuget.exe pack $nuspec" }, { "from": "gpt", "value": "param([Switch]$Rebuild)\n\n[string]$temp = '.\\nugettmp'\n[string]$builder = \"$env:windir\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe\"\n\n[string]$sln = 'MsgPack.sln'\n[string]$slnCompat = 'MsgPack.compats.sln'\n\n[string]$nuspec = 'MsgPack.nuspec'\n\n$buildOptions = @()\nif( $Rebuild )\n{\n $buildOptions += '/t:Rebuild'\n}\n\n$buildOptions += '/p:Configuration=Release'\n\n&$builder $sln $buildOptions\n&$builder $slnCompat $buildOptions\n\n$winFile = New-Object IO.FileInfo( \".\\bin\\portable-windows8+wpa\\MsgPack.dll\" )\n$xamarinFile = New-Object IO.FileInfo( \".\\bin\\monotouch\\MsgPack.dll\" )\nif( ( $winFile.LastWriteTime - $xamarinFile.LastWriteTime ).Days -ne 0 )\n{\n\t# It might that I forgot building in xamarin when winRT build and xamarin build last write time are differ more than 1day.\n\tWrite-Error \"Last write times between WinRT binary and Xamarin library are very differ. Do you forget to place latest Xamarin build (on Mac) or latest WinRT build (on Windows) on ./bin ?\"\n\treturn\n}\n\n.\\.nuget\\nuget.exe pack $nuspec" } ]
powershell
chosen
[ { "from": "system", "value": "Install Angular CLI and TypeScript with npm\n\n" }, { "from": "human", "value": "### Install handy tools and apps for my dev machine\n### Run this script from an administrative shell\n\nSet-ExecutionPolicy RemoteSigned\n\n# Install Chocolatey\nInvoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n# Install some software\nchoco install -y 7zip\nchoco install -y dotnetcore-sdk\nchoco install -y git\n#choco install -y github-desktop # Github Desktop gets updates so often that it's hard for the Chocolatey package to keep up\nchoco install -y gitkraken\nchoco install -y googlechrome\nchoco install -y hyper\nchoco install -y keepass\nchoco install -y linqpad\nchoco install -y nodejs-lts\nchoco install -y notepadplusplus\nchoco install -y poshgit\nchoco install -y postman\nchoco install -y rdcman\nchoco install -y slack\nchoco install -y sql-server-management-studio\n#choco install -y toggl # The Toggl Desktop Chocolatey package is significantly behind as of May 2017, so I'll install it manually\n#choco install -y visualstudiocode # VS Code gets updates so often that it's hard for the Chocolatey package to keep up\nRefreshEnv.cmd\n" }, { "from": "gpt", "value": "### Install handy tools and apps for my dev machine\n### Run this script from an administrative shell\n\nSet-ExecutionPolicy RemoteSigned\n\n# Install Chocolatey\nInvoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n# Install some software with Chocolatey\nchoco install -y 7zip\nchoco install -y dotnetcore-sdk\nchoco install -y git\n#choco install -y github-desktop # Github Desktop gets updates so often that it's hard for the Chocolatey package to keep up\nchoco install -y gitkraken\nchoco install -y googlechrome\nchoco install -y hyper\nchoco install -y keepass\nchoco install -y linqpad\nchoco install -y nodejs-lts\nchoco install -y notepadplusplus\nchoco install -y poshgit\nchoco install -y postman\nchoco install -y rdcman\nchoco install -y slack\nchoco install -y sql-server-management-studio\n#choco install -y toggl # The Toggl Desktop Chocolatey package is significantly behind as of May 2017, so I'll install it manually\n#choco install -y visualstudiocode # VS Code gets updates so often that it's hard for the Chocolatey package to keep up\nRefreshEnv.cmd\n\n# Install some software with npm\nnpm install -g @angular/cli\nnpm install -g typescript\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add possibility to create placeholders in the version\n" }, { "from": "human", "value": "$script:version = (property version \"\")\r\n\r\ntask Version {\r\n\t$script:version = Set-Version . $version\r\n}\r\n\r\nfunction script:Set-Version($projectPath, $version) {\r\n\t$assemblyInfoFile = \"$projectPath\\Properties\\AssemblyInfo.cs\"\r\n\tif ($version) {\r\n\t\tif ((Test-Path $assemblyInfoFile)) {\r\n\t\t\tWrite-Host \"Updating $assemblyInfoFile\"\r\n\t\t\t$newAssemblyVersion = 'AssemblyVersion(\"' + $version + '\")'\r\n\t\t\t$newAssemblyFileVersion = 'AssemblyFileVersion(\"' + $version + '\")'\r\n\t\t\t$newFileContent = Get-Content $assemblyInfoFile |\r\n\t\t\t\t%{ $_ -replace 'AssemblyVersion\\(\"[0-9]+(\\.([0-9]+|\\*)){1,3}\"\\)', $newAssemblyVersion } |\r\n\t\t\t\t%{ $_ -replace 'AssemblyFileVersion\\(\"[0-9]+(\\.([0-9]+|\\*)){1,3}\"\\)', $newAssemblyFileVersion }\r\n\t\t\tSet-Content $assemblyInfoFile $newFileContent\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tWrite-Host \"Getting version from $assemblyInfoFile\"\r\n\t\t$version = Get-AssemblyFileVersion $assemblyInfoFile\r\n\t}\r\n\treturn $version\r\n}" }, { "from": "gpt", "value": "$script:version = (property version \"\")\r\n\r\ntask Version {\r\n\t$script:version = Set-Version . $version\r\n}\r\n\r\nfunction script:Set-Version($projectPath, $version) {\r\n\t$assemblyInfoFile = \"$projectPath\\Properties\\AssemblyInfo.cs\"\r\n\tif ($version) {\r\n\t\t\r\n\t\t$year = $(Get-date -f yyyy)\r\n\t\t$month = $(Get-date -f %M)\r\n\t\t$quarter = $([Math]::ceiling((Get-date -f MM)/3))\r\n\t\t$date = $(Get-date -f dd)\r\n\r\n\t\t$version = $version.Replace(\"{year}\", $year).Replace(\"{month}\", $month).Replace(\"{quarter}\", $quarter).Replace(\"{date}\", $date)\r\n\r\n\t\tif ((Test-Path $assemblyInfoFile)) {\r\n\t\t\tWrite-Host \"Updating $assemblyInfoFile\"\r\n\t\t\t$newAssemblyVersion = 'AssemblyVersion(\"' + $version + '\")'\r\n\t\t\t$newAssemblyFileVersion = 'AssemblyFileVersion(\"' + $version + '\")'\r\n\t\t\t$newFileContent = Get-Content $assemblyInfoFile |\r\n\t\t\t\t%{ $_ -replace 'AssemblyVersion\\(\"[0-9]+(\\.([0-9]+|\\*)){1,3}\"\\)', $newAssemblyVersion } |\r\n\t\t\t\t%{ $_ -replace 'AssemblyFileVersion\\(\"[0-9]+(\\.([0-9]+|\\*)){1,3}\"\\)', $newAssemblyFileVersion }\r\n\t\t\tSet-Content $assemblyInfoFile $newFileContent\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tWrite-Host \"Getting version from $assemblyInfoFile\"\r\n\t\t$version = Get-AssemblyFileVersion $assemblyInfoFile\r\n\t}\r\n\treturn $version\r\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Fix stale module import reference\n" }, { "from": "human", "value": "\n# Get and dot source all helper functions (private)\nSplit-Path -Path $PSScriptRoot |\n Join-Path -ChildPath 'Modules\\SecurityFever\\Helpers' |\n Get-ChildItem -Include '*.ps1' -Exclude '*.Tests.*' -Recurse |\n ForEach-Object { . $_.FullName }\n\n# Get and dot source all external functions (public)\nSplit-Path -Path $PSScriptRoot |\n Join-Path -ChildPath 'Modules\\SecurityFever\\Functions' |\n Get-ChildItem -Include '*.ps1' -Exclude '*.Tests.*' -Recurse |\n ForEach-Object { . $_.FullName }\n\n# Update format data\nUpdate-FormatData \"$PSScriptRoot\\..\\Modules\\SecurityFever\\Resources\\SecurityFever.Formats.ps1xml\"\n\n# Update type data\nUpdate-TypeData \"$PSScriptRoot\\..\\Modules\\SecurityFever\\Resources\\SecurityFever.Types.ps1xml\"\n\n# Execute deubg\n# ToDo...\n" }, { "from": "gpt", "value": "\n# Get and dot source all helper functions (private)\nSplit-Path -Path $PSScriptRoot |\n Join-Path -ChildPath 'Modules\\DSCPullServerWeb\\Helpers' |\n Get-ChildItem -Include '*.ps1' -Exclude '*.Tests.*' -Recurse |\n ForEach-Object { . $_.FullName }\n\n# Get and dot source all external functions (public)\nSplit-Path -Path $PSScriptRoot |\n Join-Path -ChildPath 'Modules\\DSCPullServerWeb\\Functions' |\n Get-ChildItem -Include '*.ps1' -Exclude '*.Tests.*' -Recurse |\n ForEach-Object { . $_.FullName }\n\n# Update format data\nUpdate-FormatData \"$PSScriptRoot\\..\\Modules\\DSCPullServerWeb\\Resources\\DSCPullServerWeb.Formats.ps1xml\"\n\n# Update type data\nUpdate-TypeData \"$PSScriptRoot\\..\\Modules\\DSCPullServerWeb\\Resources\\DSCPullServerWeb.Types.ps1xml\"\n\n# Execute deubg\n# ToDo...\n" } ]
powershell
chosen
[ { "from": "system", "value": "Replace (c) with unicode copyright symbol.\n" }, { "from": "human", "value": "function Set-Project-Properties($version) {\n write-host \"$version\"\n\n set-regenerated-file \"$pwd/Directory.Build.props\" @\"\n<Project>\n <PropertyGroup>\n <Version>$version</Version>\n <Copyright>$(get-copyright)</Copyright>\n </PropertyGroup>\n</Project>\n\"@\n}\n\nfunction Get-Copyright {\n $date = Get-Date\n $year = $date.Year\n $copyrightSpan = if ($year -eq $yearInitiated) { $year } else { \"$yearInitiated-$year\" }\n return \"(c) $copyrightSpan $owner\"\n}\n\nfunction Set-Regenerated-File($path, $newContent) {\n if (-not (test-path $path -PathType Leaf)) {\n $oldContent = $null\n } else {\n $oldContent = [IO.File]::ReadAllText($path)\n }\n\n if ($newContent -ne $oldContent) {\n write-host \"Generating $path\"\n [System.IO.File]::WriteAllText($path, $newContent, [System.Text.Encoding]::UTF8)\n }\n}\n\nfunction Remove-Directory-Silently($path) {\n if (test-path $path) {\n write-host \"Deleting $path\"\n Remove-Item $path -recurse -force -ErrorAction SilentlyContinue | out-null\n }\n}" }, { "from": "gpt", "value": "function Set-Project-Properties($version) {\n write-host \"$version\"\n\n set-regenerated-file \"$pwd/Directory.Build.props\" @\"\n<Project>\n <PropertyGroup>\n <Version>$version</Version>\n <Copyright>$(get-copyright)</Copyright>\n </PropertyGroup>\n</Project>\n\"@\n}\n\nfunction Get-Copyright {\n $date = Get-Date\n $year = $date.Year\n $copyrightSpan = if ($year -eq $yearInitiated) { $year } else { \"$yearInitiated-$year\" }\n return \" $copyrightSpan $owner\"\n}\n\nfunction Set-Regenerated-File($path, $newContent) {\n if (-not (test-path $path -PathType Leaf)) {\n $oldContent = $null\n } else {\n $oldContent = [IO.File]::ReadAllText($path)\n }\n\n if ($newContent -ne $oldContent) {\n write-host \"Generating $path\"\n [System.IO.File]::WriteAllText($path, $newContent, [System.Text.Encoding]::UTF8)\n }\n}\n\nfunction Remove-Directory-Silently($path) {\n if (test-path $path) {\n write-host \"Deleting $path\"\n Remove-Item $path -recurse -force -ErrorAction SilentlyContinue | out-null\n }\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Use dotnet nuget options name.\n\n" }, { "from": "human", "value": "$prefix = 'dotnet nuget push '\n$suffix = ' API_KEY -Source https://api.nuget.org/v3/index.json'\n\nGet-ChildItem .\\*.nupkg | Select-Object { $prefix + $_.Name + $suffix } | Out-File -width 1000 .\\push.bat -Force\n\n(gc .\\push.bat | select -Skip 3) | sc .\\push.bat\n\n\n\n\n" }, { "from": "gpt", "value": "$prefix = 'dotnet nuget push '\n$suffix = ' --source https://api.nuget.org/v3/index.json --api-key API_KEY'\n\nGet-ChildItem .\\*.nupkg | Select-Object { $prefix + $_.Name + $suffix } | Out-File -width 1000 .\\push.bat -Force\n\n(gc .\\push.bat | select -Skip 3) | sc .\\push.bat\n\n\n\n\n" } ]
powershell
chosen
[ { "from": "human", "value": "Build script for the CI server (properties don't work there)\n" }, { "from": "gpt", "value": "Framework \"4.0x86\"\n\nTask Build-Master {\n\tInvoke-Psake default.ps1 -properties @{autoVersion = $false}\n}\n\nTask Build-Develop {\n\tInvoke-Psake default.ps1\n}" } ]
powershell
chosen
[ { "from": "system", "value": "Revert bin folder for IIS. Test of process is running.\n" }, { "from": "human", "value": "param([string]$buildFolder)\r\n\r\n$outputPath = \"..\\output\";\r\n$sitePath = \"$($buildFolder)\\src\\WebSite\\bin\"\r\n$port = 58537\r\n$delay = 5000\r\n\r\nWrite-Host \"Running IIS Express from '$($sitePath)' at '$($port)'.\"\r\nStart-Process \"C:\\Program Files (x86)\\IIS Express\\iisexpress.exe\" -NoNewWindow -ArgumentList \"/path:$($sitePath) /port:$($port)\"\r\n\r\nWrite-Host \"Waiting $($delay).\"\r\nStart-Sleep -Milliseconds $delay\r\n\r\nWrite-Host \"Running StaticSiteCrawler.\"\r\n#Start-Process \"$($buildFolder)\\Tools\\StaticSiteCrawler.cmd\" -Wait\r\n.\\Tools\\StaticSiteCrawler.exe http://localhost:$($port)/ $outputPath /\r\n\r\nWrite-Host \"Content of output:\"\r\n$items = Get-ChildItem -Path $outputPath\r\nForEach ($item in $items) \r\n{ \r\n $size = (Get-Item \"$($outputPath)\\$($item)\").Length\r\n Write-Host \"'$($item)' - $($size)B\"\r\n}\r\n\r\nWrite-Host \"Stopping IIS Express.\"\r\nStop-Process -Name iisexpress" }, { "from": "gpt", "value": "param([string]$buildFolder)\r\n\r\n$outputPath = \"..\\output\";\r\n$sitePath = \"$($buildFolder)\\src\\WebSite\"\r\n$port = 58537\r\n$delay = 5000\r\n\r\nWrite-Host \"Running IIS Express from '$($sitePath)' at '$($port)'.\"\r\n$iis = Start-Process \"C:\\Program Files (x86)\\IIS Express\\iisexpress.exe\" -NoNewWindow -ArgumentList \"/path:$($sitePath) /port:$($port)\"\r\n\r\nWrite-Host \"Waiting $($delay).\"\r\nStart-Sleep -Milliseconds $delay\r\n\r\nIf ($iis.HasExited)\r\n{\r\n Write-Host \"IIS has exited\";\r\n}\r\n\r\nWrite-Host \"Running StaticSiteCrawler.\"\r\n#Start-Process \"$($buildFolder)\\Tools\\StaticSiteCrawler.cmd\" -Wait\r\n.\\Tools\\StaticSiteCrawler.exe http://localhost:$($port)/ $outputPath /\r\n\r\nWrite-Host \"Content of output:\"\r\n$items = Get-ChildItem -Path $outputPath\r\nForEach ($item in $items) \r\n{ \r\n $size = (Get-Item \"$($outputPath)\\$($item)\").Length\r\n Write-Host \"'$($item)' - $($size)B\"\r\n}\r\n\r\nWrite-Host \"Stopping IIS Express.\"\r\nStop-Process -Name iisexpress" } ]
powershell
chosen
[ { "from": "system", "value": "Enable Add-Type test on Windows\n\nResolves #606.\n" }, { "from": "human", "value": "Describe \"Add-Type\" {\n It \"Should not throw given a simple class definition\" -Skip:$IsWindows {\n\t{ Add-Type -TypeDefinition \"public static class foo { }\" } | Should Not Throw\n }\n}\n" }, { "from": "gpt", "value": "Describe \"Add-Type\" {\n It \"Should not throw given a simple class definition\" {\n\t{ Add-Type -TypeDefinition \"public static class foo { }\" } | Should Not Throw\n }\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Add ll function as alias\n" }, { "from": "human", "value": "sal gh help\nfunction sl.. { sl .. }\nfunction sl~ { sl ~ }\n\nfunction prompt {\n\t$Host.UI.RawUI.WindowTitle = \"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($NestedPromptLevel + 1))\"\n\treturn 'PS> '\n}\n" }, { "from": "gpt", "value": "sal gh help\nfunction ll([string[]]$Path = '.') { gci $Path -Exclude .* }\nfunction sl.. { sl .. }\nfunction sl~ { sl ~ }\n\nfunction prompt {\n\t$Host.UI.RawUI.WindowTitle = \"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($NestedPromptLevel + 1))\"\n\treturn 'PS> '\n}\n" } ]
powershell
chosen
[ { "from": "human", "value": "Add script to create msdeploy zip file\n" }, { "from": "gpt", "value": "$here = $PSScriptRoot\n$functionRootPath = \"$here\"\n$functionContentParentPath = \"$here\\..\\..\\..\\packaged-content\"\n$functionContentRootPath = \"$functionContentParentPath\\root\\App_Data\"\n\nfunction GetScenarios() {\n Get-ChildItem $functionRootPath -Directory `\n | ForEach-Object { @{ \"Group\" = $PSItem} } `\n | ForEach-Object {\n $group = $PSItem.Group\n Get-ChildItem \"$functionRootPath\\$group\" | ForEach-Object { [PSCustomObject]@{ \"Group\" = $group; \"Name\" = $PSItem}}\n }\n}\nfunction ResetOutputDirectory() {\n if (Test-Path $functionContentParentPath) {\n Remove-Item $functionContentParentPath -Recurse -Force\n }\n New-Item $functionContentRootPath -ItemType Directory | out-null\n Set-Content \"$functionContentParentPath\\.gitignore\" \"**/**\" # avoid accidentally committing this build output to source control :-)\n}\nfunction CopyScenarios($scenariosToCopy) {\n $scenariosToCopy | ForEach-Object {\n $scenario = $PSItem\n Copy-Item \"$functionRootPath\\$($scenario.Group)\\$($scenario.Name)\" \"$functionContentRootPath\\$($scenario.Group)\\$($scenario.Name)\" -Recurse\n }\n}\nfunction CopyDeployScript() {\n Copy-Item \"$functionRootPath\\deploy.ps1\" \"$functionContentParentPath\\root\\deploy.ps1\"\n}\nfunction CreateZip() {\n $zipPath = \"$functionContentParentPath/nether-serverless.zip\"\n if (Test-Path $zipPath) {\n Remove-Item $zipPath -Force\n }\n [Reflection.Assembly]::LoadWithPartialName( \"System.IO.Compression.FileSystem\" ) | out-null\n [System.IO.Compression.ZipFile]::CreateFromDirectory(\"$functionContentParentPath\\root\", \"$zipPath\", \"Fastest\", $false)\n}\n\n\nResetOutputDirectory\n$scenarios = GetScenarios\nCopyScenarios $scenarios\nCopyDeployScript\n\nCreateZip" } ]
powershell
chosen
[ { "from": "system", "value": "Handle errors for windows unit test\n\nSigned-off-by: Sunjay Bhatia <df2d57be7987a471915f625a5499155bc16d4200@pivotal.io>\n" }, { "from": "human", "value": "trap {\n write-error $_\n exit 1\n}\n\n$env:GOPATH = Join-Path -Path $PWD \"gopath\"\n$env:PATH = $env:GOPATH + \"/bin;C:/go/bin;\" + $env:PATH\n\ncd $env:GOPATH/src/github.com/cloudfoundry/bosh-agent\n\nif ((Get-Command \"go.exe\" -ErrorAction SilentlyContinue) -eq $null)\n{\n Write-Host \"Installing Go 1.6.3!\"\n Invoke-WebRequest https://storage.googleapis.com/golang/go1.6.3.windows-amd64.msi -OutFile go.msi\n\n $p = Start-Process -FilePath \"msiexec\" -ArgumentList \"/passive /norestart /i go.msi\" -Wait -PassThru\n\n if($p.ExitCode -ne 0)\n {\n throw \"Golang MSI installation process returned error code: $($p.ExitCode)\"\n }\n Write-Host \"Go is installed!\"\n}\n\n# Change constant for unit test process labels to prevent collisions with\n# bosh deployed Job Supervisor\n$file = Join-Path -Path $PWD jobsupervisor/windows_job_supervisor.go\n(Get-Content $file).replace('serviceDescription = \"vcap\"', 'serviceDescription = \"vcap_test\"') | Set-Content $file\n\ngo.exe install github.com/cloudfoundry/bosh-agent/vendor/github.com/onsi/ginkgo/ginkgo\nginkgo.exe -r -keepGoing -skipPackage=\"integration,vendor\"\n" }, { "from": "gpt", "value": "trap {\n write-error $_\n exit 1\n}\n\n$env:GOPATH = Join-Path -Path $PWD \"gopath\"\n$env:PATH = $env:GOPATH + \"/bin;C:/go/bin;\" + $env:PATH\n\ncd $env:GOPATH/src/github.com/cloudfoundry/bosh-agent\n\nif ((Get-Command \"go.exe\" -ErrorAction SilentlyContinue) -eq $null)\n{\n Write-Host \"Installing Go 1.6.3!\"\n Invoke-WebRequest https://storage.googleapis.com/golang/go1.6.3.windows-amd64.msi -OutFile go.msi\n\n $p = Start-Process -FilePath \"msiexec\" -ArgumentList \"/passive /norestart /i go.msi\" -Wait -PassThru\n\n if($p.ExitCode -ne 0)\n {\n throw \"Golang MSI installation process returned error code: $($p.ExitCode)\"\n }\n Write-Host \"Go is installed!\"\n}\n\n# Change constant for unit test process labels to prevent collisions with\n# bosh deployed Job Supervisor\n$file = Join-Path -Path $PWD jobsupervisor/windows_job_supervisor.go\n(Get-Content $file).replace('serviceDescription = \"vcap\"', 'serviceDescription = \"vcap_test\"') | Set-Content $file\n\ngo.exe install github.com/cloudfoundry/bosh-agent/vendor/github.com/onsi/ginkgo/ginkgo\nginkgo.exe -r -keepGoing -skipPackage=\"integration,vendor\"\nif ($LastExitCode -ne 0)\n{\n Write-Error $_\n exit 1\n}\n" } ]
powershell
chosen
[ { "from": "system", "value": "Fix option names in AlignAssignmentStatement rule test\n" }, { "from": "human", "value": "$directory = Split-Path -Parent $MyInvocation.MyCommand.Path\n$testRootDirectory = Split-Path -Parent $directory\n\nImport-Module PSScriptAnalyzer\nImport-Module (Join-Path $testRootDirectory \"PSScriptAnalyzerTestHelper.psm1\")\n\n$ruleConfiguration = @{\n Enable = $true\n AlignInHashtable = $true\n AlignInDSCConfiguration = $true\n}\n\n$settings = @{\n IncludeRules = @(\"PSAlignAssignmentStatement\")\n Rules = @{\n PSAlignAssignmentStatement = $ruleConfiguration\n }\n}\n\nDescribe \"AlignAssignmentStatement\" {\n Context \"Hashtable\" {\n It \"Should align assignment statements in a hashtable\" {\n $def = @'\n$hashtable = @{\n property1 = \"value\"\n anotherProperty = \"another value\"\n}\n'@\n\n# Expected output should be the following\n# $hashtable = @{\n# property1 = \"value\"\n# anotherProperty = \"another value\"\n# }\n\n $violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings\n $violations.Count | Should Be 1\n Test-CorrectionExtentFromContent $def $violations 1 '' ' '\n }\n }\n}\n" }, { "from": "gpt", "value": "$directory = Split-Path -Parent $MyInvocation.MyCommand.Path\n$testRootDirectory = Split-Path -Parent $directory\n\nImport-Module PSScriptAnalyzer\nImport-Module (Join-Path $testRootDirectory \"PSScriptAnalyzerTestHelper.psm1\")\n\n$ruleConfiguration = @{\n Enable = $true\n CheckHashtable = $true\n CheckDSCConfiguration = $true\n}\n\n$settings = @{\n IncludeRules = @(\"PSAlignAssignmentStatement\")\n Rules = @{\n PSAlignAssignmentStatement = $ruleConfiguration\n }\n}\n\nDescribe \"AlignAssignmentStatement\" {\n Context \"Hashtable\" {\n It \"Should align assignment statements in a hashtable\" {\n $def = @'\n$hashtable = @{\n property1 = \"value\"\n anotherProperty = \"another value\"\n}\n'@\n\n# Expected output should be the following\n# $hashtable = @{\n# property1 = \"value\"\n# anotherProperty = \"another value\"\n# }\n\n $violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings\n $violations.Count | Should Be 1\n Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '\n }\n }\n}\n" } ]
powershell
chosen