Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove homebrew-fork ARGV monkeypatch #8433

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cask/artifact/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run_installer(pkg_description)
'-pkg', source,
'-target', '/'
]
args << '-verboseR' if ARGV.verbose?
args << '-verboseR' if Cask.verbose
args << '-allowUntrusted' if pkg_install_opts :allow_untrusted
@command.run!('/usr/sbin/installer', {:sudo => true, :args => args, :print_stdout => true})
end
Expand Down
7 changes: 7 additions & 0 deletions lib/cask/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def self.parser
opts.on("--debug") do |v|
Cask.debug = true
end
opts.on("--verbose") do |v|
Cask.verbose = true
end
opts.on("--outdated") do |v|
Cask.outdated = true
end
Expand All @@ -216,6 +219,10 @@ def self.process_options(args)
"There is more than one possible option that starts with '#{head}'")
end
end

# for compat with Homebrew, not certain if this is desirable
Cask.verbose = true if !ENV['VERBOSE'].nil? or !ENV['HOMEBREW_VERBOSE'].nil?

remaining
end

Expand Down
8 changes: 8 additions & 0 deletions lib/cask/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def debug=(_debug)
@debug = _debug
end

def verbose
@verbose ||= false
end

def verbose=(_verbose)
@verbose = _verbose
end

def outdated
@outdated ||= false
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cask/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def tty?
# global methods

def ohai(title, *sput)
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
title = Tty.truncate(title) if $stdout.tty? && !Cask.verbose
puts "#{Tty.blue.bold}==>#{Tty.white} #{title}#{Tty.reset}"
puts sput unless sput.empty?
end
Expand Down
4 changes: 2 additions & 2 deletions lib/homebrew-fork/Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def expand_safe_system_args args
args = args.dup
args.each_with_index do |arg, ii|
if arg.is_a? Hash
unless ARGV.verbose?
unless Cask.verbose
args[ii] = arg[:quiet_flag]
else
args.delete_at ii
Expand All @@ -22,7 +22,7 @@ def expand_safe_system_args args
end
end
# 2 as default because commands are eg. svn up, git pull
args.insert(2, '-q') unless ARGV.verbose?
args.insert(2, '-q') unless Cask.verbose
args
end

Expand Down
13 changes: 0 additions & 13 deletions lib/homebrew-fork/Library/Homebrew/extend/ARGV.rb

This file was deleted.

3 changes: 0 additions & 3 deletions lib/homebrew-fork/Library/Homebrew/global.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
require 'extend/pathname'
require 'extend/ARGV'
require 'exceptions'
require 'utils'

ARGV.extend(HomebrewForkArgvExtension)

def cache
if ENV['HOMEBREW_CACHE']
Pathname.new(ENV['HOMEBREW_CACHE'])
Expand Down
5 changes: 0 additions & 5 deletions lib/homebrew-fork/Library/Homebrew/test/testing_env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
$:.push(File.expand_path(__FILE__+'/../..'))

require 'extend/pathname'
require 'extend/ARGV'
require 'utils'
require 'tmpdir'

Expand All @@ -24,7 +23,3 @@
# Test environment setup
# needed to keep rspec from attempting to write outside test dir
%w{ENV Formula}.each { |d| HOMEBREW_LIBRARY.join(d).mkpath }

# required for many tests
# eg: undefined method `verbose?' for []:Array
ARGV.extend(HomebrewForkArgvExtension)
4 changes: 2 additions & 2 deletions lib/homebrew-fork/Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'utils/popen'

def homebrew_fork_system cmd, *args
puts "#{cmd} #{args*' '}" if ARGV.verbose?
puts "#{cmd} #{args*' '}" if Cask.verbose
pid = fork do
yield if block_given?
args.collect!{|arg| arg.to_s}
Expand Down Expand Up @@ -35,7 +35,7 @@ def curl *args
raise "#{curl} is not executable" unless curl.exist? and curl.executable?

flags = HOMEBREW_CURL_ARGS
flags = flags.delete("#") if ARGV.verbose?
flags = flags.delete("#") if Cask.verbose

args = [flags, HOMEBREW_USER_AGENT, *args]
# See https://github.com/Homebrew/homebrew/issues/6103
Expand Down