diff options
| author | Misty De Meo | 2012-04-06 09:47:43 -0500 |
|---|---|---|
| committer | Misty De Meo | 2012-04-06 09:53:01 -0500 |
| commit | 04bf4e5f8977e4e7792f39da87cdf2e67f8ca03c (patch) | |
| tree | 6c29c8d9a571177a08602889e9f20356f789c220 /Library/Contributions/cmds | |
| parent | d3ba9723b244fc52b0b20b1cffa88d71700e6b92 (diff) | |
| download | brew-04bf4e5f8977e4e7792f39da87cdf2e67f8ca03c.tar.bz2 | |
brew-pull: add support for pulling from taps
Diffstat (limited to 'Library/Contributions/cmds')
| -rwxr-xr-x | Library/Contributions/cmds/brew-pull.rb | 17 |
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? |
