-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
122 lines (102 loc) · 3.71 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
module.exports = function(grunt) {
'use strict';
var path = require('path'),
_ =require('underscore');
var settings = grunt.file.readJSON('settings.json'),
c6Settings = (function(settings) {
function loadGlobalConfig(relPath) {
var configPath = path.join(process.env.HOME, relPath),
configExists = grunt.file.exists(configPath);
return configExists ? grunt.file.readJSON(configPath) : {};
}
_.extend(this, settings);
this.openBrowser = process.env.GRUNT_BROWSER;
this.saucelabs = loadGlobalConfig(settings.saucelabsJSON);
this.browserstack = loadGlobalConfig(settings.browserstackJSON);
this.aws = loadGlobalConfig(settings.awsJSON);
return this;
}.call({}, settings));
require('load-grunt-config')(grunt, {
configPath: path.join(__dirname, 'tasks/options'),
config: {
settings: c6Settings
}
});
grunt.loadTasks('tasks');
/*********************************************************************************************
*
* SERVER TASKS
*
*********************************************************************************************/
grunt.registerTask('server', 'start a development server', [
'configureProxies:dev',
'connect:dev',
'open:server',
'ngtemplates:test',
'karma:debug',
'watch'
]);
/*********************************************************************************************
*
* TEST TASKS
*
*********************************************************************************************/
grunt.registerTask('test:unit', 'run unit tests', [
'jshint:all',
'clean:build',
'ngtemplates:test',
'karma:unit'
]);
grunt.registerTask('test:unit:debug', 'run unit tests whenever files change', [
'jshint:all',
'clean:build',
'ngtemplates:test',
'karma:debug',
'watch:unit'
]);
grunt.registerTask('test:e2e', 'run e2e tests on specified browser', [
'connect:dev',
'updatewebdriver',
'protractor:chrome:local'
]);
/*********************************************************************************************
*
* BUILD TASKS
*
*********************************************************************************************/
grunt.registerTask('build', 'build app into distDir', function(){
if (!grunt.option('skip-tests')){
grunt.task.run('test:unit');
}
if (grunt.option('any')){
grunt.task.run('git_describe_tags:any');
} else {
grunt.task.run('git_describe_tags');
}
grunt.task.run('clean:build');
grunt.task.run('copy:dist');
grunt.task.run('ngtemplates:dist');
grunt.task.run('htmlmin:dist');
grunt.task.run('requirejs:dist');
grunt.task.run('replace:dist');
});
/*********************************************************************************************
*
* UPLOAD TASKS
*
*********************************************************************************************/
grunt.registerTask('publish', 'build and upload the application to s3', function(target) {
grunt.task.run('build');
grunt.task.run('s3:' + target);
});
// grunt.registerTask('build', 'build app into distDir', [
// 'test:unit',
// 'git_describe_tags:any',
// 'clean:build',
// 'copy:dist',
// 'ngtemplates:dist',
// 'htmlmin:dist',
// 'requirejs:dist',
// 'replace:dist'
// ]);
};