Created
January 16, 2015 19:14
-
-
Save asimpson/c17b233f7475abe17c40 to your computer and use it in GitHub Desktop.
mina rollback from https://github.com/mina-deploy/mina/issues/9#issuecomment-37499645
This file contains 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
desc "Rolls back the latest release" | |
task :rollback => :environment do | |
queue! %[echo "-----> Rolling back to previous release for instance: #{domain}"] | |
# Delete existing sym link and create a new symlink pointing to the previous release | |
queue %[echo -n "-----> Creating new symlink from the previous release: "] | |
queue %[ls "#{deploy_to}/releases" -Art | sort | tail -n 2 | head -n 1] | |
queue! %[ls -Art "#{deploy_to}/releases" | sort | tail -n 2 | head -n 1 | xargs -I active ln -nfs "#{deploy_to}/releases/active" "#{deploy_to}/current"] | |
# Remove latest release folder (active release) | |
queue %[echo -n "-----> Deleting active release: "] | |
queue %[ls "#{deploy_to}/releases" -Art | sort | tail -n 1] | |
queue! %[ls "#{deploy_to}/releases" -Art | sort | tail -n 1 | xargs -I active rm -rf "#{deploy_to}/releases/active"] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment