summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-11 23:04:56 +0900
committergit <svn-admin@ruby-lang.org>2022-07-16 19:33:16 +0900
commit5ae83151b16858083e6443fadc76e7fde0ff1199 (patch)
treef80126eef40debd1c090063d7b84c570929c832a
parent6c1d7dab52b9bd26cbb624634b4acb86ba37aa7f (diff)
downloadruby-5ae83151b16858083e6443fadc76e7fde0ff1199.tar.gz
[rubygems/rubygems] Drop support for old `Gem::Specification` versions
`specification_version` method was added before RubyGems 1.0, and `add_runtime_dependency` method was before 1.2. These seem aged enough to remove. https://github.com/rubygems/rubygems/commit/92770c5cd9
-rw-r--r--lib/rubygems/specification.rb15
-rw-r--r--test/rubygems/test_gem_specification.rb36
2 files changed, 10 insertions, 41 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index edabcf392a..a8e52e58d5 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2518,25 +2518,14 @@ class Gem::Specification < Gem::BasicSpecification
unless dependencies.empty?
result << nil
- result << " if s.respond_to? :specification_version then"
- result << " s.specification_version = #{specification_version}"
- result << " end"
+ result << " s.specification_version = #{specification_version}"
result << nil
- 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})"
- 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})"
+ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
end
- result << " end"
end
result << "end"
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 693e6e97c5..3f955ce656 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -2267,15 +2267,9 @@ Gem::Specification.new do |s|
s.rubygems_version = "#{Gem::VERSION}".freeze
s.summary = "this is a summary".freeze
- if s.respond_to? :specification_version then
- s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
- end
+ s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
- 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
+ s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
end
SPEC
@@ -2347,15 +2341,9 @@ Gem::Specification.new do |s|
s.installed_by_version = "#{Gem::VERSION}" if s.respond_to? :installed_by_version
- if s.respond_to? :specification_version then
- s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
- end
+ s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
- 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
+ s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
end
SPEC
@@ -2406,19 +2394,11 @@ Gem::Specification.new do |s|
s.summary = "this is a summary".freeze
s.test_files = ["test/suite.rb".freeze]
- if s.respond_to? :specification_version then
- s.specification_version = 4
- end
+ s.specification_version = 4
- 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\"])
- s.add_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
- end
+ 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\"])
end
SPEC