Remove Cask’s CLI#debug?.

This commit is contained in:
Markus Reiter 2017-05-19 19:59:26 +02:00
parent 9e821863d0
commit a44d4ce88b
6 changed files with 3 additions and 19 deletions

View File

@ -74,8 +74,6 @@ module Hbc
end end
def dumpcask def dumpcask
return unless CLI.debug?
odebug "Cask instance dumps in YAML:" odebug "Cask instance dumps in YAML:"
odebug "Cask instance toplevel:", to_yaml odebug "Cask instance toplevel:", to_yaml
[ [

View File

@ -71,7 +71,6 @@ module Hbc
FLAGS = { FLAGS = {
["--[no-]binaries", :binaries] => true, ["--[no-]binaries", :binaries] => true,
["--debug", :debug] => false,
["--verbose", :verbose] => false, ["--verbose", :verbose] => false,
["--outdated", :outdated] => false, ["--outdated", :outdated] => false,
["--help", :help] => false, ["--help", :help] => false,
@ -158,7 +157,7 @@ module Hbc
run_command(command, *rest) run_command(command, *rest)
rescue CaskError, CaskSha256MismatchError, ArgumentError => e rescue CaskError, CaskSha256MismatchError, ArgumentError => e
msg = e.message msg = e.message
msg << e.backtrace.join("\n") if debug? msg << e.backtrace.join("\n") if ARGV.debug?
onoe msg onoe msg
exit 1 exit 1
rescue StandardError, ScriptError, NoMemoryError => e rescue StandardError, ScriptError, NoMemoryError => e
@ -239,7 +238,6 @@ module Hbc
# for compat with Homebrew, not certain if this is desirable # for compat with Homebrew, not certain if this is desirable
self.verbose = true if ARGV.verbose? self.verbose = true if ARGV.verbose?
self.debug = true if ARGV.debug?
remaining remaining
end end

View File

@ -12,7 +12,6 @@ module Hbc
end end
def self.dump_casks(*cask_tokens) def self.dump_casks(*cask_tokens)
CLI.debug = true # Yuck. At the moment this is the only way to make dumps visible
count = 0 count = 0
cask_tokens.each do |cask_token| cask_tokens.each do |cask_token|
begin begin

View File

@ -154,7 +154,7 @@ module Hbc
def self._parse_plist(command, output) def self._parse_plist(command, output)
raise CaskError, "Empty plist input" unless output =~ /\S/ raise CaskError, "Empty plist input" unless output =~ /\S/
output.sub!(/\A(.*?)(<\?\s*xml)/m, '\2') output.sub!(/\A(.*?)(<\?\s*xml)/m, '\2')
_warn_plist_garbage(command, Regexp.last_match[1]) if CLI.debug? _warn_plist_garbage(command, Regexp.last_match[1]) if ARGV.debug?
output.sub!(%r{(<\s*/\s*plist\s*>)(.*?)\Z}m, '\1') output.sub!(%r{(<\s*/\s*plist\s*>)(.*?)\Z}m, '\1')
_warn_plist_garbage(command, Regexp.last_match[2]) _warn_plist_garbage(command, Regexp.last_match[2])
xml = Plist.parse_xml(output) xml = Plist.parse_xml(output)

View File

@ -29,7 +29,7 @@ end
# global methods # global methods
def odebug(title, *sput) def odebug(title, *sput)
return unless Hbc::CLI.debug? return unless ARGV.debug?
puts Formatter.headline(title, color: :magenta) puts Formatter.headline(title, color: :magenta)
puts sput unless sput.empty? puts sput unless sput.empty?
end end

View File

@ -120,17 +120,6 @@ describe Hbc::CLI, :cask do
end end
end end
describe "--debug" do
it "sets the Cask debug method to true" do
begin
Hbc::CLI.process_options %w[help --debug]
expect(Hbc::CLI.debug?).to be true
ensure
Hbc::CLI.debug = false
end
end
end
describe "--help" do describe "--help" do
it "sets the Cask help method to true" do it "sets the Cask help method to true" do
begin begin