Fix PowerShell IsWindows usage (#32)

This commit is contained in:
Mark Tiedemann 2019-01-23 22:25:36 +01:00 committed by Ryan Dahl
parent aff069cf34
commit 7edda0f115
2 changed files with 13 additions and 18 deletions

View file

@ -10,41 +10,38 @@ param (
$ErrorActionPreference = 'Stop'
if ($PSVersionTable.PSVersion.Major -lt 6) {
$IsWin = $true
$IsOsx = $false
} else {
$IsWin = $IsWindows
$IsOsx = $IsMacOS
$IsWindows = $true
$IsMacOS = $false
}
$BinDir = if ($IsWin) {
$BinDir = if ($IsWindows) {
"$Home\.deno\bin"
} else {
"$Home/.deno/bin"
}
$Zip = if ($IsWin) {
$Zip = if ($IsWindows) {
'zip'
} else {
'gz'
}
$DenoZip = if ($IsWin) {
$DenoZip = if ($IsWindows) {
"$BinDir\deno.$Zip"
} else {
"$BinDir/deno.$Zip"
}
$DenoExe = if ($IsWin) {
$DenoExe = if ($IsWindows) {
"$BinDir\deno.exe"
} else {
"$BinDir/deno"
}
$OS = if ($IsWin) {
$OS = if ($IsWindows) {
'win'
} else {
if ($IsOsx) {
if ($IsMacOS) {
'osx'
} else {
'linux'

View file

@ -10,16 +10,14 @@ if (!(Get-Module PSScriptAnalyzer -ListAvailable)) {
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
}
Invoke-ScriptAnalyzer *.ps1 -EnableExit
Invoke-ScriptAnalyzer *.ps1 -Exclude PSAvoidAssignmentToAutomaticVariable
$IsWin = if ($PSVersionTable.PSVersion.Major -lt 6) {
$true
} else {
$IsWindows
if ($PSVersionTable.PSVersion.Major -lt 6) {
$IsWindows = $true
}
.\install.ps1 v0.2.0
$DenoVersion = if ($IsWin) {
$DenoVersion = if ($IsWindows) {
deno --version
} else {
~/.deno/bin/deno --version
@ -31,7 +29,7 @@ if (!($DenoVersion[0] -eq 'deno: 0.2.0')) {
}
.\install.ps1
$DenoVersion = if ($IsWin) {
$DenoVersion = if ($IsWindows) {
deno --version
} else {
~/.deno/bin/deno --version