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: Homebrew does not provide formula for Python dependencies, pip does:
#{brew_pip} pip install #{dep} #{brew_pip} pip install #{dep}
EOS EOS
end end
def plerr dep; <<-EOS def plerr dep; <<-EOS
@ -35,7 +34,13 @@ Unsatisfied dependency, #{dep}
Homebrew does not provide formula for Perl dependencies, cpan does: Homebrew does not provide formula for Perl dependencies, cpan does:
cpan -i #{dep} 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 EOS
end end
@ -43,24 +48,32 @@ Homebrew does not provide formula for Perl dependencies, cpan does:
return unless f.external_deps return unless f.external_deps
f.external_deps[:python].each do |dep| 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 end
f.external_deps[:perl].each do |dep| 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
end end
def install f def check_formula_deps f
expand_deps(f).each do |dep| expand_deps(f).each do |dep|
begin begin
check_external_deps f
install_private dep unless dep.installed? install_private dep unless dep.installed?
rescue rescue
#TODO continue if this is an optional dep #TODO continue if this is an optional dep
raise raise
end 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 install_private f
end end