Compare commits

...
4 Commits
4 changed files with 22 additions and 13 deletions
+11
View File
@@ -102,6 +102,17 @@ jobs:
if: startsWith(matrix.os, 'windows') && startsWith(matrix.ruby, 'jruby') if: startsWith(matrix.os, 'windows') && startsWith(matrix.ruby, 'jruby')
run: gem install sassc -N run: gem install sassc -N
testExactBundlerVersion:
name: "Test with an exact Bundler version"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
ruby-version: 2.6
bundler: 2.1.4
- run: bundle --version | grep -F 2.1.4
lint: lint:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
+1 -1
View File
@@ -11,7 +11,7 @@ inputs:
default: 'default' default: 'default'
bundler: bundler:
description: | description: |
The version of Bundler to install. Either 'none', 1, 2, 'latest' or 'Gemfile.lock'. The version of Bundler to install. Either 'none', 'latest', 'Gemfile.lock', or a version number (e.g., 1, 2, 2.1.4).
For 'Gemfile.lock', the version is determined based on the BUNDLED WITH section from the file Gemfile.lock, $BUNDLE_GEMFILE.lock or gems.locked. For 'Gemfile.lock', the version is determined based on the BUNDLED WITH section from the file Gemfile.lock, $BUNDLE_GEMFILE.lock or gems.locked.
Defaults to 'Gemfile.lock' if the file exists and 'latest' otherwise. Defaults to 'Gemfile.lock' if the file exists and 'latest' otherwise.
required: false required: false
Generated Vendored
+5 -6
View File
@@ -51396,9 +51396,8 @@ function readBundledWithFromGemfileLock(lockFile) {
const nextLine = lines[bundledWithLine+1] const nextLine = lines[bundledWithLine+1]
if (nextLine && /^\d+/.test(nextLine.trim())) { if (nextLine && /^\d+/.test(nextLine.trim())) {
const bundlerVersion = nextLine.trim() const bundlerVersion = nextLine.trim()
const majorVersion = bundlerVersion.match(/^\d+/)[0] console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
console.log(`Using Bundler ${majorVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`) return bundlerVersion
return majorVersion
} }
} }
} }
@@ -51426,7 +51425,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`) throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
} }
if (engine === 'ruby' && rubyVersion.match(/^2\.[12]/)) { if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2') console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'ruby' && rubyVersion.startsWith('2.3')) { } else if (engine === 'ruby' && rubyVersion.startsWith('2.3')) {
@@ -51437,9 +51436,9 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
bundlerVersion = '1' bundlerVersion = '1'
} }
if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion === '2') { if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion === '1') { } else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}`) console.log(`Using Bundler 1 shipped with ${engine}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')
+5 -6
View File
@@ -181,9 +181,8 @@ function readBundledWithFromGemfileLock(lockFile) {
const nextLine = lines[bundledWithLine+1] const nextLine = lines[bundledWithLine+1]
if (nextLine && /^\d+/.test(nextLine.trim())) { if (nextLine && /^\d+/.test(nextLine.trim())) {
const bundlerVersion = nextLine.trim() const bundlerVersion = nextLine.trim()
const majorVersion = bundlerVersion.match(/^\d+/)[0] console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
console.log(`Using Bundler ${majorVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`) return bundlerVersion
return majorVersion
} }
} }
} }
@@ -211,7 +210,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`) throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
} }
if (engine === 'ruby' && rubyVersion.match(/^2\.[12]/)) { if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2') console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'ruby' && rubyVersion.startsWith('2.3')) { } else if (engine === 'ruby' && rubyVersion.startsWith('2.3')) {
@@ -222,9 +221,9 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
bundlerVersion = '1' bundlerVersion = '1'
} }
if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion === '2') { if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion === '1') { } else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}`) console.log(`Using Bundler 1 shipped with ${engine}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')