[rubygems/rubygems] Don't warn on bundler binstubs --standalone --all

Prior to this commit `bundle binstubs --standalone --all` would output a
warning about not being able to generate a standalone binstub for
bundler.

This warning predates the `--all` option, and I don't think it makes
sense in this context. The warning makes good sense when explicitly
trying to generate a bundler standalone binstub with `bundle binstubs
bundler --standalone`, since that command won't do what the user might
have expected. But `--all` is not specifically asking for bundler, and
having it report each time that the bundler binstubs could not be
generated does not seem particularly helpful. The only way to make that
warning go away would be to stop using `--standalone --all`.

This commit skips the warning when running with the `--all` option.

https://github.com/rubygems/rubygems/commit/e6a72e19eb
This commit is contained in:
Daniel Colson 2023-01-26 20:39:27 -05:00 коммит произвёл git
Родитель 7d4395cb69
Коммит 8429134d0d
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -40,7 +40,11 @@ module Bundler
end
if options[:standalone]
next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
if gem_name == "bundler"
Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") unless options[:all]
next
end
Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
end

Просмотреть файл

@ -369,6 +369,7 @@ RSpec.describe "bundle binstubs <gem>" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
gem "rails"
G
end
@ -396,6 +397,26 @@ RSpec.describe "bundle binstubs <gem>" do
expect(bundled_app("bin/rackup.cmd")).to exist
end
end
context "when the gem is bundler" do
it "warns without generating a standalone binstub" do
bundle "binstubs bundler --standalone"
expect(bundled_app("bin/bundle")).not_to exist
expect(bundled_app("bin/bundler")).not_to exist
expect(err).to include("Sorry, Bundler can only be run via RubyGems.")
end
end
context "when specified --all option" do
it "generates standalone binstubs for all gems except bundler" do
bundle "binstubs --standalone --all"
expect(bundled_app("bin/rackup")).to exist
expect(bundled_app("bin/rails")).to exist
expect(bundled_app("bin/bundle")).not_to exist
expect(bundled_app("bin/bundler")).not_to exist
expect(err).not_to include("Sorry, Bundler can only be run via RubyGems.")
end
end
end
context "when the bin already exists" do