Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove rubygems (version >= 1.3.6) deprecation message by replacing G…

…em::Dependency#version_requirements with Gem::Dependency#requirement

[#4026 state:committed]

Signed-off-by: Prem Sichanugrist <s@sikachu.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit 268c9040d5c3c7ed30f3923eee71a78eeece8a8a 1 parent 63a7ef0
Christoph Schiessl authored jeremy committed
View
15 railties/lib/rails/gem_dependency.rb
@@ -83,7 +83,7 @@ def dependencies
specification.dependencies.reject do |dependency|
dependency.type == :development
end.map do |dependency|
- GemDependency.new(dependency.name, :requirement => dependency.version_requirements)
+ GemDependency.new(dependency.name, :requirement => (dependency.respond_to?(:requirement) ? dependency.requirement : dependency.version_requirements))
end
end
@@ -115,9 +115,16 @@ def specification=(s)
@spec = s
end
- def requirement
- r = version_requirements
- (r == Gem::Requirement.default) ? nil : r
+ if method_defined?(:requirement)
+ def requirement
+ req = super
+ req unless req == Gem::Requirement.default
+ end
+ else
+ def requirement
+ req = version_requirements
+ req unless req == Gem::Requirement.default
+ end
end
def built?
View
2  railties/test/gem_dependency_test.rb
@@ -174,7 +174,7 @@ def test_gem_from_directory_name_attempts_to_load_specification
def test_gem_from_directory_name
dummy_gem = Rails::GemDependency.from_directory_name('dummy-gem-1.1', false)
assert_equal 'dummy-gem', dummy_gem.name
- assert_equal '= 1.1', dummy_gem.version_requirements.to_s
+ assert_equal '= 1.1', dummy_gem.requirement.to_s
end
def test_gem_from_directory_name_loads_specification_successfully
Please sign in to comment.
Something went wrong with that request. Please try again.