Class: Couchup::Commands::ReplicateTo
- Inherits:
-
Object
- Object
- Couchup::Commands::ReplicateTo
- Includes:
- Couchup::CommandExtensions
- Defined in:
- lib/couchup/commands/replicate_to.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Couchup::CommandExtensions
Class Method Details
.describe ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/couchup/commands/replicate_to.rb', line 13 def self.describe { :description => "Allows replication to different databases", :examples => ["replicate_to :riders_dev", "replicate_to 'http://foo.bar.com:5984/billing', :continous"], :usage => "replicate_to <target_db>, options" } end |
Instance Method Details
#run(*params) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/couchup/commands/replicate_to.rb', line 5 def run(*params) dest = params.shift option = params.shift needs_db! dest_db = (dest =~ /(http\w:\/\/.*)\/(.*)/) ? CouchRest::Database.new(CouchRest::Server.new($1), $2) : CouchRest::Database.new(Couchup.server, dest) Couchup.database.replicate_to dest_db, (option.to_s == "continous") end |