resolving typecheck and final tests

This commit is contained in:
thibhero 2025-02-06 12:37:19 -05:00
parent 0d2afcffe6
commit 0cc688f843
2 changed files with 24 additions and 21 deletions

View File

@ -121,8 +121,9 @@ module Homebrew
description: "Delete files that already exist in the prefix while linking.", description: "Delete files that already exist in the prefix while linking.",
}], }],
[:switch, "--ask", { [:switch, "--ask", {
description: "Ask for confirmation before downloading and installing software. Print bottles and dependencies download size and install size.", description: "Ask for confirmation before downloading and installing software. " \
}] "Print bottles and dependencies download size and install size.",
}],
].each do |args| ].each do |args|
options = args.pop options = args.pop
send(*args, **options) send(*args, **options)
@ -312,35 +313,37 @@ module Homebrew
bottle_size = 0 bottle_size = 0
installed_size = 0 installed_size = 0
installed_formulae.each do |f| installed_formulae.each do |f|
if (bottle = f.bottle) next unless (bottle = f.bottle)
begin
bottle.fetch_tab(quiet: !args.debug?) begin
bottle_size += bottle.bottle_size if bottle.bottle_size bottle.fetch_tab(quiet: !args.debug?)
installed_size += bottle.installed_size if bottle.installed_size bottle_size += T.must(bottle.bottle_size) if bottle.bottle_size
package.push(f, f.recursive_dependencies) installed_size += T.must(bottle.installed_size) if bottle.installed_size
unless f.deps.empty? package.push(f, f.recursive_dependencies)
f.recursive_dependencies.each do |dep| unless f.deps.empty?
bottle = dep.to_formula.bottle f.recursive_dependencies.each do |dep|
bottle.fetch_tab(quiet: !args.debug?) bottle_dep = dep.to_formula.bottle
bottle_size += bottle.bottle_size if bottle.bottle_size bottle_dep.fetch_tab(quiet: !args.debug?)
installed_size += bottle.installed_size if bottle.installed_size bottle_size += bottle_dep.bottle_size if bottle_dep.bottle_size
end installed_size += bottle_dep.installed_size if bottle_dep.installed_size
end end
rescue RuntimeError => e
odebug e
end end
rescue RuntimeError => e
odebug e
end end
end end
puts "Packages : #{package.join(", ")}\n\n" puts "Packages : #{package.join(", ")}\n\n"
puts "Bottle Size: #{disk_usage_readable(bottle_size)}" if bottle_size puts "Bottle Size: #{disk_usage_readable(bottle_size)}" if bottle_size
puts "Installed Size: #{disk_usage_readable(installed_size)}\n\n" if installed_size puts "Installed Size: #{disk_usage_readable(installed_size)}\n\n" if installed_size
ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]" ohai "Do you want to proceed with the installation? [Y/y/yes/N/n]"
accepted_inputs = %w[y yes]
declined_inputs = %w[n no]
loop do loop do
result = STDIN.gets.chomp.strip.downcase result = $stdin.gets.chomp.strip.downcase
if result == "y" || result == "yes" if accepted_inputs.include?(result)
puts "Proceeding with installation..." puts "Proceeding with installation..."
break break
elsif result == "n" elsif declined_inputs.include?(result)
return return
else else
puts "Invalid input. Please enter 'Y', 'y', or 'yes' to proceed, or 'N' to abort." puts "Invalid input. Please enter 'Y', 'y', or 'yes' to proceed, or 'N' to abort."

View File

@ -48,7 +48,7 @@ module Homebrew
"trying any other/default URLs.", "trying any other/default URLs.",
boolean: true, boolean: true,
}, },
HOMEBREW_ASK: { HOMEBREW_ASK: {
description: "If set, pass `--ask`to all formula install commands.", description: "If set, pass `--ask`to all formula install commands.",
boolean: true, boolean: true,
}, },