Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Latest commit

 

History

History
100 lines (66 loc) · 2.81 KB

README.rdoc

File metadata and controls

100 lines (66 loc) · 2.81 KB

couch_docs

by Chris Strom
http://github.com/eee-c/couch_docs
(used to be couch_design_docs)

DESCRIPTION:

Manage CouchDB views and documents.

FEATURES/PROBLEMS:

  • Upload JSON documents stored on the filesystem into a CouchDB database.

  • Map .js files stored on the filesystem (e.g. _design/recipes/count_by_month/map.js) into CouchDB design documents.

    • Support for the !code macro from couchapp (useful for DRYing up map/reduce views as well as list/show documents.

  • Dump documents stored in CouchDB to the filesystem.

  • Script (couch-docs) to restore / backup CouchDB database.

    • Multiple options including a directory watcher for uploading directory changes

  • A progress bar would be helpful.

  • Unit testing of view javascript would be very nice.

  • Will almost certainly not work for large datasets (>10k documents).

SYNOPSIS:

From the command line:

# For dumping the contents of a CouchDB database to the filesystem
couch-docs dump "http://localhost:5984/db" path/to/dump_dir/

# For loading documents from the filesystem into CouchDB
couch-docs load "http://localhost:5984/db" path/to/dump_dir/

In code:

DB_URL = "http://localhost:5984/db"
DIRECTORY = "/repos/db/couchdb/"

# /repos/db/couchdb/_design/lucene/transform.js
# /repos/db/couchdb/foo.json

CouchDocs.put_dir(DB_URL, DIRECTORY)

# => lucene design document with a "transform" function containing
#    the contents of transform.js
#     - AND -
#    a document named "foo" with the JSON contents from the foo.json
#    file

CouchDocs.dump(DB_URL, "/repos/db/bak")

# => JSON dump of every document at DB_URL

REQUIREMENTS:

  • CouchDB

  • JSON

  • RestClient

  • DirectoryWatcher

INSTALL:

  • sudo gem install couch_docs

LICENSE:

(The MIT License)

Copyright © 2010

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.