summaryrefslogtreecommitdiff
path: root/lib/bundler/dsl.rb
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-04-16 00:43:56 +1000
committerColby Swandale <colby@taplaboratories.com>2017-04-16 18:21:13 +1000
commit7a1722f9e03607a7c50989880d30b9ed2392107a (patch)
treeff971e7acd273697a763089521e508bd6f65e003 /lib/bundler/dsl.rb
parent7ce45d7702479542975a98762cc33982d8fb6ee7 (diff)
downloadbundler-7a1722f9e03607a7c50989880d30b9ed2392107a.tar.gz
remove duplicate code replacing existing dep with a development dep
Diffstat (limited to 'lib/bundler/dsl.rb')
-rw-r--r--lib/bundler/dsl.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 9bbabfee19..478d9d2373 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -95,10 +95,10 @@ 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 }
+ deleted_dep = @dependencies.delete(current) if current.type == :development
+
if current.requirement != dep.requirement
- if current.type == :development
- @dependencies.delete current
- else
+ unless deleted_dep
return if dep.type == :development
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})"
@@ -111,9 +111,7 @@ module Bundler
end
if current.source != dep.source
- if current.type == :development
- @dependencies.delete current
- else
+ unless deleted_dep
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 " \