Skip to content

Commit

Permalink
don't destroy the database!
Browse files Browse the repository at this point in the history
  • Loading branch information
paulca committed Nov 3, 2010
1 parent 8d88b01 commit e5ed268
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.1
0.1.1
2 changes: 1 addition & 1 deletion couchpop.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Paul Campbell"]
s.date = %q{2010-09-26}
s.date = %q{2010-11-03}
s.default_executable = %q{couchpop}
s.description = %q{Couchpop uploads a directory to CouchDB}
s.email = %q{paul@rslw.com}
Expand Down
9 changes: 6 additions & 3 deletions lib/couchpop.rb
Expand Up @@ -13,17 +13,20 @@ def server
end

def database

@database ||= begin
server.database!(database_name).delete!
server.database!(database_name)
end
end

def rock!

server.database!(app_name)
doc = CouchRest::Document.new({'_id' => app_name})

doc = begin
database.get(app_name)
rescue RestClient::ResourceNotFound
CouchRest::Document.new({'_id' => app_name})
end
doc.database = database

database.save_doc(doc)
Expand Down

0 comments on commit e5ed268

Please sign in to comment.