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 error when lockfiles are not defined, but ruby version is #39

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bundler/multilock/ext/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def evaluate(gemfile, lockfile, unlock)
builder = new
builder.eval_gemfile(gemfile, &Multilock.prepare_block) if Multilock.prepare_block
builder.eval_gemfile(gemfile)
if (ruby_version_requirement = builder.instance_variable_get(:@ruby_version))
if (ruby_version_requirement = builder.instance_variable_get(:@ruby_version)) &&
Multilock.lockfile_definitions[lockfile]
Multilock.lockfile_definitions[lockfile][:ruby_version_requirement] = ruby_version_requirement
elsif (parent_lockfile = Multilock.lockfile_definitions.dig(lockfile, :parent)) &&
(parent_lockfile_definition = Multilock.lockfile_definitions[parent_lockfile]) &&
Expand Down
10 changes: 10 additions & 0 deletions spec/bundler/multilock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,16 @@
end
end

it "doesn't error when no lockfiles are defined but ruby version is set" do
with_gemfile(<<~RUBY) do
gem "nokogiri"

ruby ">= 2.1"
RUBY
invoke_bundler("install")
end
end

private

def create_local_gem(name, content = "", subdirectory: true)
Expand Down
Loading