зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Simplify #to_ruby code
Separate #add_runtime_dependency and #add_development_dependency availability condition from #specification_version availability, which is not related to directly. Also check if the former method is available, instead of comparing the version. https://github.com/rubygems/rubygems/commit/5cccc2b836
This commit is contained in:
Родитель
5947ea31ca
Коммит
a2f0331c4e
|
@ -2476,25 +2476,17 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
result << nil
|
||||
result << " if s.respond_to? :specification_version then"
|
||||
result << " s.specification_version = #{specification_version}"
|
||||
result << " end"
|
||||
result << nil
|
||||
|
||||
result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
|
||||
result << " if s.respond_to? :add_runtime_dependency then"
|
||||
|
||||
dependencies.each do |dep|
|
||||
req = dep.requirements_list.inspect
|
||||
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
||||
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
|
||||
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
|
||||
end
|
||||
|
||||
result << " else"
|
||||
|
||||
dependencies.each do |dep|
|
||||
version_reqs_param = dep.requirements_list.inspect
|
||||
result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
|
||||
end
|
||||
|
||||
result << ' end'
|
||||
|
||||
result << " else"
|
||||
dependencies.each do |dep|
|
||||
version_reqs_param = dep.requirements_list.inspect
|
||||
|
|
|
@ -2428,12 +2428,10 @@ Gem::Specification.new do |s|
|
|||
|
||||
if s.respond_to? :specification_version then
|
||||
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
||||
end
|
||||
|
||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
else
|
||||
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
end
|
||||
if s.respond_to? :add_runtime_dependency then
|
||||
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
else
|
||||
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
end
|
||||
|
@ -2478,12 +2476,10 @@ Gem::Specification.new do |s|
|
|||
|
||||
if s.respond_to? :specification_version then
|
||||
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
||||
end
|
||||
|
||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
else
|
||||
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
end
|
||||
if s.respond_to? :add_runtime_dependency then
|
||||
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
else
|
||||
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
||||
end
|
||||
|
@ -2539,16 +2535,12 @@ Gem::Specification.new do |s|
|
|||
|
||||
if s.respond_to? :specification_version then
|
||||
s.specification_version = 4
|
||||
end
|
||||
|
||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||
s.add_runtime_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
||||
s.add_runtime_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
||||
s.add_runtime_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
||||
else
|
||||
s.add_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
||||
s.add_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
||||
s.add_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
||||
end
|
||||
if s.respond_to? :add_runtime_dependency then
|
||||
s.add_runtime_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
||||
s.add_runtime_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
||||
s.add_runtime_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
||||
else
|
||||
s.add_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
||||
s.add_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
||||
|
|
Загрузка…
Ссылка в новой задаче