modifying files with brew style

This commit is contained in:
thibhero 2025-03-06 21:27:13 -05:00
parent f4d93e19b8
commit 99fad7797c
6 changed files with 28 additions and 37 deletions

View File

@ -307,9 +307,7 @@ module Homebrew
Install.perform_preinstall_checks_once
Install.check_cc_argv(args.cc)
if args.ask?
Install.ask(formulae, args: args)
end
Install.ask(formulae, args: args) if args.ask?
Install.install_formulae(
installed_formulae,

View File

@ -132,9 +132,7 @@ module Homebrew
Install.perform_preinstall_checks_once
# Main block: if asking the user is enabled, show dependency and size information.
if args.ask?
Install.ask(formulae, args: args)
end
Install.ask(formulae, args: args) if args.ask?
formulae.each do |formula|
if formula.pinned?

View File

@ -222,9 +222,7 @@ module Homebrew
Install.perform_preinstall_checks_once
# Main block: if asking the user is enabled, show dependency and size information.
if args.ask?
Install.ask(formulae_to_install, args: args)
end
Install.ask(formulae_to_install, args: args) if args.ask?
Upgrade.upgrade_formulae(
formulae_to_install,

View File

@ -327,7 +327,6 @@ module Homebrew
puts formula_names.join(" ")
end
# Main block: if asking the user is enabled, show dependency and size information.
def ask(formulae, args:)
ohai "Looking for bottles..."
@ -336,7 +335,8 @@ module Homebrew
sizes = compute_total_sizes(sized_formulae, debug: args.debug?)
puts "#{::Utils.pluralize("Formul", sized_formulae.count, plural: "ae",
singular: "a")} (#{sized_formulae.count}): #{sized_formulae.join(", ")}\n\n"
singular: "a")} (#{sized_formulae.count}): \
#{sized_formulae.join(", ")}\n\n"
puts "Download Size: #{disk_usage_readable(sizes[:download])}"
puts "Install Size: #{disk_usage_readable(sizes[:installed])}"
puts "Net Install Size: #{disk_usage_readable(sizes[:net])}" if sizes[:net] != 0
@ -381,7 +381,6 @@ module Homebrew
Upgrade.install_formula(formula_installer, upgrade:)
end
def ask_input
ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]"
accepted_inputs = %w[y yes]

View File

@ -89,10 +89,9 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
it "installs with asking for user prompts without installed dependent checks", :integration_test do
setup_test_formula "testball1"
expect {
expect do
brew "install", "--ask", "testball1"
}.to output(/.*Formula\s*\(1\):\s*testball1.*/
).to_stdout.and not_to_output.to_stderr
end.to output(/.*Formula\s*\(1\):\s*testball1.*/).to_stdout.and not_to_output.to_stderr
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
end
@ -108,8 +107,7 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
setup_test_formula "testball5", <<~RUBY
depends_on "testball4"
RUBY
setup_test_formula "testball4", <<~RUBY
RUBY
setup_test_formula "testball4", ""
setup_test_formula "hiop"
setup_test_formula "build"
@ -120,8 +118,8 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
expect {
brew "install", "--ask", "testball1"
}.to output(/.*Formulae\s*\(3\):\s*testball1\s*,?\s*testball5\s*,?\s*testball4.*/
).to_stdout.and not_to_output.to_stderr
}.to output(/.*Formulae\s*\(3\):\s*testball1\s*,?\s*testball5\s*,?\s*testball4.*/).to_stdout
.and not_to_output.to_stderr
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
expect(HOMEBREW_CELLAR/"testball4/0.1/bin/testball4").to be_a_file

View File

@ -146,7 +146,7 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
program_name = "test"
end
tarball_name = "#{prefix}-0.1#{'-linux' if OS.linux?}.tbz"
tarball_name = "#{prefix}-0.1#{"-linux" if OS.linux?}.tbz"
tarball = TEST_FIXTURE_DIR / "tarballs/#{tarball_name}"
content = <<~RUBY