mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Warn on duplicate dependency in a specification
af3e5f7883
This commit is contained in:
parent
985309ac38
commit
00bdac18cf
Notes:
git
2020-07-31 21:08:21 +09:00
2 changed files with 11 additions and 0 deletions
|
@ -556,6 +556,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
# spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
|
||||
|
||||
def add_runtime_dependency(gem, *requirements)
|
||||
if requirements.uniq.size != requirements.size
|
||||
warn "WARNING: duplicate dependency #{requirements}"
|
||||
end
|
||||
|
||||
add_dependency_with_type(gem, :runtime, requirements)
|
||||
end
|
||||
|
||||
|
|
|
@ -3051,6 +3051,13 @@ Please report a bug if this causes problems.
|
|||
end
|
||||
end
|
||||
|
||||
def test_duplicate_runtime_dependency
|
||||
expected = "WARNING: duplicate dependency [\"~> 3.0\", \"~> 3.0\"]\n"
|
||||
assert_output nil, expected do
|
||||
@a1.add_runtime_dependency "b", "~> 3.0", "~> 3.0"
|
||||
end
|
||||
end
|
||||
|
||||
def set_orig(cls)
|
||||
s_cls = cls.singleton_class
|
||||
s_cls.send :alias_method, :orig_unresolved_deps , :unresolved_deps
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue