aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/pull.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd/pull.rb')
-rw-r--r--Library/Homebrew/cmd/pull.rb56
1 files changed, 28 insertions, 28 deletions
diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index 983278ab2..809e4b5a4 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -1,33 +1,33 @@
# Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
# Optionally, installs it too.
-require 'utils'
-require 'formula'
-require 'cmd/tap'
+require "utils"
+require "formula"
+require "cmd/tap"
module Homebrew
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/homebrew(-[\w-]+)?/pulls/(\d+)}
- def tap arg
- match = arg.match(%r[homebrew-([\w-]+)/])
+ def tap(arg)
+ match = arg.match(%r{homebrew-([\w-]+)/})
match[1].downcase if match
end
- def pull_url url
+ def pull_url(url)
# GitHub provides commits/pull-requests raw patches using this URL.
- url += '.patch'
+ url += ".patch"
patchpath = HOMEBREW_CACHE + File.basename(url)
- curl url, '-o', patchpath
+ curl url, "-o", patchpath
- ohai 'Applying patch'
+ ohai "Applying patch"
patch_args = []
# Normally we don't want whitespace errors, but squashing them can break
# patches so an option is provided to skip this step.
- if ARGV.include? '--ignore-whitespace' or ARGV.include? '--clean'
- patch_args << '--whitespace=nowarn'
+ if ARGV.include?("--ignore-whitespace") || ARGV.include?("--clean")
+ patch_args << "--whitespace=nowarn"
else
- patch_args << '--whitespace=fix'
+ patch_args << "--whitespace=fix"
end
# Fall back to three-way merge if patch does not apply cleanly
@@ -35,13 +35,13 @@ module Homebrew
patch_args << patchpath
begin
- safe_system 'git', 'am', *patch_args
+ safe_system "git", "am", *patch_args
rescue ErrorDuringExecution
if ARGV.include? "--resolve"
odie "Patch failed to apply: try to resolve it."
else
- system 'git', 'am', '--abort'
- odie 'Patch failed to apply: aborted.'
+ system "git", "am", "--abort"
+ odie "Patch failed to apply: aborted."
end
ensure
patchpath.unlink
@@ -50,11 +50,11 @@ module Homebrew
def pull
if ARGV.empty?
- odie 'This command requires at least one argument containing a URL or pull request number'
+ odie "This command requires at least one argument containing a URL or pull request number"
end
- if ARGV[0] == '--rebase'
- odie 'You meant `git pull --rebase`.'
+ if ARGV[0] == "--rebase"
+ odie "You meant `git pull --rebase`."
end
ARGV.named.each do |arg|
@@ -64,7 +64,7 @@ module Homebrew
elsif (testing_match = arg.match %r{brew.sh/job/Homebrew%20Testing/(\d+)/})
_, testing_job = *testing_match
url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}"
- odie "Testing URLs require `--bottle`!" unless ARGV.include?('--bottle')
+ odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle")
else
if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
_, user, tap, pull = *api_match
@@ -126,19 +126,19 @@ module Homebrew
end
end
- unless ARGV.include? '--bottle'
+ unless ARGV.include? "--bottle"
changed_formulae.each do |f|
next unless f.bottle
opoo "#{f.full_name} has a bottle: do you need to update it with --bottle?"
end
end
- if issue && !ARGV.include?('--clean')
+ if issue && !ARGV.include?("--clean")
ohai "Patch closes issue ##{issue}"
message = `git log HEAD^.. --format=%B`
- if ARGV.include? '--bump'
- odie 'Can only bump one changed formula' unless changed_formulae.length == 1
+ if ARGV.include? "--bump"
+ odie "Can only bump one changed formula" unless changed_formulae.length == 1
formula = changed_formulae.first
subject = "#{formula.name} #{formula.version}"
ohai "New bump commit subject: #{subject}"
@@ -149,7 +149,7 @@ module Homebrew
# If this is a pull request, append a close message.
unless message.include? "Closes ##{issue}."
message += "\nCloses ##{issue}."
- safe_system 'git', 'commit', '--amend', '--signoff', '--allow-empty', '-q', '-m', message
+ safe_system "git", "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", message
end
end
@@ -202,14 +202,14 @@ module Homebrew
end
end
- ohai 'Patch changed:'
+ ohai "Patch changed:"
safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD"
- if ARGV.include? '--install'
+ if ARGV.include? "--install"
changed_formulae.each do |f|
ohai "Installing #{f.full_name}"
- install = f.installed? ? 'upgrade' : 'install'
- safe_system 'brew', install, '--debug', f.full_name
+ install = f.installed? ? "upgrade" : "install"
+ safe_system "brew", install, "--debug", f.full_name
end
end
end