This repository has been archived by the owner on Jul 24, 2019. It is now read-only.
forked from davedf/mindmup
-
Notifications
You must be signed in to change notification settings - Fork 180
/
GruntFile.js
194 lines (185 loc) · 4.91 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*global module*/
/*
Installing Grunt and associated contributions
- once only per machine
install node and npm:
http://nodejs.org/download/
install grunt cli:
npm install -g grunt-cli
- per project
npm install
*/
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
watch: {
specs: {
files: ['test/*.js'],
tasks: ['jasmine'],
options: {
spawn: false
}
},
specs_full: {
files: ['test/*.js'],
tasks: ['jasmine'],
options: {
spawn: false
}
},
src: {
files: ['public/**/*.js'],
tasks: ['jasmine'],
options: {
spawn: false
}
}
},
concat: {
options: {
},
lib: {
src: ['public/mapjs-compiled.js', 'public/mm.js', 'public/lib/*.js', 'public/main.js'],
dest: 'compiled/mm-compiled.js'
},
mmios: {
src: [
'public/mapjs-compiled.js',
'public/mm.js',
'public/mm-ios.js',
'public/mapjs-compiled.js',
'public/lib/activity-log.js',
'public/lib/icon-editor-widget.js',
'public/lib/active-content-resource-manager.js',
'public/lib/active-content-listener.js',
'public/lib/atlas-prepopulate-widget.js',
'public/lib/resource-compressor.js',
'public/lib/map-controller.js',
'public/lib/auto-save.js',
'public/lib/json-storage.js',
'public/lib/gold-api.js',
'public/lib/gold-license-manager.js',
'public/lib/layout-export.js',
'public/lib/s3-api.js',
'public/lib/local-storage-clipboard.js',
'public/lib/activity-log.js'
],
dest: 'public/ios/4/mm-compiled-ios.js'
},
libios3: {
src: [
'public/ios/3/mm-compiled-ios.js',
'public/lib-ios/3/*.js',
'public/ios/3/main-ios.js'
],
dest: 'compiled/mm-ios-compiled-3.js'
},
libios4: {
src: [
'public/ios/4/mm-compiled-ios.js',
'public/lib-ios/4/*.js',
'public/ios/4/main-ios.js'
],
dest: 'compiled/mm-ios-compiled-4.js'
}
},
uglify: {
compiled: {
options: {
sourceMap: true
},
files: {
'compiled/mm-compiled.min.js': ['compiled/mm-compiled.js'],
'compiled/mm-embedded.min.js': ['compiled/mm-embedded.js'],
'compiled/mm-ios-compiled-3.min.js': ['compiled/mm-ios-compiled-3.js'],
'compiled/mm-ios-compiled-4.min.js': ['compiled/mm-ios-compiled-4.js']
}
}
},
cssmin: {
combine: {
files: {
'compiled/combined.css': ['public/mindmap.css', 'public/mapjs.css'],
'compiled/combined-ios-3.css': ['public/ios/3/mindmap-ios.css', 'public/ios/3/mapjs.css'],
'compiled/combined-ios-4.css': ['public/ios/4/*-ios.css', 'public/ios/4/mapjs.css'],
'compiled/mapjs.css': ['public/mapjs.css']
}
}
},
jscs: {
src: ['public/lib*/**/*.js', 'test/*.js', 'public/e/*.js', 'public/main*.js'],
options: {
config: '.jscsrc',
reporter: 'inline'
}
},
jshint: {
all: ['public/lib*/**/*.js', 'test/*.js', 'public/e/*.js', 'public/main*.js'],
options: {
jshintrc: true
}
},
jasmine: {
all: {
src: [
'public/lib/*.js',
'public/lib-ios/4/*.js',
'public/e/progress.js',
'public/e/github.js',
'public/e/dropbox.js',
'public/e/google-collaboration.js'
],
options: {
template: 'test-lib/grunt.tmpl',
outfile: 'SpecRunner.html',
summary: true,
display: 'short',
keepRunner: true,
specs: [
'test/*.js'
],
vendor: [
grunt.option('external-scripts') || 'http://d1g6a398qq2djm.cloudfront.net/20150106142106/external.js'
],
helpers: [
'test-lib/sinon-1.5.2.js',
'test-lib/jasmine-describe-batch.js',
'test-lib/fake-bootstrap-modal.js',
'test-lib/jasmine-tagname-match.js',
'test-lib/jquery-extension-matchers.js',
'public/mm.js',
'public/mm-ios.js',
'public/mapjs-compiled.js'
]
}
}
}
});
grunt.registerTask('checkstyle', ['jshint', 'jscs']);
grunt.registerTask('precommit', ['checkstyle', 'jasmine']);
grunt.registerTask('compile', ['jasmine', 'concat:lib', 'concat:libios3', 'concat:libios4', 'uglify', 'cssmin:combine']);
grunt.registerTask('compile-ios', ['concat:mmios', 'compile']);
// Load local tasks.
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.event.on('watch', function (action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
var options = grunt.config(['jasmine', 'all']);
if (target.indexOf('_full') > 0) {
options.options.display = 'full';
options.options.summary = false;
}
if (target.indexOf('specs') === 0) {
options.options.specs = [filepath];
} else {
options.options.specs = ['test/*.js'];
}
grunt.config(['jasmine', 'all'], options);
});
};