This post originated from an RSS feed registered with Ruby Buzz
by rwdaigle.
Original Post: What's New in Edge Rails: An Interactive Capistrano Shell
Feed Title: Ryan's Scraps
Feed URL: http://feeds.feedburner.com/RyansScraps
Feed Description: Ryan Daigle's various technically inclined rants along w/ the "What's new in Edge Rails" series.
This utility comes with several warnings about its experimental state and unknown future – but we’re not going to let that damper our inquisitiveness, are we? Introducing a way to execute capistrano commands from a shell environment (think script/console). So how does this Capistrano shell work?
First, start the capistrano shell w/
rake remote:shell
Then enter commands to be executed on your remote environments. (These are mostly from the shell source comments itself)
# Execute on all servers
cap> echo ping
# Execute on specific servers
on myserver1.com,myserver2.com echo ping
# To execute based on roles
with app,db echo ping
# Execute a capistrano task
!deploy
# Execute multiple capistrano tasks
!setup deploy
# Combine all the goodness to execute a task on
# specific servers and roles
on myserver1.com !setup
with app !setup
Why would you want to use this shell? Well, you get the ability to simultaneously manipulate several environments from one shell – and all within the friendly confines of capistrano. You should find the rollback task to be especially comforting…