gem sources -a http://gems.github.com # if github is not already in your gem sources
gem install Voker57-reploy
If you are using merb, you can write the following into lib/tasks/reploy.rake
. Otherwise, consult local authority / call it Rakefile
.
That's example script, using git to get versioned content from local working copy, rsync to transfer files and using merb methods to restart remote server
require 'reploy'
Reploy.load(:host => "example.com", # remote host
:user => "username", # remote login
:path => "/var/www/example.com", # remote path to deploy site. Actual site vill be deployed to current/ subdir.
:recipes => ["git", "merb", "rsync"], # requiring bundled recipes, end one with .rb to load it from global search paths
:copy => [ ["config/database.yml","config"] ], # files that are not included in version control
:store_backups => false, # setting this to true leaves named backups in their folders after deployment
# merb settings
:merb => { :host => "127.0.0.1", # host to listen on
:port => "4000", # port
:environment => "production", # environment
:adapter => "thin" # rack adapter
})
task :deploy => ["reploy:merb:deploy"] # shortcut for convenience
You can see more examples here