set :application, "capcidemo" set :repository, "http://labs.vazav.com/capcidemo/trunk" set :user, "celericp" set :domain, "apps.vazav.com" set :scm_username, "deploy" set(:scm_password){Capistrano::CLI.password_prompt("subversion password: ")} set :deploy_to, "/home/#{user}/#{domain}/#{application}" set :use_sudo, false role :app, domain namespace :deploy do desc <<-DESC [internal] Touches up the released code. This is called by update_code \ after the basic deploy finishes. It assumes a Rails project was deployed, \ so if you are deploying something else, you may want to override this \ task with your own environment's requirements. This task will make the release group-writable (if the :group_writable \ variable is set to true, which is the default). It will then set up \ symlinks to the shared directory for the log, system, and tmp/pids \ directories, and will lastly touch all assets in public/images, \ public/stylesheets, and public/javascripts so that the times are \ consistent (so that asset timestamping works). DESC task :finalize_update, :except => { :no_release => true } do run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) # mkdir -p is making sure that the directories are there for some SCM's that don't # save empty folders run <<-CMD rm -rf #{latest_release}/system/logs && mkdir -p #{latest_release}/htdocs && ln -s #{shared_path}/logs #{latest_release}/system/logs CMD stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") asset_paths = %w(images stylesheets javascripts).map { |p| "#{latest_release}/htdocs/#{p}" }.join(" ") run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" } end desc <<-DESC Restarts your application. This works by calling the script/process/reaper \ script under the current path. By default, this will be invoked via sudo, \ but if you are in an environment where sudo is not an option, or is not \ allowed, you can indicate that restarts should use `run' instead by \ setting the `use_sudo' variable to false: set :use_sudo, false DESC task :restart, :roles => :app, :except => { :no_release => true } do # For PHP apps, you don't need to restart the app server, so we'll No-Op this. # invoke_command "#{current_path}/script/process/reaper", :via => run_method end end