#!/usr/bin/env ruby require 'rubygems' require 'trollop' require 'standup' opt_parser = Trollop::Parser.new do banner 'Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.' banner '' banner 'Usage:' banner ' standup script [options]' banner '' banner 'where script is one of the following:' banner '' offset = Standup.scripts.keys.map(&:length).max + 2 Standup.scripts.each do |name, script| banner "#{"%-#{offset}s" % name} #{script.description}" end banner '' banner "and [options] are:" banner '' stop_on Standup.scripts.keys end Trollop::with_standard_exception_handling opt_parser do opt_parser.parse ARGV raise Trollop::HelpNeeded if ARGV.empty? end exit if ARGV.empty? script_name = ARGV.shift if Standup.scripts.include? script_name Standup.nodes.each {|node| node.run_script script_name} else opt_parser.die "unknown script #{script_name}", nil end