-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgruntfile.js
54 lines (47 loc) · 1.74 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
52
53
54
// Module : gruntfile.js
// ----------------------------
// Description : main task runner
// Copyright : (c) Nimble Chef Inc. 2015
// Maintainer : [email protected]
// Stability : experimental
// This will set up all tasks configured in the
// `grunt/configure` directory and registered in the
// `grunt/register` directory. Look mom, a gruntfile
// that's less than 50 lines!
//
'use strict';
var gruntPath = './grunt/',
gruntConfigurePath = gruntPath + 'configure/',
gruntRegisterPath = gruntPath + 'register/',
gruntTasksPath = gruntPath + 'tasks/',
fs = require( 'fs' ),
path = require( 'path' );
module.exports = function( grunt ) {
require( 'time-grunt' )( grunt );
// This will build a configuration object by reading each tasks
// config file in the `gruntConfigurePath` as the top of this file.
var configuration = fs.readdirSync( gruntConfigurePath )
.reduce( function( obj, taskFileName ) {
var fileBaseName = path.basename( taskFileName, '.js' );
obj[ fileBaseName ] = require( gruntConfigurePath + taskFileName );
return obj;
}, {} );
configuration.paths = require( gruntPath + 'paths.js' );
configuration.pkg = require( './package.json' );
grunt.initConfig( configuration );
// Load custom tasks
grunt.task.loadTasks( gruntTasksPath );
// Load tasks but filter the grunt-template-jasmine files
require( 'matchdep' )
.filterAll( 'grunt-*' )
.filter( function( task ) {
return task.indexOf( 'grunt-template-jasmine' ) === -1;
} )
.forEach( grunt.loadNpmTasks );
// Register tasks by reading all the files in the `gruntRegisterPath`
// listed at the top of this file.
fs.readdirSync( gruntRegisterPath )
.map( function( file ) {
require( gruntRegisterPath + file )( grunt );
} );
};