couchrest_model/bin/couchdir

21 lines
443 B
Text
Raw Normal View History

2008-08-03 21:51:17 +02:00
#!/usr/bin/env ruby
unless ARGV.length >= 2
puts "usage: couchdir path/to/directory db-name [docid]"
exit
end
require 'rubygems'
require 'couchrest'
dirname = ARGV[0]
dbname = ARGV[1]
docid = ARGV[2]
puts "Create attachments for the files in #{dirname} in database #{dbname}."
fm = CouchRest::FileManager.new(dbname)
fm.loud = true
puts "Pushing views from directory #{dirname} to database #{fm.db}"
fm.push_directory(dirname, docid)