Skip to content

Instantly share code, notes, and snippets.

@lgrz
Created August 7, 2012 00:43
Show Gist options
  • Save lgrz/3280051 to your computer and use it in GitHub Desktop.
Save lgrz/3280051 to your computer and use it in GitHub Desktop.
Collection of Capifony tasks
after "deploy:restart", "deploy:cleanup"
after "deploy:setup", "symfony:setup:parameters_init"
# Clear the cache before the cache:warmup task is run. The cache directory is
# shared, that way setting ACL's only happens once and we avoid the use of
# sudo
before 'deploy:finalize_update', 'symfony:cache:remove'
namespace :symfony do
namespace :cache do
desc "Remove cache files before finalize"
task :remove, :roles => :app do
pretty_print "--> Removing all cache files"
run "rm -fr #{deploy_to}/#{shared_dir}/app/cache/*"
puts_ok
end
end
namespace :setup do
desc "Copy default parameters file to remote server"
task :parameters_init, :roles => :app do
pretty_print "--> Copying parameters.yml.dist"
top.upload "#{Dir.pwd}/app/config/parameters.yml.dist", "#{deploy_to}/#{shared_dir}/app/config/parameters.yml"
end
end
namespace :assets do
desc "Updates assets version (in config.yml)"
task :update_version, :roles => :app, :except => { :no_release => true } do
ext = ""
if is_osx?
ext = "''" # extension is required for OS X
end
try_sudo "sed -i #{ext} 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/#{app_path}/config/config.yml"
end
end
end
def is_osx?
'Darwin' == capture("uname").strip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment