brew-pull: add support for pulling from taps
This commit is contained in:
parent
d3ba9723b2
commit
04bf4e5f89
@ -3,18 +3,21 @@
|
|||||||
|
|
||||||
require 'utils'
|
require 'utils'
|
||||||
|
|
||||||
|
def tap arg
|
||||||
|
match = arg.match(%r[homebrew-(\w+)/])
|
||||||
|
match[1] if match
|
||||||
|
end
|
||||||
|
|
||||||
if ARGV.empty?
|
if ARGV.empty?
|
||||||
onoe 'This command requires at least one argument containing a URL or pull request number'
|
onoe 'This command requires at least one argument containing a URL or pull request number'
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir HOMEBREW_REPOSITORY
|
|
||||||
|
|
||||||
ARGV.named.each do|arg|
|
ARGV.named.each do|arg|
|
||||||
if arg.to_i > 0
|
if arg.to_i > 0
|
||||||
url = 'https://github.com/mxcl/homebrew/pull/' + arg
|
url = 'https://github.com/mxcl/homebrew/pull/' + arg
|
||||||
else
|
else
|
||||||
# This regex should work, if it's too precise, feel free to fix it.
|
# 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
|
unless url_match
|
||||||
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
ohai 'Ignoring URL:', "Not a GitHub pull request or commit: #{arg}"
|
||||||
next
|
next
|
||||||
@ -23,6 +26,12 @@ ARGV.named.each do|arg|
|
|||||||
url = url_match[0]
|
url = url_match[0]
|
||||||
end
|
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.
|
# GitHub provides commits'/pull-requests' raw patches using this URL.
|
||||||
url += '.patch'
|
url += '.patch'
|
||||||
|
|
||||||
@ -65,7 +74,7 @@ ARGV.named.each do|arg|
|
|||||||
`git diff #{revision}.. --name-status`.each_line do |line|
|
`git diff #{revision}.. --name-status`.each_line do |line|
|
||||||
status, filename = line.split
|
status, filename = line.split
|
||||||
# Don't try and do anything to removed files.
|
# 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')
|
formula = File.basename(filename, '.rb')
|
||||||
ohai "Installing #{formula}"
|
ohai "Installing #{formula}"
|
||||||
# Not sure if this is the best way to install?
|
# Not sure if this is the best way to install?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user