mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Allow running external function before 'bundle install'
External actions may use setup-ruby, and some actions make changes/additions to the build environment. These may be needed for dependencies. Hence, allow those external actions to run code before 'bundle install'. This is done by passing a function as a parameter to setupRuby().
This commit is contained in:
+9
-2
@@ -2202,14 +2202,14 @@ const inputDefaults = {
|
||||
// entry point when this action is run on its own
|
||||
async function run() {
|
||||
try {
|
||||
await setupRuby({})
|
||||
await setupRuby()
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
// entry point when this action is run from other actions
|
||||
async function setupRuby(options) {
|
||||
async function setupRuby(options = {}) {
|
||||
const inputs = { ...options }
|
||||
for (const key in inputDefaults) {
|
||||
if (!inputs.hasOwnProperty(key)) {
|
||||
@@ -2238,6 +2238,13 @@ async function setupRuby(options) {
|
||||
|
||||
setupPath(newPathEntries)
|
||||
|
||||
// When setup-ruby is used by other actions, this allows code in them to run
|
||||
// before 'bundle install'. Installed dependencies may require additional
|
||||
// libraries & headers, build tools, etc.
|
||||
if (inputs['afterSetupPathHook'] instanceof Function) {
|
||||
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
|
||||
}
|
||||
|
||||
if (inputs['bundler'] !== 'none') {
|
||||
await common.measure('Installing Bundler', async () =>
|
||||
installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
|
||||
|
||||
@@ -16,14 +16,14 @@ const inputDefaults = {
|
||||
// entry point when this action is run on its own
|
||||
export async function run() {
|
||||
try {
|
||||
await setupRuby({})
|
||||
await setupRuby()
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
// entry point when this action is run from other actions
|
||||
export async function setupRuby(options) {
|
||||
export async function setupRuby(options = {}) {
|
||||
const inputs = { ...options }
|
||||
for (const key in inputDefaults) {
|
||||
if (!inputs.hasOwnProperty(key)) {
|
||||
@@ -52,6 +52,13 @@ export async function setupRuby(options) {
|
||||
|
||||
setupPath(newPathEntries)
|
||||
|
||||
// When setup-ruby is used by other actions, this allows code in them to run
|
||||
// before 'bundle install'. Installed dependencies may require additional
|
||||
// libraries & headers, build tools, etc.
|
||||
if (inputs['afterSetupPathHook'] instanceof Function) {
|
||||
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
|
||||
}
|
||||
|
||||
if (inputs['bundler'] !== 'none') {
|
||||
await common.measure('Installing Bundler', async () =>
|
||||
installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
|
||||
|
||||
Reference in New Issue
Block a user