-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
51 lines (40 loc) · 1.14 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
jasmine : {
src : 'models/**/*.js',
options : {
specs : 'spec/**/*.js'
}
},
jshint: {
all: [
'Gruntfile.js',
// 'src/**/*.js',
'spec/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
}
});
grunt.registerTask('install-hook', function () {
var fs = require('fs');
// my precommit hook is inside the repo as /hooks/pre-commit
// copy the hook file to the correct place in the .git directory
grunt.file.copy('hooks/pre-commit', '.git/hooks/pre-commit');
// chmod the file to readable and executable by all
fs.chmodSync('.git/hooks/pre-commit', '755');
});
grunt.task.run('install-hook');
// ### Custom tasks
grunt.registerTask('test', ['jshint', 'jasmine']);
// ### task runned when "git commit"
grunt.registerTask('precommit', ['test']);
};