Created
February 28, 2013 14:00
-
-
Save real34/5056925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on Occitech's CakePHP capistrano recipe (see https://github.com/occitech/capistrano-recipes) | |
server "xxxx.yyy.com", :app, :web, :db, :primary => true | |
set :deploy_to, "/xxx/yyy" | |
set :branch, "develop" | |
set :url_base, "http://xxx.occi-tech.com" | |
set :application, "Croogo" | |
set :repository, "git@xxx/yyy.git" | |
set :scm, :git | |
set :git_enable_submodules, 1 | |
set :ssh_options, {:forward_agent => true} | |
set :deploy_via, :remote_cache | |
set :user, "xxx" | |
set :use_sudo, false | |
set :keep_releases, 2 | |
set :cake_branch, "master" | |
set :app_symlinks, ["/tmp", "/uploads"] | |
set :app_shared_dirs, ["/Config", "/tmp/logs", "/tmp/cache/queries"] | |
set :app_shared_files, [ | |
"/Config/database.php", | |
"/Config/croogo.php", | |
"/Config/settings.json", | |
] | |
set :croogo_plugin, ["CustomPlugin1", "CustomPlugin2"] | |
def remote_file_exists?(full_path) | |
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip | |
end | |
namespace :croogo do | |
desc 'Croogo deployment' | |
desc "Install Croogo" | |
task :install do | |
cmd = "#{shared_path}/cake/lib/Cake/Console/cake -app #{latest_release}#{app_path} Install.install" | |
input = '' | |
run cmd do |channel, stream, data| | |
next if data.chomp == input.chomp | |
print data | |
channel.send_data(input = $stdin.gets) if data =~ />/ | |
end | |
end | |
desc "Activate croogo plugin" | |
task :activate_plugins do | |
croogo_plugin.each do |plugin| | |
croogo.chmod | |
cmd = "#{shared_path}/cake/lib/Cake/Console/cake -app #{latest_release}#{app_path} ext activate plugin #{plugin}" | |
run cmd | |
end | |
end | |
desc "Chmod files" | |
task :chmod do | |
path = "#{latest_release}#{app_path}" | |
run "chmod -R 777 #{path}/Config #{path}/Test #{path}/tmp/*" | |
end | |
desc "Clear Croogo cache" | |
task :clear_cache do | |
run "mkdir -p #{shared_path}/tmp/cache/queries" | |
end | |
end | |
namespace :composer do | |
desc "Get composer" | |
desc "Download Composer" | |
task :download do | |
capistranoFile = "#{latest_release}#{app_path}/composer.phar" | |
if !remote_file_exists?(capistranoFile) | |
run "cd #{latest_release}#{app_path} && curl -s http://getcomposer.org/installer | php" | |
end | |
end | |
end | |
after "deploy", "cake:clear_cache" | |
after "cake:clear_cache", "croogo:clear_cache" | |
after "deploy", "deploy:cleanup" | |
after "croogo:activate_plugins", "chosen_install" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment