ARGV: Replace ARGV.verbose? with Homebrew.args.verbose?
This commit is contained in:
parent
46e3520883
commit
acde828a45
@ -58,7 +58,7 @@ class Cleaner
|
|||||||
# actual files gets removed correctly.
|
# actual files gets removed correctly.
|
||||||
dirs.reverse_each do |d|
|
dirs.reverse_each do |d|
|
||||||
if d.children.empty?
|
if d.children.empty?
|
||||||
puts "rmdir: #{d} (empty)" if ARGV.verbose?
|
puts "rmdir: #{d} (empty)" if Homebrew.args.verbose?
|
||||||
d.rmdir
|
d.rmdir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -64,10 +64,14 @@ module Homebrew
|
|||||||
set_constraints(name, required_for: required_for, depends_on: depends_on)
|
set_constraints(name, required_for: required_for, depends_on: depends_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
enable_switch(*names, from: :env) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil?
|
enable_switch(*names, from: :env) if env?(env)
|
||||||
end
|
end
|
||||||
alias switch_option switch
|
alias switch_option switch
|
||||||
|
|
||||||
|
def env?(env)
|
||||||
|
env.present? && ENV["HOMEBREW_#{env.to_s.upcase}"].present?
|
||||||
|
end
|
||||||
|
|
||||||
def usage_banner(text)
|
def usage_banner(text)
|
||||||
@parser.banner = Formatter.wrap("#{text}\n", COMMAND_DESC_WIDTH)
|
@parser.banner = Formatter.wrap("#{text}\n", COMMAND_DESC_WIDTH)
|
||||||
end
|
end
|
||||||
|
@ -60,7 +60,7 @@ class AbstractDownloadStrategy
|
|||||||
ref_type: @ref_type, ref: @ref)
|
ref_type: @ref_type, ref: @ref)
|
||||||
.extract_nestedly(basename: basename,
|
.extract_nestedly(basename: basename,
|
||||||
prioritise_extension: true,
|
prioritise_extension: true,
|
||||||
verbose: ARGV.verbose? && !shutup)
|
verbose: Homebrew.args.verbose? && !shutup)
|
||||||
chdir
|
chdir
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class AbstractDownloadStrategy
|
|||||||
*args,
|
*args,
|
||||||
print_stdout: !shutup,
|
print_stdout: !shutup,
|
||||||
print_stderr: !shutup,
|
print_stderr: !shutup,
|
||||||
verbose: ARGV.verbose? && !shutup,
|
verbose: Homebrew.args.verbose? && !shutup,
|
||||||
env: env,
|
env: env,
|
||||||
**options,
|
**options,
|
||||||
)
|
)
|
||||||
@ -497,7 +497,7 @@ class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
|||||||
def stage
|
def stage
|
||||||
UnpackStrategy::Uncompressed.new(cached_location)
|
UnpackStrategy::Uncompressed.new(cached_location)
|
||||||
.extract(basename: basename,
|
.extract(basename: basename,
|
||||||
verbose: ARGV.verbose? && !shutup)
|
verbose: Homebrew.args.verbose? && !shutup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
|||||||
# This saves on bandwidth and will have a similar effect to verifying the
|
# This saves on bandwidth and will have a similar effect to verifying the
|
||||||
# cache as it will make any changes to get the right revision.
|
# cache as it will make any changes to get the right revision.
|
||||||
args = []
|
args = []
|
||||||
args << "--quiet" unless ARGV.verbose?
|
args << "--quiet" unless Homebrew.args.verbose?
|
||||||
|
|
||||||
if revision
|
if revision
|
||||||
ohai "Checking out #{@ref}"
|
ohai "Checking out #{@ref}"
|
||||||
@ -896,7 +896,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def quiet_flag
|
def quiet_flag
|
||||||
"-Q" unless ARGV.verbose?
|
"-Q" unless Homebrew.args.verbose?
|
||||||
end
|
end
|
||||||
|
|
||||||
def clone_repo
|
def clone_repo
|
||||||
|
@ -381,7 +381,7 @@ class BuildError < RuntimeError
|
|||||||
def dump
|
def dump
|
||||||
puts
|
puts
|
||||||
|
|
||||||
if ARGV.verbose?
|
if Homebrew.args.verbose?
|
||||||
require "system_config"
|
require "system_config"
|
||||||
require "build_environment"
|
require "build_environment"
|
||||||
|
|
||||||
|
@ -443,8 +443,8 @@ module ObserverPathnameExtension
|
|||||||
MAXIMUM_VERBOSE_OUTPUT = 100
|
MAXIMUM_VERBOSE_OUTPUT = 100
|
||||||
|
|
||||||
def verbose?
|
def verbose?
|
||||||
return ARGV.verbose? unless ENV["CI"]
|
return Homebrew.args.verbose? unless ENV["CI"]
|
||||||
return false unless ARGV.verbose?
|
return false unless Homebrew.args.verbose?
|
||||||
|
|
||||||
if total < MAXIMUM_VERBOSE_OUTPUT
|
if total < MAXIMUM_VERBOSE_OUTPUT
|
||||||
true
|
true
|
||||||
|
@ -506,7 +506,7 @@ class Formula
|
|||||||
return false unless head&.downloader.is_a?(VCSDownloadStrategy)
|
return false unless head&.downloader.is_a?(VCSDownloadStrategy)
|
||||||
|
|
||||||
downloader = head.downloader
|
downloader = head.downloader
|
||||||
downloader.shutup! unless ARGV.verbose?
|
downloader.shutup! unless Homebrew.args.verbose?
|
||||||
downloader.commit_outdated?(version.version.commit)
|
downloader.commit_outdated?(version.version.commit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1844,7 +1844,7 @@ class Formula
|
|||||||
# # If there is a "make", "install" available, please use it!
|
# # If there is a "make", "install" available, please use it!
|
||||||
# system "make", "install"</pre>
|
# system "make", "install"</pre>
|
||||||
def system(cmd, *args)
|
def system(cmd, *args)
|
||||||
verbose = ARGV.verbose?
|
verbose = Homebrew.args.verbose?
|
||||||
verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil?
|
verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil?
|
||||||
|
|
||||||
# remove "boring" arguments so that the important ones are more likely to
|
# remove "boring" arguments so that the important ones are more likely to
|
||||||
|
@ -56,7 +56,7 @@ class FormulaInstaller
|
|||||||
@include_test = ARGV.include?("--include-test")
|
@include_test = ARGV.include?("--include-test")
|
||||||
@interactive = false
|
@interactive = false
|
||||||
@git = false
|
@git = false
|
||||||
@verbose = ARGV.verbose?
|
@verbose = Homebrew.args.verbose?
|
||||||
@quieter = ARGV.quieter?
|
@quieter = ARGV.quieter?
|
||||||
@debug = ARGV.debug?
|
@debug = ARGV.debug?
|
||||||
@installed_as_dependency = false
|
@installed_as_dependency = false
|
||||||
|
@ -573,7 +573,9 @@ class Keg
|
|||||||
begin
|
begin
|
||||||
keg = Keg.for(src)
|
keg = Keg.for(src)
|
||||||
rescue NotAKegError
|
rescue NotAKegError
|
||||||
puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar" if ARGV.verbose?
|
if Homebrew.args.verbose?
|
||||||
|
puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar"
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -584,7 +586,7 @@ class Keg
|
|||||||
|
|
||||||
def make_relative_symlink(dst, src, mode)
|
def make_relative_symlink(dst, src, mode)
|
||||||
if dst.symlink? && src == dst.resolved_path
|
if dst.symlink? && src == dst.resolved_path
|
||||||
puts "Skipping; link already exists: #{dst}" if ARGV.verbose?
|
puts "Skipping; link already exists: #{dst}" if Homebrew.args.verbose?
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class Resource
|
|||||||
|
|
||||||
def verify_download_integrity(fn)
|
def verify_download_integrity(fn)
|
||||||
if fn.file?
|
if fn.file?
|
||||||
ohai "Verifying #{fn.basename} checksum" if ARGV.verbose?
|
ohai "Verifying #{fn.basename} checksum" if Homebrew.args.verbose?
|
||||||
fn.verify_checksum(checksum)
|
fn.verify_checksum(checksum)
|
||||||
end
|
end
|
||||||
rescue ChecksumMissingError
|
rescue ChecksumMissingError
|
||||||
|
@ -127,7 +127,7 @@ class Sandbox
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @failed && ARGV.verbose?
|
if @failed && ENV["HOMEBREW_VERBOSE"].present?
|
||||||
ohai "Sandbox log"
|
ohai "Sandbox log"
|
||||||
puts logs
|
puts logs
|
||||||
$stdout.flush # without it, brew test-bot would fail to catch the log
|
$stdout.flush # without it, brew test-bot would fail to catch the log
|
||||||
|
@ -30,7 +30,7 @@ module Homebrew
|
|||||||
args << "--parallel"
|
args << "--parallel"
|
||||||
end
|
end
|
||||||
|
|
||||||
args += ["--extra-details", "--display-cop-names"] if ARGV.verbose?
|
args += ["--extra-details", "--display-cop-names"] if Homebrew.args.verbose?
|
||||||
|
|
||||||
if except_cops
|
if except_cops
|
||||||
except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
||||||
|
@ -222,7 +222,7 @@ class SystemCommand
|
|||||||
end
|
end
|
||||||
|
|
||||||
def warn_plist_garbage(garbage)
|
def warn_plist_garbage(garbage)
|
||||||
return unless ARGV.verbose?
|
return unless Homebrew.args.verbose?
|
||||||
return unless garbage.match?(/\S/)
|
return unless garbage.match?(/\S/)
|
||||||
|
|
||||||
opoo "Received non-XML output from #{Formatter.identifier(command.first)}:"
|
opoo "Received non-XML output from #{Formatter.identifier(command.first)}:"
|
||||||
|
@ -604,7 +604,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
desc "foo"
|
desc "foo"
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
def install
|
def install
|
||||||
verbose = ARGV.verbose?
|
verbose = Homebrew.args.verbose?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
@ -120,7 +120,7 @@ describe SystemCommand::Result do
|
|||||||
|
|
||||||
context "when verbose" do
|
context "when verbose" do
|
||||||
before do
|
before do
|
||||||
allow(ARGV).to receive(:verbose?).and_return(true)
|
allow(Homebrew.args).to receive(:verbose?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "warns about garbage" do
|
it "warns about garbage" do
|
||||||
@ -144,7 +144,7 @@ describe SystemCommand::Result do
|
|||||||
|
|
||||||
context "when verbose" do
|
context "when verbose" do
|
||||||
before do
|
before do
|
||||||
allow(ARGV).to receive(:verbose?).and_return(true)
|
allow(Homebrew.args).to receive(:verbose?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "warns about garbage" do
|
it "warns about garbage" do
|
||||||
|
@ -35,7 +35,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def system(cmd, *args, **options)
|
def system(cmd, *args, **options)
|
||||||
if ARGV.verbose?
|
if Homebrew.args.verbose?
|
||||||
puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
|
puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
|
||||||
.gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
|
.gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
|
||||||
end
|
end
|
||||||
@ -87,7 +87,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ohai_title(title)
|
def ohai_title(title)
|
||||||
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
|
title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose?
|
||||||
Formatter.headline(title, color: :blue)
|
Formatter.headline(title, color: :blue)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def oh1(title, options = {})
|
def oh1(title, options = {})
|
||||||
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose? && options.fetch(:truncate, :auto) == :auto
|
title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose? && options.fetch(:truncate, :auto) == :auto
|
||||||
puts Formatter.headline(title, color: :green)
|
puts Formatter.headline(title, color: :green)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def nostdout
|
def nostdout
|
||||||
if ARGV.verbose?
|
if Homebrew.args.verbose?
|
||||||
yield
|
yield
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -34,7 +34,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
|
|||||||
|
|
||||||
unless show_output
|
unless show_output
|
||||||
args << "--fail"
|
args << "--fail"
|
||||||
args << "--progress-bar" unless ARGV.verbose?
|
args << "--progress-bar" unless Homebrew.args.verbose?
|
||||||
args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
|
args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
|
||||||
args << "--silent" unless $stdout.tty?
|
args << "--silent" unless $stdout.tty?
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user