-
Notifications
You must be signed in to change notification settings - Fork 21
/
Gruntfile.js
358 lines (349 loc) · 17.1 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
"use strict";
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
var config = {
app: 'app',
dist: 'dist',
tasks: grunt.cli.tasks
};
grunt.initConfig({
config: config,
watch: {
js: {
files: ['<%= config.app %>/scripts/{,*/}*.js'],
tasks: ['jshint'],
options: {
livereload: true
}
},
gruntfile: {
files: ['Gruntfile.js']
},
styles: {
files: ['<%= config.app %>/styles/{,*/}*.css'],
tasks: [],
options: {
livereload: true
}
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'.tmp/styles/{,*/}*.css',
'<%= config.app %>/*.html',
'<%= config.app %>/icons/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= config.app %>/manifest.json',
'<%= config.app %>/_locales/{,*/}*.json'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: 'localhost',
open: true
},
server: {
options: {
middleware: function(connect) {
return [
connect.static('.tmp'),
connect().use('/bower_components', connect.static('./bower_components')),
connect.static(config.app)
];
}
}
},
chrome: {
options: {
open: false,
base: [
'<%= config.app %>'
]
}
},
test: {
options: {
open: false,
base: [
'test',
'<%= config.app %>'
]
}
}
},
clean: {
server: '.tmp',
chrome: '.tmp',
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= config.dist %>/*',
'!<%= config.dist %>/.git*'
]
}]
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= config.app %>/scripts/{,*/}*.js',
'<%= config.app %>/scripts/smb_client/{,*/}*.js',
'!<%= config.app %>/scripts/deps/*',
'!<%= config.app %>/scripts/vendor/*',
'test/spec/{,*/}*.js'
]
},
mocha: {
all: {
options: {
run: true,
urls: ['http://localhost:<%= connect.options.port %>/index.html']
}
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'*.{ico,png,txt}',
'icons/{,*/}*.png',
'styles/{,*/}*.*',
'_locales/{,*/}*.json',
'scripts/{,*/}*.js',
'bower_components/bootstrap/dist/{,*/}/*.*',
'bower_components/jquery/dist/{,*/}/*.js',
'window.html'
]
}]
}
},
concat: {
dist: {
src: [
'<%= config.app %>/scripts/deps/encoding.js',
'<%= config.app %>/scripts/deps/encoding-indexes.js',
'<%= config.app %>/scripts/deps/BigInteger.min.js',
'<%= config.app %>/bower_components/cryptojslib/components/core.js',
'<%= config.app %>/bower_components/cryptojslib/components/enc-utf16.js',
'<%= config.app %>/bower_components/cryptojslib/components/hmac.js',
'<%= config.app %>/bower_components/cryptojslib/components/md5.js',
'<%= config.app %>/bower_components/cryptojslib/components/evpkdf.js',
'<%= config.app %>/bower_components/cryptojslib/components/cipher-core.js',
'<%= config.app %>/bower_components/cryptojslib/components/mode-ecb.js',
'<%= config.app %>/bower_components/cryptojslib/components/tripledes.js',
'<%= config.app %>/bower_components/cryptojslib/components/pad-nopadding.js',
'<%= config.app %>/bower_components/cryptojslib/components/rc4.js',
'<%= config.app %>/scripts/deps/md4.js',
'<%= config.app %>/scripts/deps/lib-typedarrays.js',
'<%= config.app %>/scripts/smb_client/smb_client.js',
'<%= config.app %>/scripts/smb_client/models/models.js',
'<%= config.app %>/scripts/smb_client/smb1/smb1.js',
'<%= config.app %>/scripts/smb_client/smb2/smb2.js',
'<%= config.app %>/scripts/smb_client/smb1/models/models.js',
'<%= config.app %>/scripts/smb_client/smb2/models/models.js',
'<%= config.app %>/scripts/smb_client/constants.js',
'<%= config.app %>/scripts/smb_client/debug.js',
'<%= config.app %>/scripts/smb_client/binary_utils.js',
'<%= config.app %>/scripts/smb_client/types.js',
'<%= config.app %>/scripts/smb_client/session.js',
'<%= config.app %>/scripts/smb_client/auth/auth.js',
'<%= config.app %>/scripts/smb_client/auth/crc32.js',
'<%= config.app %>/scripts/smb_client/auth/hash_response_base.js',
'<%= config.app %>/scripts/smb_client/auth/lm_hash.js',
'<%= config.app %>/scripts/smb_client/auth/lm_response.js',
'<%= config.app %>/scripts/smb_client/auth/ntlm_hash.js',
'<%= config.app %>/scripts/smb_client/auth/ntlm_v2_hash.js',
'<%= config.app %>/scripts/smb_client/auth/ntlm_v2_response.js',
'<%= config.app %>/scripts/smb_client/auth/lm_v2_response.js',
'<%= config.app %>/scripts/smb_client/auth/ntlm2_session_response.js',
'<%= config.app %>/scripts/smb_client/auth/type_1_message.js',
'<%= config.app %>/scripts/smb_client/auth/type_2_message.js',
'<%= config.app %>/scripts/smb_client/auth/type_3_message.js',
'<%= config.app %>/scripts/smb_client/auth/type_message_utils.js',
'<%= config.app %>/scripts/smb_client/auth/second_key.js',
'<%= config.app %>/scripts/smb_client/auth/subkey.js',
'<%= config.app %>/scripts/smb_client/auth/signature.js',
'<%= config.app %>/scripts/smb_client/spnego/spnego.js',
'<%= config.app %>/scripts/smb_client/spnego/asn1_obj.js',
'<%= config.app %>/scripts/smb_client/smb1/models/header.js',
'<%= config.app %>/scripts/smb_client/smb2/models/header.js',
'<%= config.app %>/scripts/smb_client/smb1/models/packet_helper.js',
'<%= config.app %>/scripts/smb_client/smb2/models/packet_helper.js',
'<%= config.app %>/scripts/smb_client/models/packet.js',
'<%= config.app %>/scripts/smb_client/models/file.js',
'<%= config.app %>/scripts/smb_client/smb1/models/request_utils.js',
'<%= config.app %>/scripts/smb_client/smb1/models/response_utils.js',
'<%= config.app %>/scripts/smb_client/smb2/models/response_utils.js',
'<%= config.app %>/scripts/smb_client/smb1/models/negotiate_protocol_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/negotiate_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/negotiate_protocol_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/negotiate_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/session_setup_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/session_setup_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/session_setup_andx_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/session_setup_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/echo_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/tree_connect_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/tree_connect_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/tree_connect_andx_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/tree_connect_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/nt_create_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/create_context.js',
'<%= config.app %>/scripts/smb_client/smb2/models/create_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/nt_create_andx_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/create_response.js',
'<%= config.app %>/scripts/smb_client/dce_rpc/dce_rpc.js',
'<%= config.app %>/scripts/smb_client/dce_rpc/dcerpc_bind.js',
'<%= config.app %>/scripts/smb_client/dce_rpc/dcerpc_bind_ack.js',
'<%= config.app %>/scripts/smb_client/dce_rpc/dcerpc_net_share_enum_all_request.js',
'<%= config.app %>/scripts/smb_client/dce_rpc/dcerpc_net_share_enum_all_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/transaction_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/ioctl_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/transaction_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/ioctl_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/close_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/close_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/query_path_info_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/query_info_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/query_path_info_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/query_info_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/find_first2_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/find_first2_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/find_next2_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/find_next2_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/query_directory_info_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/query_directory_info_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/find_close2_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/seek_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/seek_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/read_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/read_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/read_andx_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/read_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/write_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/write_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/write_andx_response.js',
'<%= config.app %>/scripts/smb_client/smb2/models/write_response.js',
'<%= config.app %>/scripts/smb_client/smb1/models/create_directory_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/delete_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/delete_directory_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/rename_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/empty_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/empty_request.js',
'<%= config.app %>/scripts/smb_client/smb1/models/logoff_andx_request.js',
'<%= config.app %>/scripts/smb_client/smb2/models/file_disposition_information.js',
'<%= config.app %>/scripts/smb_client/smb2/models/file_rename_information.js',
'<%= config.app %>/scripts/smb_client/smb2/models/set_info_request.js',
'<%= config.app %>/scripts/smb_client/smb1/protocol.js',
'<%= config.app %>/scripts/smb_client/smb2/protocol.js',
'<%= config.app %>/scripts/smb_client/communication.js',
'<%= config.app %>/scripts/smb_client/chrome_socket_2.js',
'<%= config.app %>/scripts/smb_client/smb1/client_impl.js',
'<%= config.app %>/scripts/smb_client/smb2/client_impl.js',
'<%= config.app %>/scripts/smb_client/client.js',
'<%= config.app %>/scripts/task_queue.js',
'<%= config.app %>/scripts/metadata_cache.js',
'<%= config.app %>/scripts/cifs_fs.js',
'<%= config.app %>/scripts/cifs_client.js',
'<%= config.app %>/scripts/background.js'
],
dest: '<%= config.dist %>/background.js'
}
},
chromeManifest: {
dist: {
options: {
buildnumber: false,
background: {
target: 'background.js'
}
},
src: '<%= config.app %>',
dest: '<%= config.dist %>'
}
},
compress: {
dist: {
options: {
archive: function() {
var manifest = grunt.file.readJSON('app/manifest.json');
return 'package/chromeos-filesystem-cifs-' + manifest.version + '.zip';
}
},
files: [{
expand: true,
cwd: 'dist/',
src: ['**'],
dest: ''
}]
}
},
bower: {
install: {
options: {
targetDir: '<%= config.dist %>/bower_components',
verbose: true,
install: true
// cleanup: true
}
}
},
vulcanize: {
main: {
options: {
csp: true,
inline: true
},
files: {
'<%= config.dist %>/window.html': '<%= config.app %>/window.html'
}
}
}
});
grunt.registerTask('debug', function (platform) {
var watch = grunt.config('watch');
platform = platform || 'chrome';
if (platform === 'server') {
watch.styles.tasks = ['newer:copy:styles'];
watch.styles.options.livereload = false;
}
grunt.config('watch', watch);
grunt.task.run([
'clean:' + platform,
'connect:' + platform,
'watch'
]);
});
grunt.registerTask('test', [
'connect:test'
]);
grunt.registerTask('build', [
'clean:dist',
'bower:install',
'concat',
'chromeManifest:dist',
'copy',
// 'vulcanize',
'compress'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};