Add support for external ruby deps, and fix external deps system.

Kernel#system special-cases the first argument, so you have to
make the first argument the entire command to be invoked, and
subsequent arguments the actual arguments to that command. In
order to use the user's interpreter, the first argument must be
"/usr/bin/env <name>".

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Andre Arko 2010-02-09 11:30:16 -08:00 committed by Adam Vandenberg
parent 080a7ee3dc
commit c2f1a41bbc

View File

@ -27,7 +27,6 @@ Unsatisfied dependency, #{dep}
Homebrew does not provide formula for Python dependencies, pip does:
#{brew_pip} pip install #{dep}
EOS
end
def plerr dep; <<-EOS
@ -35,7 +34,13 @@ Unsatisfied dependency, #{dep}
Homebrew does not provide formula for Perl dependencies, cpan does:
cpan -i #{dep}
EOS
end
def rberr dep; <<-EOS
Unsatisfied dependency "#{dep}"
Homebrew does not provide formulae for Ruby dependencies, rubygems does:
gem install #{dep}
EOS
end
@ -43,24 +48,32 @@ Homebrew does not provide formula for Perl dependencies, cpan does:
return unless f.external_deps
f.external_deps[:python].each do |dep|
raise pyerr(dep) unless quiet_system "/usr/bin/python", "-c", "import #{dep}"
raise pyerr(dep) unless quiet_system "/usr/bin/env", "python", "-c", "import #{dep}"
end
f.external_deps[:perl].each do |dep|
raise plerr(dep) unless quiet_system "/usr/bin/perl", "-e", "use #{dep}"
raise plerr(dep) unless quiet_system "/usr/bin/env", "perl", "-e", "use '#{dep}'"
end
f.external_deps[:ruby].each do |dep|
raise rberr(dep) unless quiet_system "/usr/bin/env", "ruby", "-rubygems", "-e", "require '#{dep}'"
end
end
def install f
def check_formula_deps f
expand_deps(f).each do |dep|
begin
check_external_deps f
install_private dep unless dep.installed?
rescue
#TODO continue if this is an optional dep
raise
end
end if @install_deps
end
end
def install f
if @install_deps
check_external_deps f
check_formula_deps f
end
install_private f
end