11. require “capistrano/ext/multistage”
require “capistrano_colors”
require “railsless-deploy”
require “rubygems”
set :application, “cake2_sample”
set :scm, :git
set :repository, “git@bitbucket.org:ryuzee/cake2_sample.git”
set :branch, “master”
set :deploy_to, “/usr/local/webapp/cake2_sample”
set :deploy_via, :copy
set :use_sudo, true
after “deploy”, “change_permission”
after “deploy”, “git_submodule_update”
after “deploy”, “migrate”
desc “アプリケーションの動作に必要なパーミッションの設定をします”
task :change_permission, roles => :web do
run <<-CMD
chmod -R 777 #{deploy_to}/current/app/tmp
CMD
end
desc “外部モジュールを取得します”
task :git_submodule_update, roles => :web do
run <<-CMD
cd #{deploy_to}/current && git submodule init && git submodule update
CMD
end
desc “データベースのマイグレーションを実行します”
task :migrate, roles => :web do
run <<-CMD
cd #{deploy_to}/current/app && Console/cake Migrations.migration run all
-p Migrations && Console/cake Migrations.migration run all
CMD
end
http://www.ryuzee.com/contents/blog/6119
deploy.rb