diff --git a/dist/index.js b/dist/index.js index 4949faf..4c0458b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -960,6 +960,7 @@ const os = __webpack_require__(87) const fs = __webpack_require__(747) const path = __webpack_require__(622) const core = __webpack_require__(470) +const exec = __webpack_require__(986) async function run() { try { @@ -981,6 +982,9 @@ async function run() { const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby) setupPath(ruby, newPathEntries) + + await installBundler(platform, rubyPrefix) + core.setOutput('ruby-prefix', rubyPrefix) } catch (error) { core.setFailed(error.message) @@ -1065,6 +1069,14 @@ function setupPath(ruby, newPathEntries) { core.exportVariable('PATH', [...newPathEntries, ...cleanPath].join(path.delimiter)) } +async function installBundler(platform, rubyPrefix) { + const bundle_exe = platform === 'windows-latest' ? 'bundle.cmd' : 'bundle' + // Install Bundler if not already part of the stdlib + if (!fs.existsSync(path.join(rubyPrefix, 'bin', bundle_exe))) { + await exec.exec(path.join(rubyPrefix, 'bin', 'gem'), ['install', 'bundler', '-v', '~> 1', '--no-document']) + } +} + function getVirtualEnvironmentName() { const platform = os.platform() if (platform === 'linux') { @@ -4858,11 +4870,6 @@ async function install(platform, ruby) { await setupMSWin() : await setupMingw(version) const newPathEntries = [`${rubyPrefix}\\bin`, ...toolchainPaths] - // Install Bundler if needed - if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) { - await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`) - } - return [rubyPrefix, newPathEntries] } diff --git a/index.js b/index.js index 1cda431..814e6f3 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const os = require('os') const fs = require('fs') const path = require('path') const core = require('@actions/core') +const exec = require('@actions/exec') export async function run() { try { @@ -23,6 +24,9 @@ export async function run() { const [rubyPrefix, newPathEntries] = await installer.install(platform, ruby) setupPath(ruby, newPathEntries) + + await installBundler(platform, rubyPrefix) + core.setOutput('ruby-prefix', rubyPrefix) } catch (error) { core.setFailed(error.message) @@ -107,6 +111,14 @@ function setupPath(ruby, newPathEntries) { core.exportVariable('PATH', [...newPathEntries, ...cleanPath].join(path.delimiter)) } +async function installBundler(platform, rubyPrefix) { + const bundle_exe = platform === 'windows-latest' ? 'bundle.cmd' : 'bundle' + // Install Bundler if not already part of the stdlib + if (!fs.existsSync(path.join(rubyPrefix, 'bin', bundle_exe))) { + await exec.exec(path.join(rubyPrefix, 'bin', 'gem'), ['install', 'bundler', '-v', '~> 1', '--no-document']) + } +} + function getVirtualEnvironmentName() { const platform = os.platform() if (platform === 'linux') { diff --git a/windows.js b/windows.js index 3edef9e..198be18 100644 --- a/windows.js +++ b/windows.js @@ -50,11 +50,6 @@ export async function install(platform, ruby) { await setupMSWin() : await setupMingw(version) const newPathEntries = [`${rubyPrefix}\\bin`, ...toolchainPaths] - // Install Bundler if needed - if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) { - await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`) - } - return [rubyPrefix, newPathEntries] }