#!/usr/bin/env ruby # Parameters which can be passed in environment variables MADSCIENCE_REPO_URL = ENV['MADSCIENCE_REPO'] || "git@github.com:noahgibbs/madscience.git" MADSCIENCE_PROVIDER = ENV['MADSCIENCE_PROVIDER'] || "virtualbox" # TODO: Add Windows runas incantation to replace sudo on Windows USAGE_INFO = < 1 raise "#{$0} #{ARGV[0]} takes no other arguments!" end if ARGV[0] == "setup" # Now we'll use Chef to install the right version of Vagrant # with the right plugin(s). check_superuser do_local_setup exit 0 # Success! end if ARGV[0] == "clone" do_clone puts "Successfully cloned repo under this directory. Now customize nodes/all_nodes.json.erb!" exit 0 end if ARGV[0] == "setup_clone_and_deploy" check_superuser do_local_setup drop_sudo_privileges do_clone do_deploy puts "Successfully cloned repo #{MADSCIENCE_REPO_URL} under this directory. Now customize nodes/all_nodes.json.erb!" exit 0 end if ARGV == [] puts USAGE_INFO raise "No command given!" end puts USAGE_INFO raise "Unrecognized command: #{ARGV.inspect}!"