Support external commands
Homebrew will now look for external commands that are +x on PATH, named as "brew-<cmd>" or "brew-<cmd>.rb" * Shell scripts are exec'd with some HOMEBREW variables set in the ENV. * Ruby scripts are require'd directly. See: http://wiki.github.com/mxcl/homebrew/external-commands
This commit is contained in:
parent
385e3637f2
commit
b016c2eae5
17
bin/brew
17
bin/brew
@ -377,6 +377,23 @@ begin
|
|||||||
brew_doctor
|
brew_doctor
|
||||||
|
|
||||||
else
|
else
|
||||||
|
# Check for an external shell command
|
||||||
|
if system "/usr/bin/which -s brew-#{arg}"
|
||||||
|
# Add some Homebrew vars to the ENV
|
||||||
|
['CACHE', 'CELLAR', 'LIBRARY_PATH', 'PREFIX', 'REPOSITORY'].each do |e|
|
||||||
|
ENV["HOMEBREW_#{e}"] = eval("HOMEBREW_#{e}")
|
||||||
|
end
|
||||||
|
exec("brew-#{arg}", *ARGV)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check for an external ruby command
|
||||||
|
external_rb = `/usr/bin/which brew-#{arg}.rb`.chomp
|
||||||
|
unless external_rb.empty?
|
||||||
|
require external_rb
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check for git commands
|
||||||
if ['branch', 'checkout', 'pull', 'push', 'rebase', 'reset'].include? arg
|
if ['branch', 'checkout', 'pull', 'push', 'rebase', 'reset'].include? arg
|
||||||
onoe "Unknown command: #{arg} (did you mean 'git #{arg}'?)"
|
onoe "Unknown command: #{arg} (did you mean 'git #{arg}'?)"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user