hoodie-plugin-wareplication
Version:
Hoodie plugin to centralize per user db
112 lines (97 loc) • 2.37 kB
JavaScript
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: [
'Gruntfile.js',
'hoodie.wareplication.js',
'index.js',
'hooks/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
simplemocha: {
options: {
ui: 'tdd'
},
unit: {
src: ['test/unit/*.js']
}
},
mocha_browser: {
all: {options: {urls: ['http://localhost:<%= connect.options.port %>']}}
},
shell: {
removeData: {
command: 'rm -rf ' + require('path').resolve(__dirname, 'data')
},
npmLink: {
command: 'npm link && npm link <%= pkg.name %>'
},
npmUnlink: {
command: 'npm unlink && npm unlink <%= pkg.name %>'
},
installPlugin: {
command: 'hoodie install <%= pkg.name.replace("hoodie-plugin-", "") %>'
},
removePlugin: {
command: 'hoodie uninstall <%= pkg.name.replace("hoodie-plugin-", "") %>'
}
},
hoodie: {
start: {
options: {
www: 'test/browser',
callback: function (config) {
grunt.config.set('connect.options.port', config.stack.www.port);
}
}
}
},
env: {
test: {
HOODIE_SETUP_PASSWORD: 'testing'
}
},
watch: {
jshint: {
files: ['<%= jshint.files %>'],
tasks: 'jshint'
},
unittest: {
files: 'index.js',
tasks: 'test:unit'
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-browser');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-continue');
grunt.loadNpmTasks('grunt-hoodie');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-env');
grunt.registerTask('test:unit', ['simplemocha:unit']);
grunt.registerTask('test:browser', [
'env:test',
'shell:removeData',
'shell:npmLink',
'shell:installPlugin',
'hoodie',
'continueOn',
'mocha_browser:all',
'continueOff',
'shell:npmUnlink',
'shell:removePlugin'
]);
grunt.registerTask('default', []);
grunt.registerTask('test', [
'jshint',
'test:unit',
'test:browser'
]);
};