From c2f1a41bbcac0e87bd24cca945266ff33f74be9b Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Tue, 9 Feb 2010 11:30:16 -0800 Subject: [PATCH] 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 ". Signed-off-by: Adam Vandenberg --- Library/Homebrew/formula_installer.rb | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 66cf35dcdb..8fdc77dbe8 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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