class Deploytool # Configure Chef-solo def initialize if `gem list|grep chef`.empty? STDERR.puts "WARNING: you don't appear to have chef installed" end end # Many customization options are available!!! # SEE: http://wiki.opscode.com/display/chef/Deploy+Resource # Configure the cookbook to use svn with no extra 'shared' files (generic) # ~ is the options hash usually populated by trollop's command line opts def use_svn(opts) # The Deploy resources assumes you have already created the 'shared' directories FileUtils.mkdir_p File.join(opts[:destination], 'shared', 'log') # setup the optional action and revision rev = "" rev = "revision \"#{opts[:revision]}\"" if opts[:revision] action = "" action = "action :rollback" if opts[:rollback] action = "action :force_deploy" if opts[:force] # setup optional auth suser = "" suser = "svn_username #{ENV['OPT_SVN_USERNAME']}" if ENV['OPT_SVN_USERNAME'] spass = "" spass = "svn_password #{ENV['OPT_SVN_USERNAME']}" if ENV['OPT_SVN_USERNAME'] @cookbook =< is the options hash usually populated by trollop's command line opts def use_git(opts) # The Deploy resources assumes you have already created the 'shared' directories FileUtils.mkdir_p File.join(opts[:destination], 'shared', 'log') # setup the optional action and revision rev = "" rev = "revision \"#{opts[:revision]}\"" if opts[:revision] action = "" action = "action :rollback" if opts[:rollback] action = "action :force_deploy" if opts[:force] @cookbook =<