Skip to content

Instantly share code, notes, and snippets.

@steverobbins
Created August 17, 2015 18:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steverobbins/495775d39c57882a3a4a to your computer and use it in GitHub Desktop.
Save steverobbins/495775d39c57882a3a4a to your computer and use it in GitHub Desktop.
lock '3.4.0'
set :application, 'magento'
set :repo_url, 'git@example.com:company/repo.git'
set :keep_releases, 10
app_symlinks = ['app/etc/local.xml', 'media', 'var']
namespace :magento do
desc 'Symlink shared files and folders'
task :apply_symlinks do
on roles(:app) do
app_symlinks.each do |symlink|
execute "rm -rf #{release_path}/#{symlink}"
execute "ln -s #{shared_path}/#{symlink} #{release_path}/#{symlink}"
end
end
end
desc 'Generate CSS'
task :generate_css do
on roles(:app) do
execute "#{release_path}/shell/compass.sh clean"
execute "#{release_path}/shell/compass.sh compile -e develop"
end
end
desc 'Enable maintenance mode'
task :maint_on do
on roles(:app) do
execute "touch #{release_path}/maintenance.flag"
end
end
desc 'Disable maintenance mode'
task :maint_off do
on roles(:app) do
execute "rm -f #{release_path}/maintenance.flag"
end
end
end
namespace :hipchat do
desc 'Hipchat Notification'
task :notify do
sh "curl -sSd '{\"color\": \"green\", \"message\": \"#{revision_log_message}\", \"notify\": true, \"message_format\": \"text\"}' -H 'Content-Type: application/json' https://api.hipchat.com/v2/room/ROOM_ID/notification?auth_token=SECRET"
end
end
after 'deploy:updated', 'magento:apply_symlinks'
after 'deploy:updated', 'magento:generate_css'
after 'deploy:updated', 'deploy:cleanup'
after 'deploy', 'hipchat:notify'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment