Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Bundler: ruby version fetched from .ruby-version for jruby #9254

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -14,7 +14,7 @@ def ruby_version
file_content.strip
end
Bundler::RubyVersion.new(ruby_version, nil, nil, nil) if ruby_version
rescue SystemCallError
rescue SystemCallError, Gem::Requirement::BadRequirementError
# .ruby-version doesn't exist, fallback to the Ruby Dependabot runs
end
end
Expand Down
15 changes: 15 additions & 0 deletions bundler/helpers/v2/spec/ruby_version_spec.rb
Expand Up @@ -37,4 +37,19 @@
expect(spec.version).to eq("2.0.1")
end
end

context "with jruby" do
it "doesn't fail" do
in_tmp_folder do
# replace file content
File.write(".ruby-version", "jruby-9.3.8.0")
definition = Bundler::Definition.build("Gemfile", "Gemfile.lock", gems: ["statesman"])
definition.resolve_remotely!
specs = definition.resolve["statesman"]
expect(specs.size).to eq(1)
spec = specs.first
expect(spec.version).to eq("7.2.0")
end
end
end
end