Remove utf8_inspect method.

This commit is contained in:
Markus Reiter 2017-06-27 11:55:23 +02:00
parent 3b4ee58c49
commit 2703646b10
4 changed files with 5 additions and 14 deletions

View File

@ -100,7 +100,7 @@ module Hbc
end end
def _fetch def _fetch
odebug "Calling curl with args #{cask_curl_args.utf8_inspect}" odebug "Calling curl with args #{cask_curl_args}"
curl(*cask_curl_args) curl(*cask_curl_args)
end end

View File

@ -20,7 +20,7 @@ module Hbc
def run! def run!
@processed_output = { stdout: "", stderr: "" } @processed_output = { stdout: "", stderr: "" }
odebug "Executing: #{expanded_command.utf8_inspect}" odebug "Executing: #{expanded_command}"
each_output_line do |type, line| each_output_line do |type, line|
case type case type
@ -62,7 +62,7 @@ module Hbc
def assert_success def assert_success
return if processed_status && processed_status.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 end
def expanded_command def expanded_command
@ -162,7 +162,7 @@ module Hbc
raise CaskError, <<-EOS raise CaskError, <<-EOS
Empty result parsing plist output from command. Empty result parsing plist output from command.
command was: command was:
#{command.utf8_inspect} #{command}
output we attempted to parse: output we attempted to parse:
#{output} #{output}
EOS EOS

View File

@ -38,7 +38,7 @@ module Hbc
def _check_response_status def _check_response_status
ok = OK_RESPONSES[cask.url.scheme] ok = OK_RESPONSES[cask.url.scheme]
return if ok.include?(@response_status) 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 end
def _get_data_from_request def _get_data_from_request

View File

@ -4,15 +4,6 @@ require "stringio"
BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze 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 class Buffer < StringIO
extend Predicable extend Predicable