Created
October 9, 2012 15:35
-
-
Save rietta/3859566 to your computer and use it in GitHub Desktop.
Capistrano Pre-compile Assets Locally and Deploy through Git
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
# | |
# One solution for deploying assets to production servers through git while | |
# precompiling the assets on the local development system. | |
# | |
# By Frank Rietta | |
# Copyright 2012 Rietta Inc. All Rights Reserved. | |
# Licensed as open source under terms of the BSD license. | |
# | |
# The script switches to the deploy branch, syncs it down, merges the changes from master, precompiles the | |
# assets and then pushes those to the deploy branch on remote so that the capistrano script can deploy the | |
# latest code. | |
# | |
namespace :preflight do | |
task :prepare_assets_in_git do | |
%x{bundle update} | |
%x{git checkout deploy} | |
%x{git pull origin deploy} | |
%x{git merge master} | |
%x{bundle exec rake assets:precompile} | |
%x{git add .} | |
%x{git commit -m "Automatic deployment"} | |
%x{git push origin deploy} | |
end | |
end | |
# ... Your Deploy Code Here ... | |
# Compile bundle and gems into the vendors/cache directory | |
before "deploy:update_code", 'preflight:prepare_assets_in_git' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment