diff --git a/README.md b/README.md index 3af78fd..24100ce 100644 --- a/README.md +++ b/README.md @@ -49,14 +49,6 @@ Make sure to source `jabba.sh` in your environment if you skip it: export JABBA_VERSION=... [ -s "$JABBA_HOME/jabba.sh" ] && source "$JABBA_HOME/jabba.sh" ``` -> (in powershell) - -```powershell -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -Invoke-Expression ( - Invoke-WebRequest https://github.com/shyiko/jabba/raw/master/install.ps1 -UseBasicParsing -).Content -``` > In [fish](https://fishshell.com/) command looks a little bit different - > export JABBA_VERSION=... diff --git a/install.ps1 b/install.ps1 index 4912d4b..1bf0980 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,25 +1,7 @@ $ErrorActionPreference = "Stop" -$sep = [IO.Path]::DirectorySeparatorChar -$jabbaHome = if ($env:JABBA_HOME) { - $env:JABBA_HOME -} else { - if ($env:JABBA_DIR) { - $env:JABBA_DIR - } else { - if($env:USERPROFILE){ - "$env:USERPROFILE" + $sep + ".jabba" - }else{ - "$env:HOME" + $sep + ".jabba" - } - } -} +$jabbaHome = if ($env:JABBA_HOME) { $env:JABBA_HOME } else { if ($env:JABBA_DIR) { $env:JABBA_DIR } else { "$env:USERPROFILE\.jabba" } } $jabbaVersion = if ($env:JABBA_VERSION) { $env:JABBA_VERSION } else { "latest" } -# The Windows values of the Platform enum are: -# 0 (Win32NT), 1 (Win32S), 2 (Win32Windows) and 3 (WinCE). -# Other values are larger and indicate non Windows operating systems -$isOnWindows = [System.Environment]::OSVersion.Platform.value__ > 3 -$jabbaExecutableName = $isOnWindows ? "jabba.exe" : "jabba" if ($jabbaVersion -eq "latest") { @@ -43,35 +25,17 @@ if ($env:JABBA_MAKE_INSTALL -eq "true") } else { - # $isOnWindows, see top of the file - # macOS enum value: 6 - # Unix enum value: 4 - if($isOnWindows){ - Invoke-WebRequest https://github.com/shyiko/jabba/releases/download/$jabbaVersion/jabba-$jabbaVersion-windows-amd64.exe -UseBasicParsing -OutFile $jabbaHome/bin/$jabbaExecutableName - } - elseif([System.Environment]::OSVersion.Platform.value__ -eq 4 || [System.Environment]::OSVersion.Platform.value__ -eq 6){ - Invoke-WebRequest https://github.com/shyiko/jabba/releases/download/$jabbaVersion/jabba-$jabbaVersion-darwin-amd64 -UseBasicParsing -OutFile $jabbaHome/bin/$jabbaExecutableName - }else{ - $osArch = [System.Environment]::Is64BitOperatingSystem ? "amd64" : "386" - Invoke-WebRequest https://github.com/shyiko/jabba/releases/download/$jabbaVersion/jabba-$jabbaVersion-linux-${OSARCH} -UseBasicParsing -OutFile $jabbaHome/bin/$jabbaExecutableName - } + Invoke-WebRequest https://github.com/shyiko/jabba/releases/download/$jabbaVersion/jabba-$jabbaVersion-windows-amd64.exe -UseBasicParsing -OutFile $jabbaHome/bin/jabba.exe } $ErrorActionPreference="SilentlyContinue" - -if($isOnWindows){ - & "$jabbaHome\bin\$jabbaExecutableName" --version | Out-Null -}else{ - chmod a+x "$jabbaHome/bin/$jabbaExecutableName" - & "$jabbaHome/bin/$jabbaExecutableName" --version | Out-Null -} - +& $jabbaHome\bin\jabba.exe --version | Out-Null $binaryValid = $? $ErrorActionPreference="Continue" if (-not $binaryValid) { - Write-Host -ForegroundColor Yellow @" -$jabbaHome\bin\$jabbaExecutableName does not appear to be a valid binary. + Write-Host @" +$jabbaHome\bin\jabba does not appear to be a valid binary. Check your Internet connection / proxy settings and try again. if the problem persists - please create a ticket at https://github.com/shyiko/jabba/issues. @@ -85,7 +49,7 @@ if the problem persists - please create a ticket at https://github.com/shyiko/ja function jabba { `$fd3=`$([System.IO.Path]::GetTempFileName()) - `$command="& '$jabbaHome\bin\$jabbaExecutableName' `$args --fd3 ```"`$fd3```"" + `$command="& '$jabbaHome\bin\jabba.exe' `$args --fd3 ```"`$fd3```"" & { `$env:JABBA_SHELL_INTEGRATION="ON"; Invoke-Expression `$command } `$fd3content=`$(Get-Content `$fd3) if (`$fd3content) { @@ -117,6 +81,6 @@ else Write-Host @" -Installation completed (you might need to restart your terminal for the jabba command to be available) +Installation completed (if you have any problems please report them at https://github.com/shyiko/jabba/issues) "@