Skip to content

Commit

Permalink
remove rubygems (version >= 1.3.6) deprecation message by replacing G…
Browse files Browse the repository at this point in the history
…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
Christoph Schiessl authored and jeremy committed Feb 25, 2010
1 parent 63a7ef0 commit 268c904
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions railties/lib/rails/gem_dependency.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion railties/test/gem_dependency_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 268c904

Please sign in to comment.