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

Update references to "default" or "current" lockfile to be "active" #19

Merged
merged 1 commit into from
Jan 9, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the default lockfile (Gemfile.lock), afterwhich all other lockfiles will
be re-created based on this default lockfile. Additional lockfiles can be
based on the same Gemfile, but vary at runtime. You can force a specific
lockfile by setting the `BUNDLE_LOCKFILE` environment variable, or customize
it any way you want by setting `current: true` on one of your lockfiles
it any way you want by setting `active: true` on one of your lockfiles
in your Gemfile.

Alternately (or in addition!), you can define a lockfile to use a completely
Expand Down Expand Up @@ -85,7 +85,7 @@ with `BUNDLE_LOCKFILE`:
BUNDLE_LOCKFILE=rails-7.0 bundle exec rspec
```

You can also dynamically select it in your Gemfile, and pass `current: true`
You can also dynamically select it in your Gemfile, and pass `active: true`
to (exactly one!) `lockfile` method.

In some cases, you may want to essentially disable bundler-multilock's
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/multilock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def add_lockfile(lockfile = nil,
active = env_lockfile == lockfile if env_lockfile

if active && (old_active = lockfile_definitions.find { |definition| definition[:active] })
raise ArgumentError, "Only one lockfile (#{old_active[:lockfile]}) can be flagged as the default"
raise ArgumentError, "Only one lockfile (#{old_active[:lockfile]}) can be flagged as active"
end

parent = expand_lockfile(parent)
Expand Down Expand Up @@ -314,7 +314,7 @@ def loaded!
end
return unless default_lockfile_definition && default_lockfile_definition[:active] == false

raise GemfileEvalError, "No lockfiles marked as default"
raise GemfileEvalError, "No lockfiles marked as active"
end

# @!visibility private
Expand Down
42 changes: 21 additions & 21 deletions spec/bundler/multilock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,30 @@
end
end

it "disallows multiple default lockfiles" do
it "disallows multiple active lockfiles" do
with_gemfile(<<~RUBY) do
lockfile(default: true)
lockfile("full", default: true)
lockfile(active: true)
lockfile("full", active: true)
RUBY
expect { invoke_bundler("install") }.to raise_error(/can be flagged as the default/)
expect { invoke_bundler("install") }.to raise_error(/can be flagged as active/)
end
end

it "allows defaulting to an alternate lockfile" do
with_gemfile(<<~RUBY) do
lockfile(default: false)
lockfile("full", default: true)
lockfile(active: false)
lockfile("full", active: true)
RUBY
invoke_bundler("install")
end
end

it "disallows no lockfile set as the default" do
it "disallows no lockfile set as active" do
with_gemfile(<<~RUBY) do
lockfile(default: false)
lockfile(active: false)
lockfile("full")
RUBY
expect { invoke_bundler("install") }.to raise_error(/No lockfiles marked as default/)
expect { invoke_bundler("install") }.to raise_error(/No lockfiles marked as active/)
end
end

Expand Down Expand Up @@ -192,11 +192,11 @@
end
end

it "bundle info, bundle list respect default" do
it "bundle info, bundle list respect active" do
with_gemfile(<<~RUBY) do
gem "rake", "13.0.6"

lockfile "variation1", default: true do
lockfile "variation1", active: true do
gem "concurrent-ruby", "1.1.10"
end
lockfile "variation2" do
Expand Down Expand Up @@ -252,7 +252,7 @@

it "preserves the locked version of a gem in an alternate lockfile when updating a different gem in common" do
with_gemfile(<<~RUBY) do
lockfile("full", default: true) do
lockfile("full", active: true) do
gem "net-smtp", "0.3.2"
end

Expand All @@ -265,7 +265,7 @@

# loosen the requirement on both gems
write_gemfile(<<~RUBY)
lockfile("full", default: true) do
lockfile("full", active: true) do
gem "net-smtp", "~> 0.3"
end

Expand Down Expand Up @@ -465,14 +465,14 @@
with_gemfile(<<~RUBY) do
gem "rake"

lockfile("full", default: true) do
lockfile("full", active: true) do
gem "concurrent-ruby", "1.2.1"
end
RUBY
invoke_bundler("install")

write_gemfile(<<~RUBY)
lockfile("full", default: true) do
lockfile("full", active: true) do
gem "concurrent-ruby", "~> 1.2.0"
end
RUBY
Expand All @@ -486,15 +486,15 @@
with_gemfile(<<~RUBY) do
gem "concurrent-ruby", "1.2.1"

lockfile("full", default: true) do
lockfile("full", active: true) do
end
RUBY
invoke_bundler("install")

write_gemfile(<<~RUBY)
gem "concurrent-ruby", "~> 1.2.0"

lockfile("full", default: true) do
lockfile("full", active: true) do
end
RUBY

Expand All @@ -508,15 +508,15 @@
with_gemfile(<<~RUBY) do
gem "concurrent-ruby", "1.2.1"

lockfile("full", default: true) do
lockfile("full", active: true) do
end
RUBY
invoke_bundler("install")

write_gemfile(<<~RUBY)
gem "concurrent-ruby", "~> 1.2.0"

lockfile("full", default: true) do
lockfile("full", active: true) do
end
RUBY

Expand Down Expand Up @@ -619,7 +619,7 @@
end
end

it "allows explicitly specifying the default lockfile" do
it "allows explicitly specifying the active lockfile" do
with_gemfile(<<~RUBY) do
gem "rake"

Expand Down Expand Up @@ -686,7 +686,7 @@
with_gemfile(<<~RUBY) do
gemspec

lockfile("rails-6.1", default: true) do
lockfile("rails-6.1", active: true) do
gem "activesupport", "~> 6.1.0"
end
RUBY
Expand Down