Skip to content

Commit

Permalink
Merge pull request #7395 from ntkme/fix-rake-specification-policy
Browse files Browse the repository at this point in the history
Fix rake runtime dependency warning for rake based extension
  • Loading branch information
deivid-rodriguez committed Jan 19, 2024
2 parents daf71c7 + 04973e3 commit c4b91b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rubygems/specification_policy.rb
Expand Up @@ -497,10 +497,10 @@ def validate_rust_extensions(builder) # :nodoc:

def validate_rake_extensions(builder) # :nodoc:
rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
rake_dependency = @specification.dependencies.any? {|d| d.name == "rake" }
rake_dependency = @specification.dependencies.any? {|d| d.name == "rake" && d.type == :runtime }

warning <<-WARNING if rake_extension && !rake_dependency
You have specified rake based extension, but rake is not added as dependency. It is recommended to add rake as a dependency in gemspec since there's no guarantee rake will be already installed.
You have specified rake based extension, but rake is not added as runtime dependency. It is recommended to add rake as a runtime dependency in gemspec since there's no guarantee rake will be already installed.
WARNING
end

Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_specification.rb
Expand Up @@ -2727,7 +2727,7 @@ def test_validate_rake_extension_have_rake_dependency_warning
@a1.validate
end

assert_match(/add rake as a dependency/, @ui.error)
assert_match(/add rake as a runtime dependency/, @ui.error)
end
end

Expand All @@ -2743,7 +2743,7 @@ def test_validate_rake_extension_have_rake_dependency_no_warning
@a1.validate
end

refute_match(/add rake as a dependency/, @ui.error)
refute_match(/add rake as a runtime dependency/, @ui.error)
end
end

Expand Down

0 comments on commit c4b91b1

Please sign in to comment.