grunt-couch-data

0.1.3 • Public • Published

grunt-couch-data

Synchronizes JSON fixtures with CouchDB

Getting Started

This plugin requires Grunt ~0.4.5

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-data --save-dev

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

grunt.loadNpmTasks('grunt-couch-data');

The "couch_data" task

Overview

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

grunt.initConfig({
  couch_data: {
    options: {
      dbHost: 'http://localhost:5984/',
      verbose: true
    },
    dev: {
      src: 'fixtures/dev/*.json'
    },
  },
});

Options

options.dbHost

Type: String Default value: None

Specifies the Couch DB server. It must end with a slash.

options.verbose

Type: Boolean Default value: false

Enables or disables verbose output.

Usage Examples

You must specify the .json fixture files, either by providing a files array or by providing a files src array within a particular target.

No target

For a simple setup, just list out your fixture files in the files property.

grunt.initConfig({
  couch_data: {
    options: {
      dbHost: 'http://localhost:5984/',
    },
    files: [ 'fixtures/*.json' ]
  }
});

Target-specific setup

You can have different fixtures loaded based on your target.

grunt.initConfig({
  couch_data: {
    options: {
      dbHost: 'http://localhost:5984/',
    },
    dev: {
      src: [ 'fixtures/dev/*.json' ]
    },
    prod: {
      src: [ 'fixtures/prod/*.json' ]
    }
  }
});

Notes

This currently only works without authentication, so your sever must be in Admin Party mode. This will be changed in a later release to allow for authentication.

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.

Release History

(Nothing yet)

Package Sidebar

Install

npm i grunt-couch-data

Weekly Downloads

5

Version

0.1.3

License

none

Last publish

Collaborators

  • camman3d