aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLibrary/Contributions/cmds/brew-pull.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/Library/Contributions/cmds/brew-pull.rb b/Library/Contributions/cmds/brew-pull.rb
index f7e2516d5..f17ecdbc7 100755
--- a/Library/Contributions/cmds/brew-pull.rb
+++ b/Library/Contributions/cmds/brew-pull.rb
@@ -3,18 +3,21 @@
require 'utils'
+def tap arg
+ match = arg.match(%r[homebrew-(\w+)/])
+ match[1] if match
+end
+
if ARGV.empty?
onoe 'This command requires at least one argument containing a URL or pull request number'
end
-Dir.chdir HOMEBREW_REPOSITORY
-
ARGV.named.each do|arg|
if arg.to_i > 0
url = 'https://github.com/mxcl/homebrew/pull/' + arg
else
# This regex should work, if it's too precise, feel free to fix it.
- url_match = arg.match 'https:\/\/github.com\/\w+\/homebrew\/(pull\/(\d+)|commit\/\w{4,40})'
+ url_match = arg.match 'https:\/\/github.com\/\w+\/homebrew(-\w+)?\/(pull\/(\d+)|commit\/\w{4,40})'
unless url_match
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
next
@@ -23,6 +26,12 @@ ARGV.named.each do|arg|
url = url_match[0]
end
+ if tap url
+ Dir.chdir HOMEBREW_REPOSITORY/"Library/Taps/homebrew-#{tap url}"
+ else
+ Dir.chdir HOMEBREW_REPOSITORY
+ end
+
# GitHub provides commits'/pull-requests' raw patches using this URL.
url += '.patch'
@@ -65,7 +74,7 @@ ARGV.named.each do|arg|
`git diff #{revision}.. --name-status`.each_line do |line|
status, filename = line.split
# Don't try and do anything to removed files.
- if (status == 'A' or status == 'M') and filename.include? '/Formula/'
+ if (status == 'A' or status == 'M') and filename.include? '/Formula/' or tap url
formula = File.basename(filename, '.rb')
ohai "Installing #{formula}"
# Not sure if this is the best way to install?