From 3da900d7db7e76726e616e15fd0442954024d730 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 9 Aug 2018 10:12:35 -0400 Subject: [PATCH] rename scripts --- scripts/choco-pack.ps1 | 34 ++++++++++++++++++++++++++++++++++ scripts/choco-push.ps1 | 26 -------------------------- scripts/choco-update.ps1 | 30 +++++++++++------------------- 3 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 scripts/choco-pack.ps1 delete mode 100644 scripts/choco-push.ps1 diff --git a/scripts/choco-pack.ps1 b/scripts/choco-pack.ps1 new file mode 100644 index 0000000000..a43b4aa4ed --- /dev/null +++ b/scripts/choco-pack.ps1 @@ -0,0 +1,34 @@ +param ( + [switch] $push +) + +# To run: +# .\choco-pack.ps1 + +$dir = Split-Path -Parent $MyInvocation.MyCommand.Path; +$rootDir = $dir + "\.."; +$distDir = $rootDir + "\dist"; +$chocoDir = $rootDir + "\stores\chocolatey"; +$distChocoDir = $distDir + "\chocolatey"; +$distChocoToolsDir = $distDir + "\chocolatey\tools"; + +if(Test-Path -Path $distChocoDir) { + Remove-Item -Recurse -Force $distChocoDir +} + +$exe = $distDir + "\windows\bw.exe"; +$license = $rootDir + "\LICENSE.txt"; +Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse +Copy-Item $exe -Destination $distChocoToolsDir; +Copy-Item $license -Destination $distChocoToolsDir; + +$srcPackage = $rootDir + "\package.json"; +$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version; +$nuspec = $distChocoDir + "\bitwarden-cli.nuspec"; +choco pack $nuspec --version $srcPackageVersion --out $distChocoDir + +if ($push) { + cd $distChocoDir + choco push + cd $rootDir +} diff --git a/scripts/choco-push.ps1 b/scripts/choco-push.ps1 deleted file mode 100644 index 8d4d854931..0000000000 --- a/scripts/choco-push.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -param ( - [Parameter(Mandatory=$true)] - [string] $version -) - -# To run: -# .\choco-push.ps1 -version 1.3.0 - -$dir = Split-Path -Parent $MyInvocation.MyCommand.Path; -$rootDir = $dir + "\.."; -$distDir = $rootDir + "\dist"; -$distChocoDir = $distDir + "\chocolatey"; - -if(Test-Path -Path $distChocoDir) { - Remove-Item -Recurse -Force $distChocoDir -} -New-Item -ItemType directory -Path $distChocoDir | Out-Null - -$nupkg = "bitwarden-cli." + $version + ".nupkg" -$uri = "https://github.com/bitwarden/cli/releases/download/v" + $version + "/" + $nupkg; -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -Invoke-RestMethod -Uri $uri -OutFile $($distChocoDir + "\" + $nupkg) - -cd $distChocoDir -choco push -cd $rootDir diff --git a/scripts/choco-update.ps1 b/scripts/choco-update.ps1 index 81598f56b4..f1b5e295be 100644 --- a/scripts/choco-update.ps1 +++ b/scripts/choco-update.ps1 @@ -1,34 +1,26 @@ param ( - [switch] $nopush + [Parameter(Mandatory=$true)] + [string] $version ) # To run: -# .\choco-update.ps1 +# .\choco-update.ps1 -version 1.3.0 $dir = Split-Path -Parent $MyInvocation.MyCommand.Path; $rootDir = $dir + "\.."; $distDir = $rootDir + "\dist"; -$chocoDir = $rootDir + "\stores\chocolatey"; $distChocoDir = $distDir + "\chocolatey"; -$distChocoToolsDir = $distDir + "\chocolatey\tools"; if(Test-Path -Path $distChocoDir) { Remove-Item -Recurse -Force $distChocoDir } +New-Item -ItemType directory -Path $distChocoDir | Out-Null -$exe = $distDir + "\windows\bw.exe"; -$license = $rootDir + "\LICENSE.txt"; -Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse -Copy-Item $exe -Destination $distChocoToolsDir; -Copy-Item $license -Destination $distChocoToolsDir; +$nupkg = "bitwarden-cli." + $version + ".nupkg" +$uri = "https://github.com/bitwarden/cli/releases/download/v" + $version + "/" + $nupkg; +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Invoke-RestMethod -Uri $uri -OutFile $($distChocoDir + "\" + $nupkg) -$srcPackage = $rootDir + "\package.json"; -$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version; -$nuspec = $distChocoDir + "\bitwarden-cli.nuspec"; -choco pack $nuspec --version $srcPackageVersion --out $distChocoDir - -if (!$nopush) { - cd $distChocoDir - choco push - cd $rootDir -} +cd $distChocoDir +choco push +cd $rootDir