From 2703646b1008e8fc0a922e4677d9b2aadcea4b4d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 27 Jun 2017 11:55:23 +0200 Subject: [PATCH] Remove `utf8_inspect` method. --- Library/Homebrew/cask/lib/hbc/download_strategy.rb | 2 +- Library/Homebrew/cask/lib/hbc/system_command.rb | 6 +++--- Library/Homebrew/cask/lib/hbc/url_checker.rb | 2 +- Library/Homebrew/cask/lib/hbc/utils.rb | 9 --------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb index 5b32b4840c..28ae704ee0 100644 --- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb +++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb @@ -100,7 +100,7 @@ module Hbc end def _fetch - odebug "Calling curl with args #{cask_curl_args.utf8_inspect}" + odebug "Calling curl with args #{cask_curl_args}" curl(*cask_curl_args) end diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index 6414a9e807..901617b71b 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -20,7 +20,7 @@ module Hbc def run! @processed_output = { stdout: "", stderr: "" } - odebug "Executing: #{expanded_command.utf8_inspect}" + odebug "Executing: #{expanded_command}" each_output_line do |type, line| case type @@ -62,7 +62,7 @@ module Hbc def assert_success return if processed_status && processed_status.success? - raise CaskCommandFailedError.new(command.utf8_inspect, processed_output[:stdout], processed_output[:stderr], processed_status) + raise CaskCommandFailedError.new(command, processed_output[:stdout], processed_output[:stderr], processed_status) end def expanded_command @@ -162,7 +162,7 @@ module Hbc raise CaskError, <<-EOS Empty result parsing plist output from command. command was: - #{command.utf8_inspect} + #{command} output we attempted to parse: #{output} EOS diff --git a/Library/Homebrew/cask/lib/hbc/url_checker.rb b/Library/Homebrew/cask/lib/hbc/url_checker.rb index 60a15ca2fe..7076b13c58 100644 --- a/Library/Homebrew/cask/lib/hbc/url_checker.rb +++ b/Library/Homebrew/cask/lib/hbc/url_checker.rb @@ -38,7 +38,7 @@ module Hbc def _check_response_status ok = OK_RESPONSES[cask.url.scheme] return if ok.include?(@response_status) - add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(" or ")}, got #{@response_status.utf8_inspect}" + add_error "unexpected http response, expecting #{ok.map(&:to_s).join(" or ")}, got #{@response_status}" end def _get_data_from_request diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb index f23ce059c0..22f826e748 100644 --- a/Library/Homebrew/cask/lib/hbc/utils.rb +++ b/Library/Homebrew/cask/lib/hbc/utils.rb @@ -4,15 +4,6 @@ require "stringio" BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze -# monkeypatch Object - not a great idea -class Object - def utf8_inspect - return inspect unless defined?(Encoding) - return map(&:utf8_inspect) if respond_to?(:map) - inspect.force_encoding("UTF-8").sub(/\A"(.*)"\Z/, '\1') - end -end - class Buffer < StringIO extend Predicable