Skip to content

Commit 1c7862f

Browse files
authored
Merge pull request #1249 from Shopify/st0012-fix-ruby-3.2-build
Avoid installing prerelease bundler for mock project
2 parents 50e65d7 + 1b96da0 commit 1c7862f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/helpers/mock_project.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,18 @@ def bundle_install(version: nil)
9292
opts = {}
9393
opts[:chdir] = path
9494
Bundler.with_unbundled_env do
95-
::Gem.install("bundler", bundler_version)
96-
out, err, status = Open3.capture3(["bundle", "_#{bundler_version}_", "install"].join(" "), opts)
95+
cmd =
96+
# prerelease versions are not always available on rubygems.org
97+
# so in this case, we install whichever is the latest
98+
if ::Gem::Version.new(bundler_version).prerelease?
99+
::Gem.install("bundler")
100+
"bundle install"
101+
else
102+
::Gem.install("bundler", bundler_version)
103+
"bundle _#{bundler_version}_ install"
104+
end
105+
106+
out, err, status = Open3.capture3(cmd, opts)
97107
ExecResult.new(out: out, err: err, status: T.must(status.success?))
98108
end
99109
end

0 commit comments

Comments
 (0)