Created
December 3, 2009 21:28
-
-
Save timh/248544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timmbp-oc:~/devel/opscode tim$ cat couchdb-delete-dbs.rb | |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'couchrest' | |
class CouchDbDeleter | |
def initialize() | |
@couch_client = CouchRest.new('http://localhost:5984') | |
end | |
def go() | |
all_db_names = @couch_client.databases | |
all_db_names.each do |db_name| | |
if db_name =~ /authorization_design_documents/ | |
puts "NOT DELETING #{db_name}" | |
else | |
puts "!!! DELETING #{db_name}" | |
db = @couch_client.database(db_name) | |
db.delete! | |
end | |
end | |
end | |
end | |
db = CouchDbDeleter.new | |
db.go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment