forked from phase2/grunt-drupal-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
50 lines (46 loc) · 1.41 KB
/
bootstrap.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
module.exports = function(grunt) {
// Initialize global configuration variables.
var config = grunt.file.readJSON('Gruntconfig.json');
grunt.initConfig({
config: config
});
// Wrap Grunt's loadNpmTasks() function to change the current directory to
// grunt-drupal-tasks, so that module dependencies of it are found.
grunt._loadNpmTasks = grunt.loadNpmTasks;
grunt.loadNpmTasks = function (mod) {
var pathOrig = process.cwd();
process.chdir(__dirname);
grunt._loadNpmTasks(mod);
process.chdir(pathOrig);
};
// Load all tasks from grunt-drupal-tasks.
grunt.loadTasks(__dirname + '/tasks');
// Define the default task to fully build and configure the project.
var tasksDefault = [
'validate',
'newer:drushmake:default',
'symlink:profiles',
'symlink:modules',
'symlink:themes',
'copy:defaults',
'clean:sites',
'symlink:sites',
'mkdir:files',
'copy:static'
];
if (grunt.config.get(['composer', 'install'])) {
tasksDefault.unshift('composer:install');
}
if (grunt.task.exists('bundle-install')) {
tasksDefault.unshift('bundle-install');
}
if (grunt.task.exists('compile-theme')) {
tasksDefault.push('compile-theme');
}
grunt.registerTask('default', tasksDefault);
// If the "--timer" option is given, enable time-grunt to show how long each
// task takes.
if (grunt.option('timer')) {
require('time-grunt')(grunt);
}
};