diff options
| author | Mike McQuaid | 2016-09-12 08:09:00 +0100 |
|---|---|---|
| committer | GitHub | 2016-09-12 08:09:00 +0100 |
| commit | 9a6999c30276a05c0bfc89f03b91dea4371ed407 (patch) | |
| tree | 80c15a5d370974edf5ed89e8b6b63c3f3045ebd2 /Library/Homebrew/utils/github.rb | |
| parent | b93b60e6ca3d609267fd20f35c63527552f10f19 (diff) | |
| parent | 94f763e9c7c7efa1a22a28a2d4c74fa5fcbe4771 (diff) | |
| download | brew-9a6999c30276a05c0bfc89f03b91dea4371ed407.tar.bz2 | |
Merge pull request #925 from MikeMcQuaid/utils-rubocop
Fix Library/Homebrew/utils RuboCop warnings
Diffstat (limited to 'Library/Homebrew/utils/github.rb')
| -rw-r--r-- | Library/Homebrew/utils/github.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index fce89f1af..d3f304122 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -121,7 +121,7 @@ module GitHub end end - def open(url, data=nil) + def open(url, data = nil) # This is a no-op if the user is opting out of using the GitHub API. return if ENV["HOMEBREW_NO_GITHUB_API"] @@ -154,7 +154,7 @@ module GitHub args += ["--data", "@#{data_tmpfile.path}"] end - args += ["--dump-header", "#{headers_tmpfile.path}"] + args += ["--dump-header", headers_tmpfile.path.to_s] output, errors, status = curl_output(url.to_s, *args) output, _, http_code = output.rpartition("\n") @@ -203,11 +203,15 @@ module GitHub case http_code when "401", "403" - raise AuthenticationFailedError.new(output) + raise AuthenticationFailedError, output when "404" raise HTTPNotFoundError, output else - error = Utils::JSON.load(output)["message"] rescue nil + error = begin + Utils::JSON.load(output)["message"] + rescue + nil + end error ||= "curl failed! #{errors}" raise Error, error end @@ -232,7 +236,7 @@ module GitHub def build_search_qualifier_string(qualifiers) { :repo => "Homebrew/homebrew-core", - :in => "title" + :in => "title", }.update(qualifiers).map do |qualifier, value| "#{qualifier}:#{value}" end.join("+") |
