rename scripts

This commit is contained in:
Kyle Spearrin 2018-08-09 10:12:35 -04:00
parent 4759bd300e
commit 3da900d7db
3 changed files with 45 additions and 45 deletions

34
scripts/choco-pack.ps1 Normal file
View File

@ -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
}

View File

@ -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

View File

@ -1,34 +1,26 @@
param ( param (
[switch] $nopush [Parameter(Mandatory=$true)]
[string] $version
) )
# To run: # To run:
# .\choco-update.ps1 # .\choco-update.ps1 -version 1.3.0
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path; $dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
$rootDir = $dir + "\.."; $rootDir = $dir + "\..";
$distDir = $rootDir + "\dist"; $distDir = $rootDir + "\dist";
$chocoDir = $rootDir + "\stores\chocolatey";
$distChocoDir = $distDir + "\chocolatey"; $distChocoDir = $distDir + "\chocolatey";
$distChocoToolsDir = $distDir + "\chocolatey\tools";
if(Test-Path -Path $distChocoDir) { if(Test-Path -Path $distChocoDir) {
Remove-Item -Recurse -Force $distChocoDir Remove-Item -Recurse -Force $distChocoDir
} }
New-Item -ItemType directory -Path $distChocoDir | Out-Null
$exe = $distDir + "\windows\bw.exe"; $nupkg = "bitwarden-cli." + $version + ".nupkg"
$license = $rootDir + "\LICENSE.txt"; $uri = "https://github.com/bitwarden/cli/releases/download/v" + $version + "/" + $nupkg;
Copy-Item -Path $chocoDir -Destination $distChocoDir Recurse [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Copy-Item $exe -Destination $distChocoToolsDir; Invoke-RestMethod -Uri $uri -OutFile $($distChocoDir + "\" + $nupkg)
Copy-Item $license -Destination $distChocoToolsDir;
$srcPackage = $rootDir + "\package.json"; cd $distChocoDir
$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version; choco push
$nuspec = $distChocoDir + "\bitwarden-cli.nuspec"; cd $rootDir
choco pack $nuspec --version $srcPackageVersion --out $distChocoDir
if (!$nopush) {
cd $distChocoDir
choco push
cd $rootDir
}