aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/dsl.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-05-31 09:49:50 +0200
committergit <svn-admin@ruby-lang.org>2022-06-01 00:14:31 +0900
commitfd83b8887f78b6e7746a3986a2e075663341d17e (patch)
treea6c0dfc410d519c94fe5160c7c1bbb66b2652c79 /lib/bundler/dsl.rb
parente2b421d679d7ebd2c7d6b44a96c8353b81e447b9 (diff)
downloadruby-fd83b8887f78b6e7746a3986a2e075663341d17e.tar.gz
[rubygems/rubygems] Skip duplicated dependency warning for gemspec dev deps
Generally this warning is skipped for gemspec development dependencies. I think because it's common to override them in the Gemfile to change the source, for example. But the order of conditions was not correct and the warning was still being printed in one case. https://github.com/rubygems/rubygems/commit/da9d1d6a3f
Diffstat (limited to 'lib/bundler/dsl.rb')
-rw-r--r--lib/bundler/dsl.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 8983ef3e2b..1ae19a46e9 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -124,19 +124,17 @@ module Bundler
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
"#{update_prompt}"
+ elsif current.source != dep.source
+ return if dep.type == :development
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
else
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
"You should probably keep only one of them.\n" \
"Remove any duplicate entries and specify the gem only once.\n" \
"While it's not a problem now, it could cause errors if you change the version of one of them later."
end
-
- if current.source != dep.source
- return if dep.type == :development
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
- end
end
end