Skip to content

Commit 87be784

Browse files
committed
Avoid reinstalling bundler if the required version is already installed
1 parent b1da480 commit 87be784

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎bundler.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
142142
const gem = path.join(rubyPrefix, 'bin', 'gem')
143143

144144
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
145-
const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
145+
// Use --conservative to avoid reinstalling the exact same version if already installed.
146+
const options = versionParts >= 3 ? ['-v', bundlerVersion, '--conservative'] : ['-v', `~> ${bundlerVersion}.0`]
146147

147-
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
148+
await exec.exec(gem, ['install', 'bundler', ...options])
148149

149150
return bundlerVersion
150151
}

‎dist/index.js‎

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

0 commit comments

Comments
 (0)