Skip to content

Commit dc58db7

Browse files
committed
Use an absolute path for bundle config --local path
* See #131
1 parent 0e7d36a commit dc58db7

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

dist/index.js

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

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,11 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
248248
}
249249

250250
// config
251-
const path = 'vendor/bundle'
251+
const cachePath = 'vendor/bundle'
252+
// An absolute path, so it is reliably under $PWD/vendor/bundle, and not relative to the gemfile's directory
253+
const bundleCachePath = path.join(process.cwd(), cachePath)
252254

253-
await exec.exec('bundle', ['config', '--local', 'path', path], envOptions)
255+
await exec.exec('bundle', ['config', '--local', 'path', bundleCachePath], envOptions)
254256

255257
if (fs.existsSync(lockFile)) {
256258
await exec.exec('bundle', ['config', '--local', 'deployment', 'true'], envOptions)
@@ -261,7 +263,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
261263
}
262264

263265
// cache key
264-
const paths = [path]
266+
const paths = [cachePath]
265267
const baseKey = await computeBaseKey(platform, engine, rubyVersion, lockFile)
266268
const key = `${baseKey}-${await common.hashFile(lockFile)}`
267269
// If only Gemfile.lock changes we can reuse part of the cache, and clean old gem versions below
@@ -312,7 +314,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
312314
}
313315

314316
async function computeBaseKey(platform, engine, version, lockFile) {
315-
let key = `setup-ruby-bundler-cache-v2-${platform}-${engine}-${version}`
317+
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}`
316318

317319
if (engine !== 'jruby' && common.isHeadVersion(version)) {
318320
let revision = '';

0 commit comments

Comments
 (0)