Skip to content

Instantly share code, notes, and snippets.

@qubyte
Last active December 20, 2015 21:29
Show Gist options
  • Save qubyte/6197925 to your computer and use it in GitHub Desktop.
Save qubyte/6197925 to your computer and use it in GitHub Desktop.
My Gruntfile.
/**
* Mark S Everitt 2013
* Licence: MIT
*/
var jshintConfig = {
files: ['gruntfile.js', 'lib/**/*.js', 'test/**/*.js', 'index.js'],
options: {
// Just an example.
globals: {
describe: true,
it: true,
before: true,
after: true
}
}
};
var mochaTestConfig = {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
};
var copyConfig = {
hooks: {
files: {
'.git/hooks/pre-commit': 'git_hooks/pre-commit'
}
}
};
// This will become obsolete when https://github.com/gruntjs/grunt/issues/615 is
// resolved.
var chmodConfig = {
hooks: {
options: {
mode: '755'
},
src: ['.git/hooks/pre-commit']
}
};
module.exports = function (grunt) {
grunt.initConfig({
jshint: jshintConfig,
mochaTest: mochaTestConfig,
copy: copyConfig,
chmod: chmodConfig
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-chmod');
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('setupGitHooks', ['copy:hooks', 'chmod:hooks']);
grunt.registerTask('default', ['jshint', 'mochaTest']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment