Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a0e7828b90
Fetching contributors…

Cannot retrieve contributors at this time

file 20 lines (18 sloc) 0.741 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module Couchup
  module Commands
    class Drop
      def run(*params)
        op_type = params.shift.to_s
        (params.first.nil? ? Couchup.database : Couchup.database(params.first)).delete! if op_type == 'database'
        ::Couchup::View.new(params.first).delete! if op_type == 'view'
        Couchup.delete_doc(params.first) if op_type == 'doc'
        Couchup.delete_all_docs(params.first) if op_type == 'all_docs'
        
      end

      def self.describe
        {:description => "Drops specified object from couchdb",
        :usage => "drop [:database | :view | :doc | :all_docs]",
        :examples => ["drop :database, 'test'", "drop :view, 'Riders/top_ten'", "drop :doc, '23'", "drop :all_docs"]}
      end
    end
  end
end
Something went wrong with that request. Please try again.