Skip to content

Commit

Permalink
allow externally defined parent lockfiles (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer authored Feb 12, 2024
1 parent ca1d05c commit 8009bf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/bundler/multilock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def add_lockfile(lockfile = nil,

parent = expand_lockfile(parent)
if parent != Bundler.default_lockfile(force_original: true) &&
!lockfile_definitions.find { |definition| definition[:lockfile] == parent }
!lockfile_definitions.find { |definition| definition[:lockfile] == parent } &&
!parent.exist?
raise ArgumentError, "Parent lockfile #{parent} is not defined"
end

Expand Down
8 changes: 8 additions & 0 deletions spec/bundler/multilock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@
end
end

it "allows externally defined parents if they exist" do
with_gemfile(<<~RUBY) do
lockfile("full", parent: Bundler.default_lockfile)
RUBY
invoke_bundler("install")
end
end

it "generates custom lockfiles with varying versions" do
with_gemfile(<<~RUBY) do
lockfile do
Expand Down

0 comments on commit 8009bf4

Please sign in to comment.