mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-31 11:06:09 +00:00
Add Windows to the mix (#49)
This commit is contained in:
committed by
GitHub
parent
dd4eb24e91
commit
82b4475ba2
+25
-5
@@ -8,7 +8,13 @@ const path = require('path')
|
||||
* @param {string} otpVersion
|
||||
*/
|
||||
async function installOTP(osVersion, otpVersion) {
|
||||
await exec(path.join(__dirname, 'install-otp'), [osVersion, otpVersion])
|
||||
const OS = process.platform
|
||||
if (OS === 'linux') {
|
||||
await exec(path.join(__dirname, 'install-otp.sh'), [osVersion, otpVersion])
|
||||
} else if (OS === 'win32') {
|
||||
const script = path.join(__dirname, 'install-otp.ps1')
|
||||
await exec(`powershell.exe ${script} -VSN:${otpVersion}`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17,7 +23,13 @@ async function installOTP(osVersion, otpVersion) {
|
||||
* @param {string} elixirVersion
|
||||
*/
|
||||
async function installElixir(elixirVersion) {
|
||||
await exec(path.join(__dirname, 'install-elixir'), [elixirVersion])
|
||||
const OS = process.platform
|
||||
if (OS === 'linux') {
|
||||
await exec(path.join(__dirname, 'install-elixir.sh'), [elixirVersion])
|
||||
} else if (OS === 'win32') {
|
||||
const script = path.join(__dirname, 'install-elixir.ps1')
|
||||
await exec(`powershell.exe ${script} ${elixirVersion}`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,12 +38,20 @@ async function installElixir(elixirVersion) {
|
||||
* @param {string} rebar3Version
|
||||
*/
|
||||
async function installRebar3(rebar3Version) {
|
||||
await exec(path.join(__dirname, 'install-rebar3'), [rebar3Version])
|
||||
const OS = process.platform
|
||||
if (OS === 'linux') {
|
||||
await exec(path.join(__dirname, 'install-rebar3.sh'), [rebar3Version])
|
||||
} else if (OS === 'win32') {
|
||||
const script = path.join(__dirname, 'install-rebar3.ps1')
|
||||
await exec(`powershell.exe ${script} -VSN:${rebar3Version}`)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPlatform() {
|
||||
if (process.platform !== 'linux') {
|
||||
throw new Error('@erlef/setup-beam only supports Ubuntu Linux at this time')
|
||||
if (process.platform !== 'linux' && process.platform !== 'win32') {
|
||||
throw new Error(
|
||||
'@erlef/setup-beam only supports Ubuntu and Windows at this time',
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user