mirror of
https://github.com/danbulant/deno_install
synced 2026-07-06 11:40:39 +00:00
Fix PowerShell IsWindows usage (#32)
This commit is contained in:
parent
aff069cf34
commit
7edda0f115
2 changed files with 13 additions and 18 deletions
19
install.ps1
19
install.ps1
|
|
@ -10,41 +10,38 @@ param (
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 6) {
|
if ($PSVersionTable.PSVersion.Major -lt 6) {
|
||||||
$IsWin = $true
|
$IsWindows = $true
|
||||||
$IsOsx = $false
|
$IsMacOS = $false
|
||||||
} else {
|
|
||||||
$IsWin = $IsWindows
|
|
||||||
$IsOsx = $IsMacOS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$BinDir = if ($IsWin) {
|
$BinDir = if ($IsWindows) {
|
||||||
"$Home\.deno\bin"
|
"$Home\.deno\bin"
|
||||||
} else {
|
} else {
|
||||||
"$Home/.deno/bin"
|
"$Home/.deno/bin"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Zip = if ($IsWin) {
|
$Zip = if ($IsWindows) {
|
||||||
'zip'
|
'zip'
|
||||||
} else {
|
} else {
|
||||||
'gz'
|
'gz'
|
||||||
}
|
}
|
||||||
|
|
||||||
$DenoZip = if ($IsWin) {
|
$DenoZip = if ($IsWindows) {
|
||||||
"$BinDir\deno.$Zip"
|
"$BinDir\deno.$Zip"
|
||||||
} else {
|
} else {
|
||||||
"$BinDir/deno.$Zip"
|
"$BinDir/deno.$Zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
$DenoExe = if ($IsWin) {
|
$DenoExe = if ($IsWindows) {
|
||||||
"$BinDir\deno.exe"
|
"$BinDir\deno.exe"
|
||||||
} else {
|
} else {
|
||||||
"$BinDir/deno"
|
"$BinDir/deno"
|
||||||
}
|
}
|
||||||
|
|
||||||
$OS = if ($IsWin) {
|
$OS = if ($IsWindows) {
|
||||||
'win'
|
'win'
|
||||||
} else {
|
} else {
|
||||||
if ($IsOsx) {
|
if ($IsMacOS) {
|
||||||
'osx'
|
'osx'
|
||||||
} else {
|
} else {
|
||||||
'linux'
|
'linux'
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,14 @@ if (!(Get-Module PSScriptAnalyzer -ListAvailable)) {
|
||||||
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
|
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoke-ScriptAnalyzer *.ps1 -EnableExit
|
Invoke-ScriptAnalyzer *.ps1 -Exclude PSAvoidAssignmentToAutomaticVariable
|
||||||
|
|
||||||
$IsWin = if ($PSVersionTable.PSVersion.Major -lt 6) {
|
if ($PSVersionTable.PSVersion.Major -lt 6) {
|
||||||
$true
|
$IsWindows = $true
|
||||||
} else {
|
|
||||||
$IsWindows
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.\install.ps1 v0.2.0
|
.\install.ps1 v0.2.0
|
||||||
$DenoVersion = if ($IsWin) {
|
$DenoVersion = if ($IsWindows) {
|
||||||
deno --version
|
deno --version
|
||||||
} else {
|
} else {
|
||||||
~/.deno/bin/deno --version
|
~/.deno/bin/deno --version
|
||||||
|
|
@ -31,7 +29,7 @@ if (!($DenoVersion[0] -eq 'deno: 0.2.0')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
.\install.ps1
|
.\install.ps1
|
||||||
$DenoVersion = if ($IsWin) {
|
$DenoVersion = if ($IsWindows) {
|
||||||
deno --version
|
deno --version
|
||||||
} else {
|
} else {
|
||||||
~/.deno/bin/deno --version
|
~/.deno/bin/deno --version
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue