Skip to content

Commit 943103c

Browse files
committed
Use downloadAndExtract() for truffleruby+graalvm too
* Simpler and more consistent that way. * Avoids rerunning the post-install hook every time.
1 parent 7dc18ff commit 943103c

File tree

2 files changed

+12
-42
lines changed

2 files changed

+12
-42
lines changed

dist/index.js

Lines changed: 6 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ruby-builder.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ export async function install(platform, engine, version) {
5151

5252
if (!inToolCache) {
5353
await io.mkdirP(rubyPrefix)
54-
if (engine === 'truffleruby+graalvm') {
55-
await installWithRubyBuild(engine, version, rubyPrefix)
56-
} else {
57-
await downloadAndExtract(platform, engine, version, rubyPrefix)
58-
}
54+
await downloadAndExtract(platform, engine, version, rubyPrefix)
5955
}
6056

6157
// https://github.com/oracle/truffleruby/issues/3390
@@ -67,21 +63,6 @@ export async function install(platform, engine, version) {
6763
return rubyPrefix
6864
}
6965

70-
async function installWithRubyBuild(engine, version, rubyPrefix) {
71-
const tmp = process.env['RUNNER_TEMP'] || os.tmpdir()
72-
const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')
73-
await common.measure('Cloning ruby-build', async () => {
74-
await exec.exec('git', ['clone', 'https://github.com/rbenv/ruby-build.git', rubyBuildDir])
75-
})
76-
77-
const rubyName = `${engine}-${version === 'head' ? 'dev' : version}`
78-
await common.measure(`Installing ${engine}-${version} with ruby-build`, async () => {
79-
await exec.exec(`${rubyBuildDir}/bin/ruby-build`, [rubyName, rubyPrefix])
80-
})
81-
82-
await io.rmRF(rubyBuildDir)
83-
}
84-
8566
async function downloadAndExtract(platform, engine, version, rubyPrefix) {
8667
const parentDir = path.dirname(rubyPrefix)
8768

@@ -125,5 +106,9 @@ function getDownloadURL(platform, engine, version) {
125106
}
126107

127108
function getLatestHeadBuildURL(platform, engine, version) {
128-
return `https://github.com/ruby/${engine}-dev-builder/releases/latest/download/${engine}-${version}-${platform}.tar.gz`
109+
var repo = `${engine}-dev-builder`
110+
if (engine === 'truffleruby+graalvm') {
111+
repo = 'truffleruby-dev-builder'
112+
}
113+
return `https://github.com/ruby/${repo}/releases/latest/download/${engine}-${version}-${platform}.tar.gz`
129114
}

0 commit comments

Comments
 (0)