Skip to content

Commit 504b4bd

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Use name argument consistently
ruby/rubygems@4e66fe4208
1 parent 3b78b88 commit 504b4bd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/bundler/dsl.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def add_dependency(name, version = nil, options = {})
241241
dep = Dependency.new(name, version, options)
242242

243243
# if there's already a dependency with this name we try to prefer one
244-
if current = @dependencies.find {|d| d.name == dep.name }
244+
if current = @dependencies.find {|d| d.name == name }
245245
if current.requirement != dep.requirement
246246
current_requirement_open = current.requirements_list.include?(">= 0")
247247

@@ -250,7 +250,7 @@ def add_dependency(name, version = nil, options = {})
250250
gemfile_dep = [dep, current].find(&:gemfile_dep?)
251251

252252
if gemfile_dep && !current_requirement_open
253-
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" \
253+
Bundler.ui.warn "A gemspec development dependency (#{name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{name}, #{gemfile_dep.requirement}).\n" \
254254
"This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
255255
elsif gemfile_dep.nil?
256256
require_relative "vendor/pub_grub/lib/pub_grub/version_range"
@@ -274,14 +274,14 @@ def add_dependency(name, version = nil, options = {})
274274
if dep.requirements_list.include?(">= 0") && !current_requirement_open
275275
update_prompt = ". Gem already added"
276276
else
277-
update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
277+
update_prompt = ". If you want to update the gem version, run `bundle update #{name}`"
278278

279279
update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current_requirement_open
280280
end
281281
end
282282

283283
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
284-
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
284+
"You specified: #{name} (#{current.requirement}) and #{name} (#{dep.requirement})" \
285285
"#{update_prompt}"
286286
end
287287
end
@@ -294,10 +294,10 @@ def add_dependency(name, version = nil, options = {})
294294
return
295295
elsif current.source != dep.source
296296
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
297-
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
297+
"You specified that #{name} (#{dep.requirement}) should come from " \
298298
"#{current.source || "an unspecified source"} and #{dep.source}\n"
299299
else
300-
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
300+
Bundler.ui.warn "Your Gemfile lists the gem #{name} (#{current.requirement}) more than once.\n" \
301301
"You should probably keep only one of them.\n" \
302302
"Remove any duplicate entries and specify the gem only once.\n" \
303303
"While it's not a problem now, it could cause errors if you change the version of one of them later."

0 commit comments

Comments
 (0)