From 21fb605e3a57455e4a46c495ffcf36502f8fd1b9 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 11 Sep 2013 08:31:22 +0200 Subject: write _security to fresh couch --- lib/tapicero/couch_database_creator.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/tapicero/couch_database_creator.rb') diff --git a/lib/tapicero/couch_database_creator.rb b/lib/tapicero/couch_database_creator.rb index a4aaa0f..5a2849b 100644 --- a/lib/tapicero/couch_database_creator.rb +++ b/lib/tapicero/couch_database_creator.rb @@ -1,14 +1,19 @@ require 'couchrest' +require 'json' module Tapicero class CouchDatabaseCreator def initialize(host) + @host = host @couch = CouchRest.new(host) end - def create(name) - @couch.database(name).create! + def create(name, security = {}) + db = @couch.create_db(name) + puts security.to_json + puts "-> #{@host}#{name}/_security" + CouchRest.put "#{@host}#{name}/_security", security end end end -- cgit v1.2.3