From 568cdbf232e4d6391185649664090b35d1aabddc Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 3 Sep 2020 11:58:24 +0200 Subject: [PATCH] Revert "Add support for `gems.rb`/`gems.locked` during `bundle install`." * This reverts commit 638e8fff199d139c88205349aac19332954beb3a. * Needs some fixes and review. --- dist/index.js | 24 ++++++------------------ index.js | 24 ++++++------------------ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3c4e19f..0ac8b1c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -51557,26 +51557,14 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine, } async function bundleInstall(platform, engine, version) { - if (await bundleInstallSpecific('gems.rb', 'gems.locked', platform, engine, version)) { - return true - } - - if (await bundleInstallSpecific('Gemfile', 'Gemfile.lock', platform, engine, version)) { - return true - } - - console.log('No Gemfile/gems.rb, skipping "bundle install" and caching') -} - -async function bundleInstallSpecific(gemsPath, lockPath, platform, engine, version) { - if (!fs.existsSync(gemsPath)) { - return false + if (!fs.existsSync('Gemfile')) { + console.log('No Gemfile, skipping "bundle install" and caching') + return } // config const path = 'vendor/bundle' - const hasGemfileLock = fs.existsSync(lockPath) - + const hasGemfileLock = fs.existsSync('Gemfile.lock'); if (hasGemfileLock) { await exec.exec('bundle', ['config', '--local', 'deployment', 'true']) } @@ -51588,9 +51576,9 @@ async function bundleInstallSpecific(gemsPath, lockPath, platform, engine, versi let key = baseKey let restoreKeys if (hasGemfileLock) { - key += `-${lockPath}-${await common.hashFile(lockPath)}` + key += `-Gemfile.lock-${await common.hashFile('Gemfile.lock')}` // If only Gemfile.lock we can reuse some of the cache (but it will keep old gem versions in the cache) - restoreKeys = [`${baseKey}-${lockPath}-`] + restoreKeys = [`${baseKey}-Gemfile.lock-`] } else { // Only exact key, to never mix native gems of different platforms or Ruby versions restoreKeys = [] diff --git a/index.js b/index.js index ad08e22..f3cccde 100644 --- a/index.js +++ b/index.js @@ -213,26 +213,14 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine, } async function bundleInstall(platform, engine, version) { - if (await bundleInstallSpecific('gems.rb', 'gems.locked', platform, engine, version)) { - return true - } - - if (await bundleInstallSpecific('Gemfile', 'Gemfile.lock', platform, engine, version)) { - return true - } - - console.log('No Gemfile/gems.rb, skipping "bundle install" and caching') -} - -async function bundleInstallSpecific(gemsPath, lockPath, platform, engine, version) { - if (!fs.existsSync(gemsPath)) { - return false + if (!fs.existsSync('Gemfile')) { + console.log('No Gemfile, skipping "bundle install" and caching') + return } // config const path = 'vendor/bundle' - const hasGemfileLock = fs.existsSync(lockPath) - + const hasGemfileLock = fs.existsSync('Gemfile.lock'); if (hasGemfileLock) { await exec.exec('bundle', ['config', '--local', 'deployment', 'true']) } @@ -244,9 +232,9 @@ async function bundleInstallSpecific(gemsPath, lockPath, platform, engine, versi let key = baseKey let restoreKeys if (hasGemfileLock) { - key += `-${lockPath}-${await common.hashFile(lockPath)}` + key += `-Gemfile.lock-${await common.hashFile('Gemfile.lock')}` // If only Gemfile.lock we can reuse some of the cache (but it will keep old gem versions in the cache) - restoreKeys = [`${baseKey}-${lockPath}-`] + restoreKeys = [`${baseKey}-Gemfile.lock-`] } else { // Only exact key, to never mix native gems of different platforms or Ruby versions restoreKeys = []