deno_install/install_test.ps1
Nayeem Rahman 7b3d3daf45 fix: Don't use version as a subcommand (#88)
Fix DENO_INSTALL example
2019-12-06 08:10:06 -05:00

45 lines
957 B
PowerShell
Executable file

#!/usr/bin/env pwsh
$ErrorActionPreference = 'Stop'
if ($PSVersionTable.PSEdition -ne 'Core') {
$IsWindows = $true
}
if (!(Get-PSRepository)) {
Register-PSRepository -Default
}
if (!(Get-Module PSScriptAnalyzer -ListAvailable)) {
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
}
# Lint.
Invoke-ScriptAnalyzer *.ps1 -EnableExit -Exclude PSAvoidAssignmentToAutomaticVariable
$BinDir = if ($IsWindows) {
"$Home\.deno\bin"
} else {
"$Home/.deno/bin"
}
# Test we can install a specific version.
Remove-Item $BinDir -Recurse -Force -ErrorAction SilentlyContinue
.\install.ps1 v0.13.0
$DenoVersion = if ($IsWindows) {
deno --version
} else {
~/.deno/bin/deno --version
}
if (!($DenoVersion -like '*0.13.0*')) {
throw $DenoVersion
}
# Test we can install the latest version.
Remove-Item $BinDir -Recurse -Force -ErrorAction SilentlyContinue
.\install.ps1
if ($IsWindows) {
deno --version
} else {
~/.deno/bin/deno --version
}