зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix funding metadata not being printed in some situations
Namely, when a gem has not previously been installed, and Bundler is using the compact index API, fund metadata was not getting printed because the proper delegation was not implemented in the specification class used by the compact index. https://github.com/rubygems/rubygems/commit/9ef5139f60
This commit is contained in:
Родитель
6a474ef266
Коммит
4d73f3f9eb
|
@ -92,6 +92,17 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
# needed for `bundle fund`
|
||||
def metadata
|
||||
if @remote_specification
|
||||
@remote_specification.metadata
|
||||
elsif _local_specification
|
||||
_local_specification.metadata
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def _local_specification
|
||||
return unless @loaded_from && File.exist?(local_specification_path)
|
||||
eval(File.read(local_specification_path), nil, local_specification_path).tap do |spec|
|
||||
|
|
|
@ -31,8 +31,8 @@ RSpec.describe "bundle install" do
|
|||
|
||||
context "when gems include a fund URI" do
|
||||
it "displays the plural fund message after installing" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem 'has_funding_and_other_metadata'
|
||||
gem 'has_funding'
|
||||
gem 'rack-obama'
|
||||
|
@ -42,8 +42,8 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "displays the singular fund message after installing" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem 'has_funding'
|
||||
gem 'rack-obama'
|
||||
G
|
||||
|
@ -58,8 +58,8 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "does not display the plural fund message after installing" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem 'has_funding_and_other_metadata'
|
||||
gem 'has_funding'
|
||||
gem 'rack-obama'
|
||||
|
@ -69,8 +69,8 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "does not display the singular fund message after installing" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem 'has_funding'
|
||||
gem 'rack-obama'
|
||||
G
|
||||
|
@ -81,8 +81,8 @@ RSpec.describe "bundle install" do
|
|||
|
||||
context "when gems do not include fund messages" do
|
||||
it "does not display any fund messages" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem "activesupport"
|
||||
G
|
||||
|
||||
|
@ -92,8 +92,8 @@ RSpec.describe "bundle install" do
|
|||
|
||||
context "when a dependency includes a fund message" do
|
||||
it "does not display the fund message" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem 'gem_with_dependent_funding'
|
||||
G
|
||||
|
||||
|
@ -110,8 +110,8 @@ RSpec.describe "bundle install" do
|
|||
"funding_uri" => "https://example.com/also_has_funding/funding",
|
||||
}
|
||||
end
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
|
||||
G
|
||||
|
||||
|
@ -124,8 +124,8 @@ RSpec.describe "bundle install" do
|
|||
"funding_uri" => "https://example.com/also_has_funding/funding",
|
||||
}
|
||||
end
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
|
||||
G
|
||||
|
||||
|
@ -134,8 +134,8 @@ RSpec.describe "bundle install" do
|
|||
"funding_uri" => "https://example.com/also_has_funding/funding",
|
||||
}
|
||||
end
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, artifice: "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.1")}'
|
||||
G
|
||||
|
||||
|
@ -149,14 +149,14 @@ RSpec.describe "bundle install" do
|
|||
}
|
||||
end
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "https://gem.repo1"
|
||||
gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}'
|
||||
G
|
||||
|
||||
bundle :install
|
||||
bundle :install, artifice: "compact_index"
|
||||
expect(out).to include("1 installed gem you directly depend on is looking for funding.")
|
||||
|
||||
bundle :install
|
||||
bundle :install, artifice: "compact_index"
|
||||
expect(out).to include("1 installed gem you directly depend on is looking for funding.")
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче