22.09.2013 Views

Ruby on rails 101 - Peter Marklund's Home

Ruby on rails 101 - Peter Marklund's Home

Ruby on rails 101 - Peter Marklund's Home

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Custom Capistrano<br />

Tasks<br />

def m<strong>on</strong>grel_cluster(command)<br />

"m<strong>on</strong>grel_<strong>rails</strong> cluster::#{command} -C #{current_path}/c<strong>on</strong>fig/m<strong>on</strong>grel_cluster.yml"<br />

end<br />

%w(restart stop start).each do |command|<br />

task command.to_sym, :roles => :app do<br />

run m<strong>on</strong>grel_cluster(command)<br />

end<br />

end<br />

desc "Run pre-symlink tasks"<br />

task :before_symlink, :roles => :web do<br />

copy_shared<br />

backup_db<br />

run_tests<br />

end<br />

desc "Clear out old code trees. Only keep 5 latest releases around"<br />

task :after_deploy do<br />

cleanup<br />

sleep 5<br />

ping_servers<br />

end<br />

desc "Copy in server specific c<strong>on</strong>figurati<strong>on</strong> files"<br />

task :copy_shared do<br />

run

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!