We use Capistrano Installs as a Ruby Gem Already contains all the rich logic you need.https://github.com/capistrano/capistrano/wiki/Documentation-v2.x
How Deploys WorkCapistrano logs into remote server via sshChecks out the latest code for speciﬁed branchin new directory that it createsRuns rebuild.sh to build the make ﬁleOn Success, symlinks the new directory towhere Drupal (or Apache) is looking for it.Automatically rolls back if any errors.
How Rollbacks WorkA new “release” is created on every deploy.Symlink is changed so that it points to theprevious release.
This is aNON-DESTRUCTIVE deploy. (It’s a good idea to backup your database before running update.php)
Thank you. Questions?Tom FriedhofDeveloper at ActiveLAMPTwitter: @activelamp @tomfriedhof www.activelamp.com