#!/usr/bin/env ruby MADSCIENCE_REPO_URL = ENV['MADSCIENCE_REPO'] || "git@github.com:noahgibbs/rubydeploy-deploy-repo.git" # TODO: Add Windows runas incantation to replace sudo on Windows USAGE_INFO = < 1 puts "#{$0} setup takes no other arguments!" exit -1 end # Now we'll use Chef to install the right version of Vagrant # with the right plugin(s). system("librarian-chef", "install") system("chef-solo", "-c", "solo.rb") or exit -1 exit 0 # Success! end if ARGV[0] == "clone" if ARGV.size > 1 puts "#{$0} clone takes no other arguments!" exit -1 end # Change back to pre-Bundler-setup directory where we were invoked Dir.chdir cur_dir home_dir = ENV['HOME'] || ENV['userprofile'] location = "#{home_dir}/deploy_repo" # Now we'll git clone the MadScience repo, at a branch corresponding to our MadScience version # TODO: check out MadScience::VERSION branch when we start having real releases cmd = "git clone #{MADSCIENCE_REPO_URL} #{location}" unless system cmd puts "Couldn't successfully clone MadScience repo from #{MADSCIENCE_REPO_URL}, branch #{MadScience::VERSION}!" exit -1 end puts "Successfully cloned repo into #{location} under directory #{location}. Now go in and customize it." exit 0 end if ARGV == [] puts "No command given." puts USAGE_INFO exit -1 end puts "Unrecognized command: #{ARGV.inspect}!" puts USAGE_INFO exit -1