From 519db06c306e13ec7930da164e2bd763ff3563b0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 5 Mar 2023 15:34:16 +0100 Subject: [PATCH] No longer remove the prefix before extraction, extracting should be idempotent * Fixes https://github.com/ruby/setup-ruby/issues/191 --- dist/index.js | 11 +---------- ruby-builder.js | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/dist/index.js b/dist/index.js index 48ccb6648..338811b69 100644 --- a/dist/index.js +++ b/dist/index.js @@ -68326,7 +68326,7 @@ async function install(platform, engine, version) { common.setupPath([path.join(rubyPrefix, 'bin')]) if (!inToolCache) { - await preparePrefix(rubyPrefix) + await io.mkdirP(rubyPrefix) if (engine === 'truffleruby+graalvm') { await installWithRubyBuild(engine, version, rubyPrefix) } else { @@ -68337,15 +68337,6 @@ async function install(platform, engine, version) { return rubyPrefix } -async function preparePrefix(rubyPrefix) { - const parentDir = path.dirname(rubyPrefix) - - await io.rmRF(rubyPrefix) - if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) { - await io.mkdirP(parentDir) - } -} - async function installWithRubyBuild(engine, version, rubyPrefix) { const tmp = process.env['RUNNER_TEMP'] || os.tmpdir() const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby') diff --git a/ruby-builder.js b/ruby-builder.js index 9f5b143c5..8e7f46665 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -50,7 +50,7 @@ export async function install(platform, engine, version) { common.setupPath([path.join(rubyPrefix, 'bin')]) if (!inToolCache) { - await preparePrefix(rubyPrefix) + await io.mkdirP(rubyPrefix) if (engine === 'truffleruby+graalvm') { await installWithRubyBuild(engine, version, rubyPrefix) } else { @@ -61,15 +61,6 @@ export async function install(platform, engine, version) { return rubyPrefix } -async function preparePrefix(rubyPrefix) { - const parentDir = path.dirname(rubyPrefix) - - await io.rmRF(rubyPrefix) - if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) { - await io.mkdirP(parentDir) - } -} - async function installWithRubyBuild(engine, version, rubyPrefix) { const tmp = process.env['RUNNER_TEMP'] || os.tmpdir() const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')