21 lines
443 B
Ruby
Executable file
21 lines
443 B
Ruby
Executable file
#!/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)
|