Skip to content

Commit

Permalink
Add ridk option to disable ridk env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 16, 2024
1 parent b203567 commit 44726b4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ inputs:
Consider the runner as a self-hosted runner, which means not using prebuilt Ruby binaries which only work
on GitHub-hosted runners or self-hosted runners with a very similar image to the ones used by GitHub runners.
The default is to detect this automatically based on the OS, OS version and architecture.
ridk:
description: 'By default, ridk environment variables are added for Windows. For "none", nothing is done.'
outputs:
ruby-prefix:
description: 'The prefix of the installed ruby'
Expand Down
10 changes: 6 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export async function setupRuby(options = {}) {
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])

let installer
const installOptions = {}
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
installer = require('./windows')
installOptions['ridk'] = inputs['ridk']
} else {
installer = require('./ruby-builder')
}
Expand All @@ -70,7 +72,7 @@ export async function setupRuby(options = {}) {
await require('./windows').installJRubyTools()
}

const rubyPrefix = await installer.install(platform, engine, version)
const rubyPrefix = await installer.install(platform, engine, version, installOptions)

await common.measure('Print Ruby version', async () =>
await exec.exec('ruby', ['--version']))
Expand Down
2 changes: 1 addition & 1 deletion ruby-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getAvailableVersions(platform, engine) {
return rubyBuilderVersions[engine]
}

export async function install(platform, engine, version) {
export async function install(platform, engine, version, installOptions) {
let rubyPrefix, inToolCache
if (common.shouldUseToolCache(engine, version)) {
inToolCache = common.toolCacheFind(engine, version)
Expand Down
4 changes: 2 additions & 2 deletions windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getAvailableVersions(platform, engine) {
}
}

export async function install(platform, engine, version) {
export async function install(platform, engine, version, installOptions) {
const url = rubyInstallerVersions[version]

// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
Expand Down Expand Up @@ -90,7 +90,7 @@ export async function install(platform, engine, version) {
}

const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
if (fs.existsSync(ridk)) {
if (fs.existsSync(ridk) && installOptions['ridk'] !== 'none') {
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
}

Expand Down

0 comments on commit 44726b4

Please sign in to comment.