From dc5a2c1764b1da3cfa85d8910338eb72cd4da96c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 4 Aug 2017 16:24:29 +0200 Subject: Simplify CurlDownloadStrategy. --- Library/Homebrew/dev-cmd/pull.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 9681bb2bc..dd2bc6270 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -228,7 +228,7 @@ module Homebrew "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" end - curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url + curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url safe_system "git", "checkout", "--quiet", "-B", bottle_branch, orig_revision pull_patch bottle_commit_url, "bottle commit" @@ -303,7 +303,7 @@ module Homebrew extra_msg = @description ? "(#{@description})" : nil ohai "Fetching patch #{extra_msg}" puts "Patch: #{patch_url}" - curl patch_url, "-s", "-o", patchpath + curl_download patch_url, to: patchpath end def apply_patch @@ -433,10 +433,10 @@ module Homebrew end version = info.pkg_version ohai "Publishing on Bintray: #{package} #{version}" - curl "-w", '\n', "--silent", "--fail", - "-u#{creds[:user]}:#{creds[:key]}", "-X", "POST", - "-H", "Content-Type: application/json", - "-d", '{"publish_wait_for_secs": 0}', + curl "--write-out", '\n', "--silent", "--fail", + "--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST", + "--header", "Content-Type: application/json", + "--data", '{"publish_wait_for_secs": 0}', "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish" true rescue => e @@ -587,7 +587,7 @@ module Homebrew # We're in the cache; make sure to force re-download loop do begin - curl url, "-o", filename + curl_download url, to: filename break rescue if retry_count >= max_curl_retries @@ -606,7 +606,7 @@ module Homebrew end def check_bintray_mirror(name, url) - headers = curl_output("--connect-timeout", "15", "--head", url)[0] + headers, = curl_output("--connect-timeout", "15", "--location", "--head", url) status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first return if status_code.start_with?("2") opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})." -- cgit v1.2.3 From 986887b413897413266151c92d5071d0a82cf966 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Mon, 7 Aug 2017 14:31:56 -0700 Subject: Revert "Refactor SVN and cURL download strategies." --- Library/Homebrew/dev-cmd/pull.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index dd2bc6270..9681bb2bc 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -228,7 +228,7 @@ module Homebrew "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" end - curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url + curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url safe_system "git", "checkout", "--quiet", "-B", bottle_branch, orig_revision pull_patch bottle_commit_url, "bottle commit" @@ -303,7 +303,7 @@ module Homebrew extra_msg = @description ? "(#{@description})" : nil ohai "Fetching patch #{extra_msg}" puts "Patch: #{patch_url}" - curl_download patch_url, to: patchpath + curl patch_url, "-s", "-o", patchpath end def apply_patch @@ -433,10 +433,10 @@ module Homebrew end version = info.pkg_version ohai "Publishing on Bintray: #{package} #{version}" - curl "--write-out", '\n', "--silent", "--fail", - "--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST", - "--header", "Content-Type: application/json", - "--data", '{"publish_wait_for_secs": 0}', + curl "-w", '\n', "--silent", "--fail", + "-u#{creds[:user]}:#{creds[:key]}", "-X", "POST", + "-H", "Content-Type: application/json", + "-d", '{"publish_wait_for_secs": 0}', "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish" true rescue => e @@ -587,7 +587,7 @@ module Homebrew # We're in the cache; make sure to force re-download loop do begin - curl_download url, to: filename + curl url, "-o", filename break rescue if retry_count >= max_curl_retries @@ -606,7 +606,7 @@ module Homebrew end def check_bintray_mirror(name, url) - headers, = curl_output("--connect-timeout", "15", "--location", "--head", url) + headers = curl_output("--connect-timeout", "15", "--head", url)[0] status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first return if status_code.start_with?("2") opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})." -- cgit v1.2.3 From ae4bafdb365cfa380d129b0a03bd99a1e4d960a4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 8 Aug 2017 18:10:13 +0200 Subject: Simplify CurlDownloadStrategy. --- Library/Homebrew/dev-cmd/pull.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 9681bb2bc..dd2bc6270 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -228,7 +228,7 @@ module Homebrew "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" end - curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url + curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url safe_system "git", "checkout", "--quiet", "-B", bottle_branch, orig_revision pull_patch bottle_commit_url, "bottle commit" @@ -303,7 +303,7 @@ module Homebrew extra_msg = @description ? "(#{@description})" : nil ohai "Fetching patch #{extra_msg}" puts "Patch: #{patch_url}" - curl patch_url, "-s", "-o", patchpath + curl_download patch_url, to: patchpath end def apply_patch @@ -433,10 +433,10 @@ module Homebrew end version = info.pkg_version ohai "Publishing on Bintray: #{package} #{version}" - curl "-w", '\n', "--silent", "--fail", - "-u#{creds[:user]}:#{creds[:key]}", "-X", "POST", - "-H", "Content-Type: application/json", - "-d", '{"publish_wait_for_secs": 0}', + curl "--write-out", '\n', "--silent", "--fail", + "--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST", + "--header", "Content-Type: application/json", + "--data", '{"publish_wait_for_secs": 0}', "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish" true rescue => e @@ -587,7 +587,7 @@ module Homebrew # We're in the cache; make sure to force re-download loop do begin - curl url, "-o", filename + curl_download url, to: filename break rescue if retry_count >= max_curl_retries @@ -606,7 +606,7 @@ module Homebrew end def check_bintray_mirror(name, url) - headers = curl_output("--connect-timeout", "15", "--head", url)[0] + headers, = curl_output("--connect-timeout", "15", "--location", "--head", url) status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first return if status_code.start_with?("2") opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})." -- cgit v1.2.3 From 15e572702e8dbd998e31aec110bce3cc0c9df811 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 21 Aug 2017 19:32:16 +0200 Subject: Fix `pull`. --- Library/Homebrew/dev-cmd/pull.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index dd2bc6270..a8f35531f 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -587,7 +587,7 @@ module Homebrew # We're in the cache; make sure to force re-download loop do begin - curl_download url, to: filename + curl_download url, continue_at: 0, to: filename break rescue if retry_count >= max_curl_retries -- cgit v1.2.3 From 01e9ec9a9f723b2ef89c7adfaea39f9e4db9aede Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 24 Sep 2017 19:24:46 +0100 Subject: Rubocop: automatic rule fixes. --- Library/Homebrew/dev-cmd/pull.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index a8f35531f..931cba07f 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -75,7 +75,7 @@ module Homebrew tap = CoreTap.instance elsif (testing_match = arg.match %r{/job/Homebrew.*Testing/(\d+)/}) tap = ARGV.value("tap") - tap = if tap && tap.start_with?("homebrew/") + tap = if tap&.start_with?("homebrew/") Tap.fetch("homebrew", tap.strip_prefix("homebrew/")) elsif tap odie "Tap option did not start with \"homebrew/\": #{tap}" @@ -350,7 +350,7 @@ module Homebrew files << Regexp.last_match(1) if line =~ %r{^\+\+\+ b/(.*)} end files.each do |file| - if tap && tap.formula_file?(file) + if tap&.formula_file?(file) formula_name = File.basename(file, ".rb") formulae << formula_name unless formulae.include?(formula_name) else -- cgit v1.2.3 From cf5fdeef1d8e9fd053121145882835b87eec2a43 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 24 Sep 2017 20:12:58 +0100 Subject: Rubocop: manual rule fixes. --- Library/Homebrew/dev-cmd/pull.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 931cba07f..cd0d6fbd0 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -69,7 +69,7 @@ module Homebrew tap = nil ARGV.named.each do |arg| - if arg.to_i > 0 + if arg.to_i.positive? issue = arg url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}" tap = CoreTap.instance -- cgit v1.2.3 From 175ca909ee1a5b57aa0cae2c879920511f311b14 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 7 Oct 2017 00:31:28 +0200 Subject: Clean up code style and remove `.rubocop_todo.yml`. --- Library/Homebrew/dev-cmd/pull.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd/pull.rb') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index cd0d6fbd0..8cb270303 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -154,8 +154,8 @@ module Homebrew begin f = Formula[name] - # Make sure we catch syntax errors. - rescue Exception + rescue Exception # rubocop:disable Lint/RescueException + # Make sure we catch syntax errors. next end -- cgit v1.2.3