-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
153 lines (134 loc) · 6.06 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
(function () {
'use strict';
module.exports = function (grunt) {
// load tasks
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
var fileLists = getFileLists(),
allProdFiles = fileLists.vendorMinFiles.concat(fileLists.appProdFiles);
console.log('Production app files (incl. vendor): ' + allProdFiles.length);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
exec: {
mongod_local: 'mongod --dbpath C:\\mongodata'
},
jshint: {
all: fileLists.serverFiles.concat(fileLists.appFilesWithTests)
},
jasmine: {
'angular-tests': {
src: fileLists.vendorDebugFiles.concat(fileLists.appFilesWithTests)
}
},
clean: {
'public/brewkeeper.min.js': [
'public/application.js',
'public/application-debug.js',
'public/application-debug.min.js',
'public/brewkeeper.min.js',
]
},
uglify: {
all: {
files: {
'public/brewkeeper.min.js': [
fileLists.appProdFiles
]
}
}
},
concat: {
dist: {
src: fileLists.vendorMinFiles.concat(['public/brewkeeper.min.js']),
dest: 'public/application.js',
},
debug: {
src: fileLists.vendorDebugFiles.concat(fileLists.appProdFiles),
dest: 'public/application-debug.js',
}
},
});
grunt.registerTask('test', ['jshint', 'jasmine']);
grunt.registerTask('mongod', 'exec');
grunt.registerTask('build', ['clean', 'uglify', 'concat']);
grunt.registerTask('default', function () {
grunt.log.write('So vast!').ok();
});
};
function getFileLists() {
return {
appFilesWithTests: [
'public/app/app.js',
'public/app/account/controllers/*.js',
'public/app/account/services/*.js',
'public/app/brew/controllers/*.js',
'public/app/brew/services/*.js',
'public/app/common/controllers/*.js',
'public/app/common/services/*.js',
'public/app/main/controllers/*.js',
'public/app/recipe/services/*.js',
'public/app/recipe/controllers/*.js'
],
vendorDebugFiles: [
'public/vendor/jquery/dist/jquery.js',
'public/vendor/angular/angular.js',
'public/vendor/angular-resource/angular-resource.js',
'public/vendor/angular-route/angular-route.js',
'public/vendor/angular-mocks/angular-mocks.js',
'public/vendor/bootstrap/dist/js/bootstrap.js',
'public/vendor/datepicker/js/bootstrap-datepicker.js',
'public/vendor/toastr/toastr.js'
],
vendorMinFiles: [
'public/vendor/jquery/dist/jquery.min.js',
'public/vendor/angular/angular.min.js',
'public/vendor/angular-resource/angular-resource.min.js',
'public/vendor/angular-route/angular-route.min.js',
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
'public/vendor/datepicker/js/bootstrap-datepicker.js',
'public/vendor/toastr/toastr.min.js'
],
serverFiles: [
'server.js',
'server/controllers/*.js',
'server/config/*.js',
'server/models/*.js',
'server/utilities/*.js'
],
appProdFiles: [
'public/app/app.js',
'public/app/account/controllers/EditProfileCtrl.js',
'public/app/account/controllers/SignupCtrl.js',
'public/app/account/controllers/ViewProfileCtrl.js',
'public/app/account/services/Auth.js',
'public/app/account/services/Identity.js',
'public/app/account/services/User.js',
'public/app/brew/controllers/AddBrewCtrl.js',
'public/app/brew/controllers/BaseAddEditBrewCtrl.js',
'public/app/brew/controllers/BrewListCtrl.js',
'public/app/brew/controllers/DeleteBrewCtrl.js',
'public/app/brew/controllers/EditBrewCtrl.js',
'public/app/brew/controllers/ViewBrewCtrl.js',
'public/app/brew/services/Brew.js',
'public/app/brew/services/BrewStatus.js',
'public/app/common/controllers/BaseCtrl.js',
'public/app/common/services/BrewKeeperApi.js',
'public/app/common/services/DatePicker.js',
'public/app/common/services/Notifier.js',
'public/app/main/controllers/MainCtrl.js',
'public/app/main/controllers/NavBarLoginCtrl.js',
'public/app/main/controllers/UserHomeCtrl.js',
'public/app/recipe/controllers/AddRecipeCtrl.js',
'public/app/recipe/controllers/DeleteRecipeCtrl.js',
'public/app/recipe/controllers/EditRecipeCtrl.js',
'public/app/recipe/controllers/RecipeListCtrl.js',
'public/app/recipe/controllers/ViewRecipeCtrl.js',
'public/app/recipe/services/Recipe.js'
],
}
}
})();