Skip to content

Commit

Permalink
Use an absolute path for bundle config --local path
Browse files Browse the repository at this point in the history
* See #131
  • Loading branch information
eregon committed Dec 21, 2020
1 parent 0e7d36a commit dc58db7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
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.

10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
}

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

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

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

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

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

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

0 comments on commit dc58db7

Please sign in to comment.