#!/usr/bin/env ruby require 'pp' PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server ozones_server_mysql ozones_server_sqlite} DEFAULT=%w{optional sunstone quota cloud ozones_server acct} GROUPS={ :optional => %w{nokogiri libxml-ruby}, :quota => %w{sqlite3 sequel}, :sunstone => %w{json rack sinatra thin}, :cloud => %w{amazon-ec2 rack sinatra thin uuid curb}, :ozones_client => %w{json}, :ozones_server => %w{json datamapper dm-sqlite-adapter dm-mysql-adapter}, :ozones_server_sqlite => %w{json datamapper dm-sqlite-adapter}, :ozones_server_mysql => %w{json datamapper dm-mysql-adapter}, :acct => %w{sequel sqlite3 mysql}, :acct_sqlite => %w{sequel sqlite3 mysql}, :acct_mysql => %w{sequel sqlite3 mysql} } class String def unindent(spaces=4) self.gsub!(/^ {#{spaces}}/, '') end end def try_library(name, error_message) begin require name.to_s rescue LoadError STDERR.puts error_message exit -1 end end def install_warning(packages) puts "Use -h for help" puts puts "About to install the gems for these components:" puts "* "<0 packages=ARGV else packages=DEFAULT end packages_string=get_gems(packages).join(' ') command_string = "gem install --no-ri --no-rdoc #{packages_string}" install_warning(packages) puts command_string system command_string