diff --git a/lib/bundler/multilock.rb b/lib/bundler/multilock.rb index 5d56274..d9ec544 100644 --- a/lib/bundler/multilock.rb +++ b/lib/bundler/multilock.rb @@ -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 diff --git a/spec/bundler/multilock_spec.rb b/spec/bundler/multilock_spec.rb index 271f283..c45ea32 100644 --- a/spec/bundler/multilock_spec.rb +++ b/spec/bundler/multilock_spec.rb @@ -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