Skip to content
forked from jo/grunt-couch

Build and publish Couchapps and CouchDB design documents with grunt. Simple.

License

Notifications You must be signed in to change notification settings

null2/grunt-couch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-couch

Compile CouchDB design documents from Couchapp like directory tree.

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-couch --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-couch');

The "ddoc" task

Overview

In your project's Gruntfile, add a section named couch to the data object passed into grunt.initConfig().

grunt.initConfig({
  couch: {
    app: {
      files: 'app.json': 'ddoc'
    }
  }
})

This will load the Couchapp like directory tree from ddoc and creates an app.json document.

See Configuring tasks: Files for more information about possible source and target configurations.

The Couchapp Directory Tree

is quiet self-explanatory. For example:

ddoc
├── _attachments
│   ├── a
│   │   └── nested
│   │       └── file.txt
│   └── index.html
├── _id
├── language
├── lists
│   └── docs.js
├── rewrites.json
├── shows
│   ├── doc.js
│   └── hello.js
├── validate_doc_update.js
└── views
    ├── names
    │   └── map.js
    └── numbers
        ├── map.js
        └── reduce

Output JSON

The output JSON follows the Bulk Document API:

{
  "docs": [
    { "_id": "adoc" },
    { "_id": "anotherdoc" }
  ]
}

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

About

Build and publish Couchapps and CouchDB design documents with grunt. Simple.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published