diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2024-01-05 19:47:32 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-01-11 13:51:52 +0900 |
commit | ef0705b3c2339055d9b5c669fb6192275c39020a (patch) | |
tree | 63904928ce9defd4b47ef98942e06edbc148b16e /lib/bundler/dsl.rb | |
parent | b8f859f0bf21d67d962d12a99e1f2d7d2f20e3e5 (diff) |
[rubygems/rubygems] Fix development dependency not being added if introduced by two gemspecs
https://github.com/rubygems/rubygems/commit/adc05bf1c3
Diffstat (limited to 'lib/bundler/dsl.rb')
-rw-r--r-- | lib/bundler/dsl.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 1eca749617..1460b9f52f 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -102,9 +102,6 @@ module Bundler # if there's already a dependency with this name we try to prefer one if current = @dependencies.find {|d| d.name == dep.name } - # Always prefer the dependency from the Gemfile - @dependencies.delete(current) if current.gemspec_dev_dep? - if current.requirement != dep.requirement current_requirement_open = current.requirements_list.include?(">= 0") @@ -116,8 +113,6 @@ module Bundler Bundler.ui.warn "A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \ "This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n" end - - return if dep.gemspec_dev_dep? else update_prompt = "" @@ -135,8 +130,13 @@ module Bundler "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \ "#{update_prompt}" end - elsif current.gemspec_dev_dep? || dep.gemspec_dev_dep? - return if dep.gemspec_dev_dep? + end + + # Always prefer the dependency from the Gemfile + if current.gemspec_dev_dep? + @dependencies.delete(current) + elsif dep.gemspec_dev_dep? + return elsif current.source != dep.source raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \ "You specified that #{dep.name} (#{dep.requirement}) should come from " \ |