2012-08-10 01:34:00 +00:00
|
|
|
# grunt-couchapp
|
|
|
|
|
|
|
|
A grunt plugin for building and installing couchapps
|
|
|
|
|
2012-08-10 01:46:13 +00:00
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
Install this grunt plugin next to your project's
|
2012-08-10 01:34:00 +00:00
|
|
|
[grunt.js gruntfile][getting_started] with: `npm install
|
|
|
|
grunt-couchapp`
|
|
|
|
|
|
|
|
Then add this line to your project's `grunt.js` gruntfile:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
grunt.loadNpmTasks('grunt-couchapp');
|
|
|
|
```
|
|
|
|
|
|
|
|
[grunt]: https://github.com/cowboy/grunt
|
|
|
|
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
|
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
|
|
You'll want to add some configuration for the plug-in. This plugin
|
2012-08-10 01:51:11 +00:00
|
|
|
provides three tasks, `mkcouchdb` to create new databases, `rmcouchdb`
|
|
|
|
to delete all data and drop an existing database, and `couchapp`,
|
2012-08-10 01:34:00 +00:00
|
|
|
which installs a specified couchapp into the database.
|
|
|
|
|
|
|
|
mkcouchdb: {
|
|
|
|
demo: {
|
|
|
|
db: 'http://localhost:5984/grunt-couchapp-demo'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
rmcouchdb: {
|
|
|
|
demo: {
|
|
|
|
db: 'http://localhost:5984/grunt-couchapp-demo',
|
|
|
|
options: {
|
|
|
|
okay_if_missing: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
couchapp: {
|
|
|
|
demo: {
|
|
|
|
db: 'http://localhost:5984/grunt-couchapp-demo',
|
|
|
|
app: './demo/app.js'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
As a stylistic note, all of the commands take the same info, so it's
|
|
|
|
possible to write in your configuration file:
|
|
|
|
|
|
|
|
couch_config = {
|
|
|
|
demo: {
|
|
|
|
db: 'http://localhost:5984/grunt-couchapp-demo',
|
|
|
|
app: './demo/app.js',
|
|
|
|
options: {
|
|
|
|
okay_if_missing: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
...
|
|
|
|
mkcouchdb: couch_config,
|
|
|
|
rmcouchdb: couch_config,
|
|
|
|
couchapp: couch_config,
|
|
|
|
...
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Note, however, that if you call 'rmcouchdb' without a sub-argument, in
|
|
|
|
keeping with grunt's standards, it will drop *all* of your databases!
|
|
|
|
|
2012-08-10 01:51:11 +00:00
|
|
|
## Demo
|
|
|
|
|
|
|
|
It is possible to run the entire toolchain (drop, initialize, and
|
|
|
|
install) with the grunt.js file by calling `grunt demo`. As long as
|
|
|
|
you have a local couchdb running in admin-party mode, and browse to
|
|
|
|
`http://localhost:5984/grunt-couchapp-demo/_design/app/index.html`
|
|
|
|
You should get back a happy message.
|
|
|
|
|
2012-08-10 01:34:00 +00:00
|
|
|
## 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][grunt].
|
|
|
|
|
|
|
|
## License
|
|
|
|
Copyright (c) 2012 Ken Elf Mathieu Sternberg
|
|
|
|
Licensed under the MIT license.
|