# This file is part of the Media Temple capistrano gem # (sudo gem install mt-capistrano --source=http://gems.mediatemple.net/) # # I have modified it because the way it sets up the rake command is flawed. # Instead I just `source .bash_profile` which has these same details in it # from the `mtr setup_rubygems` command # # Also, I've commented out the username and password flags because this requires # saving the password in your deploy.rb. Instead, you can run `mtr generate_config` # to have the mtr command save your username and password. If you prefer to have it saved # in your deploy.rb, switch the commented commands below. # ------------------------------------------------------------------------------------------------- # make sure that the site specific rake (and other libs) are found Capistrano::Configuration.instance(:must_exist).load do # took this out because it doesn't work #set(:rake) { "PATH=$PATH:/home/#{site}/data/rubygems/bin:/home/#{site}/data/rubygems/gems/bin RUBYLIB=/home/#{site}/data/rubygems/local/lib/site_ruby/1.8 GEM_HOME=/home/#{site}/data/rubygems/gems rake" } # this does! set(:rake) { "source $HOME/.bash_profile && rake"} # set up the mt namespace and tasks namespace :mt do desc "Register the application using 'mtr add'" task :add do # run "mtr -u #{user} -p #{password} add #{application} #{deploy_to}/current #{webpath}" run "mtr add #{application} #{deploy_to}/current #{webpath}" end %w{remove start stop restart create_link generate_htaccess info}.each do |command| desc "Runs 'mtr #{command} ' on the server." task command.to_sym do # run "mtr -u #{user} -p #{password} #{command} #{application}" run "mtr #{command} #{application}" end end %w{list status}.each do |command| desc "Runs 'mtr #{command}' on the server." task command.to_sym do # run "mtr -u #{user} -p #{password} #{command}" run "mtr #{command}" end end end # override built-in capistrano application lifecycle tasks namespace :deploy do %w{start stop restart}.each do |command| desc "#{command.capitalize} the application." task command.to_sym do mt.send(command) end end end end