1
- // Generated on 2015-03-12 using generator-angular 0.11.1
2
1
'use strict' ;
3
2
4
3
// # Globbing
@@ -20,12 +19,15 @@ module.exports = function (grunt) {
20
19
app : require ( './bower.json' ) . appPath || 'app' ,
21
20
dist : 'dist' ,
22
21
cdnPath : 's3.amazonaws.com/abc123' ,
23
- API_URL : 'https://api.topcoder-dev.com/v3' ,
24
- API_URL_V2 : 'https://api.topcoder-dev.com/v2' ,
25
- clientId : 'JFDo7HMkf0q2CkVFHojy3zHWafziprhT' ,
26
- domain : 'topcoder-dev.com' ,
27
- auth0Domain : 'topcoder-dev.auth0.com' ,
28
- submissionDownloadPath : '/review/actions/DownloadContestSubmission?uid='
22
+ API_URL : process . env . API_URL || 'https://api.topcoder-dev.com/v3' ,
23
+ API_URL_V2 : process . env . API_URL_V2 || 'https://api.topcoder-dev.com/v2' ,
24
+ clientId : process . env . CLIENT_ID || 'JFDo7HMkf0q2CkVFHojy3zHWafziprhT' ,
25
+ domain : process . env . DOMAIN || 'topcoder-dev.com' ,
26
+ auth0Domain : process . env . AUTH0_DOMAIN || 'topcoder-dev.auth0.com' ,
27
+ auth0Callback : 'no-callback-needed-without-social-login' ,
28
+ submissionDownloadPath : '/review/actions/DownloadContestSubmission?uid=' ,
29
+ photoLinkLocation : process . env . PHOTO_LINK_LOCATION || 'http://community.topcoder.com' ,
30
+ LIME_PROGRAM_ID : 3445
29
31
} ;
30
32
31
33
// Define the configuration for all the tasks
@@ -35,26 +37,46 @@ module.exports = function (grunt) {
35
37
yeoman : appConfig ,
36
38
37
39
ngconstant : {
38
- // Options for all targets
39
40
options : {
40
41
space : ' ' ,
41
42
wrap : '"use strict";\n\n {%= __ngModule %}' ,
42
43
name : 'app.config' ,
43
44
} ,
44
- // Environment targets
45
45
development : {
46
46
options : {
47
47
dest : '<%= yeoman.app %>/app.constants.js'
48
48
} ,
49
49
constants : {
50
50
ENV : {
51
51
name : 'development' ,
52
- API_URL : process . env . API_URL || appConfig . API_URL ,
52
+ API_URL : appConfig . API_URL ,
53
53
API_URL_V2 : appConfig . API_URL_V2 ,
54
54
clientId : appConfig . clientId ,
55
55
domain : appConfig . domain ,
56
56
auth0Domain : appConfig . auth0Domain ,
57
- submissionDownloadPath : appConfig . submissionDownloadPath
57
+ auth0Callback : appConfig . auth0Callback ,
58
+ submissionDownloadPath : appConfig . submissionDownloadPath ,
59
+ photoLinkLocation : appConfig . photoLinkLocation ,
60
+ LIME_PROGRAM_ID : appConfig . LIME_PROGRAM_ID
61
+ }
62
+ }
63
+ } ,
64
+ qa : {
65
+ options : {
66
+ dest : '<%= yeoman.app %>/app.constants.js'
67
+ } ,
68
+ constants : {
69
+ ENV : {
70
+ name : 'qa' ,
71
+ API_URL : 'https://api.topcoder-qa.com/v3' ,
72
+ API_URL_V2 : 'https://api.topcoder-qa.com/v2' ,
73
+ clientId : 'EVOgWZlCtIFlbehkq02treuRRoJk12UR' ,
74
+ domain : 'topcoder-qa.com' ,
75
+ auth0Domain : 'topcoder-qa.auth0.com' ,
76
+ auth0Callback : appConfig . auth0Callback ,
77
+ submissionDownloadPath : appConfig . submissionDownloadPath ,
78
+ photoLinkLocation : appConfig . photoLinkLocation ,
79
+ LIME_PROGRAM_ID : appConfig . LIME_PROGRAM_ID
58
80
}
59
81
}
60
82
} ,
@@ -65,26 +87,25 @@ module.exports = function (grunt) {
65
87
constants : {
66
88
ENV : {
67
89
name : 'production' ,
68
- API_URL : process . env . API_URL || appConfig . API_URL ,
69
- API_URL_V2 : appConfig . API_URL_V2 ,
70
- clientId : appConfig . clientId ,
71
- domain : appConfig . domain ,
72
- auth0Domain : appConfig . auth0Domain ,
73
- submissionDownloadPath : appConfig . submissionDownloadPath
90
+ API_URL : 'https://api.topcoder.com/v3' ,
91
+ API_URL_V2 : 'https://api.topcoder.com/v2' ,
92
+ clientId : '6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P' ,
93
+ domain : 'topcoder.com' ,
94
+ auth0Domain : 'topcoder.auth0.com' ,
95
+ auth0Callback : appConfig . auth0Callback ,
96
+ submissionDownloadPath : appConfig . submissionDownloadPath ,
97
+ photoLinkLocation : appConfig . photoLinkLocation ,
98
+ LIME_PROGRAM_ID : appConfig . LIME_PROGRAM_ID
74
99
}
75
100
}
76
101
}
77
102
} ,
78
103
79
104
// Watches files for changes and runs tasks based on the changed files
80
105
watch : {
81
- bower : {
82
- files : [ 'bower.json' ] ,
83
- tasks : [ 'wiredep' ]
84
- } ,
85
106
jade : {
86
107
files : [ '<%= yeoman.app %>/**/*.jade' ] ,
87
- tasks : [ 'newer:jade:compile' ]
108
+ tasks : [ 'newer:jade:compile' , 'jade:index' ]
88
109
} ,
89
110
coffee : {
90
111
files : [ '<%= yeoman.app %>/**/*.coffee' ] ,
@@ -95,7 +116,7 @@ module.exports = function (grunt) {
95
116
tasks : [ 'newer:coffee:test' , 'karma:unit' ]
96
117
} ,
97
118
sass : {
98
- files : [ '<%= yeoman.app %>/content/css/*.scss' ] ,
119
+ files : [ '<%= yeoman.app %>/content/css/**/* .scss' ] ,
99
120
tasks : [ 'sass' ]
100
121
} ,
101
122
gruntfile : {
@@ -116,7 +137,7 @@ module.exports = function (grunt) {
116
137
// The actual grunt server settings
117
138
connect : {
118
139
options : {
119
- port : 9001 ,
140
+ port : 9002 ,
120
141
// Change this to '0.0.0.0' to access the server from outside.
121
142
hostname : 'localhost' ,
122
143
livereload : 35730
@@ -142,7 +163,7 @@ module.exports = function (grunt) {
142
163
} ,
143
164
test : {
144
165
options : {
145
- port : 9001 ,
166
+ port : 9002 ,
146
167
middleware : function ( connect ) {
147
168
return [
148
169
connect . static ( '.tmp' ) ,
@@ -194,6 +215,23 @@ module.exports = function (grunt) {
194
215
ext : '.html'
195
216
}
196
217
]
218
+ } ,
219
+ index : {
220
+ options : {
221
+ pretty : true ,
222
+ data : {
223
+ debug : false
224
+ }
225
+ } ,
226
+ files : [
227
+ {
228
+ expand : true ,
229
+ cwd : '<%= yeoman.app %>' ,
230
+ src : 'index.jade' ,
231
+ dest : '.tmp' ,
232
+ ext : '.html'
233
+ }
234
+ ]
197
235
}
198
236
} ,
199
237
@@ -234,6 +272,34 @@ module.exports = function (grunt) {
234
272
}
235
273
} ,
236
274
275
+ coffeelint : {
276
+ app : {
277
+ files : {
278
+ src : [ '<%= yeoman.app %>/**/*.coffee' ]
279
+ } ,
280
+ options : {
281
+ 'max_line_length' : {
282
+ 'level' : 'ignore'
283
+ } ,
284
+ 'no_interpolation_in_single_quotes' : {
285
+ 'level' : 'error'
286
+ } ,
287
+ 'no_unnecessary_double_quotes' : {
288
+ 'level' : 'error'
289
+ } ,
290
+ 'prefer_english_operator' : {
291
+ 'level' : 'warn'
292
+ } ,
293
+ 'space_operators' : {
294
+ 'level' : 'error'
295
+ } ,
296
+ 'spacing_after_comma' : {
297
+ 'level' : 'error'
298
+ }
299
+ }
300
+ }
301
+ } ,
302
+
237
303
// Empties folders to start fresh
238
304
clean : {
239
305
dist : {
@@ -276,21 +342,6 @@ module.exports = function (grunt) {
276
342
}
277
343
} ,
278
344
279
- // Automatically inject Bower components into the app
280
- wiredep : {
281
- options : {
282
- cwd : ''
283
- } ,
284
- app : {
285
- src : [ '.tmp/index.html' ] ,
286
- ignorePath : / \. \. \/ /
287
- } ,
288
- sass : {
289
- src : [ '<%= yeoman.app %>/content/css/{,*/}*.{scss,sass}' ] ,
290
- ignorePath : / ( \. \. \/ ) { 1 , 2 } b o w e r _ c o m p o n e n t s \/ /
291
- }
292
- } ,
293
-
294
345
sass : {
295
346
options : {
296
347
sourceMap : true ,
@@ -352,8 +403,7 @@ module.exports = function (grunt) {
352
403
flow : {
353
404
html : {
354
405
steps : {
355
- // js: ['concat', 'uglifyjs'],
356
- js : [ 'concat' ] ,
406
+ js : [ 'concat' , 'uglifyjs' ] ,
357
407
css : [ 'cssmin' ]
358
408
} ,
359
409
post : { }
@@ -370,14 +420,19 @@ module.exports = function (grunt) {
370
420
options : {
371
421
assetsDirs : [
372
422
'<%= yeoman.dist %>' ,
423
+ '<%= yeoman.dist %>/challenges' ,
424
+ '<%= yeoman.dist %>/confirmNewsletter' ,
373
425
'<%= yeoman.dist %>/content/css' ,
374
- '<%= yeoman.dist %>/edit-review/' ,
375
- '<%= yeoman.dist %>/review-status/' ,
376
- '<%= yeoman.dist %>/completed-review/'
426
+ '<%= yeoman.dist %>/content/images' ,
427
+ '<%= yeoman.dist %>/landing' ,
428
+ '<%= yeoman.dist %>/learn' ,
429
+ '<%= yeoman.dist %>/login' ,
430
+ '<%= yeoman.dist %>/register'
377
431
] ,
378
432
patterns : {
379
433
js : [
380
- [ / ( \/ [ - \w ] + \. h t m l ) / gm, 'Update JS files to reference revved html files.' ]
434
+ [ / ( \/ [ - \w ] + \. h t m l ) / gm, 'Update JS files to reference revved html files.' ] ,
435
+ [ / ( \/ [ - \w ] + \. p n g ) / gm, 'Update image files to reference revved html files.' ]
381
436
// [/(locales\/\w+\.json)/gm, 'Update JS files to reference revved locale files.']
382
437
]
383
438
}
@@ -434,16 +489,17 @@ module.exports = function (grunt) {
434
489
cwd : '<%= yeoman.app %>' ,
435
490
dest : '<%= yeoman.dist %>' ,
436
491
src : [
437
- // 'content/images/**/*',
438
492
'content/fonts/**/*' ,
439
- 'content/locales/**/*'
493
+ 'content/locales/**/*' ,
494
+ 'content/data/**/*'
440
495
]
441
496
} , {
442
497
expand : true ,
498
+ flatten : true ,
443
499
cwd : '<%= yeoman.app %>' ,
444
500
dest : '<%= yeoman.dist %>' ,
445
501
src : [
446
- 'content/images/favicon.ico '
502
+ 'content/icons/**/* '
447
503
]
448
504
} , {
449
505
expand : true ,
@@ -468,6 +524,12 @@ module.exports = function (grunt) {
468
524
cwd : '<%= yeoman.app %>/content/images' ,
469
525
dest : '.tmp/content/images/' ,
470
526
src : [ '*.png' , '*.ico' , '*.gif' ]
527
+ } ,
528
+ scripts : {
529
+ expand : true ,
530
+ cwd : '<%= yeoman.app %>/content/scripts' ,
531
+ dest : '.tmp/content/scripts/' ,
532
+ src : '{,*/}*.js'
471
533
}
472
534
} ,
473
535
@@ -477,12 +539,13 @@ module.exports = function (grunt) {
477
539
'sass' ,
478
540
'coffee:dist' ,
479
541
'jade:compile' ,
480
- 'copy:images'
542
+ 'copy:images' ,
543
+ 'copy:scripts'
481
544
] ,
482
545
test : [
483
546
'coffee' ,
484
547
'sass' ,
485
- 'jade' ,
548
+ 'jade:compile ' ,
486
549
] ,
487
550
dist : [
488
551
'coffee' ,
@@ -508,16 +571,20 @@ module.exports = function (grunt) {
508
571
509
572
510
573
grunt . registerTask ( 'serve' , 'Compile then start a connect web server' , function ( target ) {
511
- if ( target === 'dist ' ) {
574
+ if ( target === 'prod ' ) {
512
575
return grunt . task . run ( [ 'build' , 'connect:dist:keepalive' ] ) ;
576
+ } else if ( target === 'qa' ) {
577
+ return grunt . task . run ( [ 'build-qa' , 'connect:dist:keepalive' ] ) ;
578
+ } else if ( target === 'dev' ) {
579
+ return grunt . task . run ( [ 'build-dev' , 'connect:dist:keepalive' ] ) ;
513
580
}
514
581
515
582
grunt . task . run ( [
583
+ 'coffeelint:app' ,
516
584
'clean:server' ,
517
585
'ngconstant:development' ,
518
586
'js2coffee' ,
519
587
'clean:constants' ,
520
- 'wiredep' ,
521
588
'concurrent:server' ,
522
589
'autoprefixer:server' ,
523
590
'connect:livereload' ,
@@ -538,20 +605,17 @@ module.exports = function (grunt) {
538
605
'karma:unit'
539
606
] ) ;
540
607
541
- grunt . registerTask ( 'build' , [
542
- 'clean:dist' ,
543
- 'ngconstant:production' ,
608
+ grunt . registerTask ( 'build-release' , [
544
609
'js2coffee' ,
545
610
'clean:constants' ,
546
611
'concurrent:dist' ,
547
- 'wiredep' ,
548
612
'useminPrepare' ,
549
613
'autoprefixer' ,
550
614
'concat:generated' ,
551
615
'copy:dist' ,
552
616
'cssmin:generated' ,
553
- // 'uglify:generated',
554
- // 'filerev',
617
+ 'uglify:generated' ,
618
+ 'filerev' ,
555
619
'usemin' ,
556
620
'htmlmin'
557
621
// 'string-replace:cdnify'
@@ -562,4 +626,25 @@ module.exports = function (grunt) {
562
626
'test' ,
563
627
'build'
564
628
] ) ;
629
+
630
+ grunt . registerTask ( 'build-dev' , [
631
+ 'coffeelint:app' ,
632
+ 'clean:dist' ,
633
+ 'ngconstant:development' ,
634
+ 'build-release'
635
+ ] ) ;
636
+
637
+ grunt . registerTask ( 'build-qa' , [
638
+ 'coffeelint:app' ,
639
+ 'clean:dist' ,
640
+ 'ngconstant:qa' ,
641
+ 'build-release'
642
+ ] ) ;
643
+
644
+ grunt . registerTask ( 'build' , [
645
+ 'coffeelint:app' ,
646
+ 'clean:dist' ,
647
+ 'ngconstant:production' ,
648
+ 'build-release'
649
+ ] ) ;
565
650
} ;
0 commit comments