Skip to content
This repository
tree: e64819092c
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 24 lines (21 sloc) 0.768 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
module Couchup
  module Commands
    class ReplicateTo
      include ::Couchup::CommandExtensions
      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
      
      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
      
    end
  end
  
end
Something went wrong with that request. Please try again.