1
1
var deepmerge = require ( 'deepmerge' ) ;
2
+
2
3
module . exports = function ( grunt ) {
3
4
grunt . util . linefeed = '\n' ;
4
5
@@ -17,8 +18,8 @@ module.exports = function(grunt) {
17
18
grunt . config . set ( 'lang_author' , content . __author ) ;
18
19
var header = grunt . template . process ( '<%= langBanner %>' ) ;
19
20
20
- loaded_modules . forEach ( function ( m ) {
21
- var plugin_file = 'src/plugins/' + m + '/i18n/' + lang + '.json' ;
21
+ loaded_plugins . forEach ( function ( p ) {
22
+ var plugin_file = 'src/plugins/' + p + '/i18n/' + lang + '.json' ;
22
23
23
24
if ( grunt . file . exists ( plugin_file ) ) {
24
25
content = deepmerge ( content , grunt . file . readJSON ( plugin_file ) ) ;
@@ -36,9 +37,9 @@ module.exports = function(grunt) {
36
37
}
37
38
38
39
39
- var all_modules = { } ,
40
+ var all_plugins = { } ,
40
41
all_langs = { } ,
41
- loaded_modules = [ ] ,
42
+ loaded_plugins = [ ] ,
42
43
loaded_langs = [ ] ,
43
44
js_core_files = [
44
45
'src/main.js' ,
@@ -59,11 +60,11 @@ module.exports = function(grunt) {
59
60
60
61
61
62
( function ( ) {
62
- // list available modules and languages
63
+ // list available plugins and languages
63
64
grunt . file . expand ( 'src/plugins/*/plugin.js' )
64
65
. forEach ( function ( f ) {
65
66
var n = f . split ( '/' ) [ 2 ] ;
66
- all_modules [ n ] = f ;
67
+ all_plugins [ n ] = f ;
67
68
} ) ;
68
69
69
70
grunt . file . expand ( 'src/i18n/*.json' )
@@ -72,23 +73,23 @@ module.exports = function(grunt) {
72
73
all_langs [ n ] = f ;
73
74
} ) ;
74
75
75
- // parse 'modules ' parameter
76
- var arg_modules = grunt . option ( 'modules ' ) ;
77
- if ( typeof arg_modules === 'string' ) {
78
- arg_modules . replace ( / / g, '' ) . split ( ',' ) . forEach ( function ( m ) {
79
- if ( all_modules [ m ] ) {
80
- js_files_to_load . push ( all_modules [ m ] ) ;
81
- loaded_modules . push ( m ) ;
76
+ // parse 'plugins ' parameter
77
+ var arg_plugins = grunt . option ( 'plugins ' ) ;
78
+ if ( typeof arg_plugins === 'string' ) {
79
+ arg_plugins . replace ( / / g, '' ) . split ( ',' ) . forEach ( function ( p ) {
80
+ if ( all_plugins [ p ] ) {
81
+ js_files_to_load . push ( all_plugins [ p ] ) ;
82
+ loaded_plugins . push ( p ) ;
82
83
}
83
84
else {
84
- grunt . fail . warn ( 'Module ' + m + ' unknown' ) ;
85
+ grunt . fail . warn ( 'Plugin ' + p + ' unknown' ) ;
85
86
}
86
87
} ) ;
87
88
}
88
- else if ( arg_modules === undefined ) {
89
- for ( var m in all_modules ) {
90
- js_files_to_load . push ( all_modules [ m ] ) ;
91
- loaded_modules . push ( m ) ;
89
+ else if ( arg_plugins === undefined ) {
90
+ for ( var p in all_plugins ) {
91
+ js_files_to_load . push ( all_plugins [ p ] ) ;
92
+ loaded_plugins . push ( p ) ;
92
93
}
93
94
}
94
95
@@ -135,7 +136,10 @@ module.exports = function(grunt) {
135
136
// bump version
136
137
bump : {
137
138
options : {
138
- files : [ 'package.json' , 'bower.json' , 'composer.json' ]
139
+ files : [ 'package.json' , 'bower.json' , 'composer.json' ] ,
140
+ createTag : false ,
141
+ commit : false ,
142
+ push : false
139
143
}
140
144
} ,
141
145
@@ -166,7 +170,7 @@ module.exports = function(grunt) {
166
170
} ]
167
171
} ,
168
172
sass_plugins : {
169
- files : loaded_modules . map ( function ( name ) {
173
+ files : loaded_plugins . map ( function ( name ) {
170
174
return {
171
175
src : 'src/plugins/' + name + '/plugin.scss' ,
172
176
dest : 'dist/scss/plugins/' + name + '.scss'
@@ -209,7 +213,7 @@ module.exports = function(grunt) {
209
213
files : Object . keys ( all_langs ) . map ( function ( name ) {
210
214
return {
211
215
src : 'src/i18n/' + name + '.json' ,
212
- dest : 'dist/i18n/' + name + '.js'
216
+ dest : 'dist/i18n/query-builder. ' + name + '.js'
213
217
} ;
214
218
} ) ,
215
219
options : {
@@ -258,8 +262,8 @@ module.exports = function(grunt) {
258
262
wrapper : function ( ) {
259
263
var wrapper = grunt . file . read ( 'src/.wrapper.js' ) . replace ( / \r \n / g, '\n' ) . split ( / @ @ j s \n / ) ;
260
264
261
- if ( loaded_modules . length ) {
262
- wrapper [ 0 ] = '// Modules : ' + loaded_modules . join ( ', ' ) + '\n' + wrapper [ 0 ] ;
265
+ if ( loaded_plugins . length ) {
266
+ wrapper [ 0 ] = '// Plugins : ' + loaded_plugins . join ( ', ' ) + '\n' + wrapper [ 0 ] ;
263
267
}
264
268
if ( loaded_langs . length ) {
265
269
wrapper [ 0 ] = '// Languages: ' + loaded_langs . join ( ', ' ) + '\n' + wrapper [ 0 ] ;
@@ -277,7 +281,7 @@ module.exports = function(grunt) {
277
281
options : {
278
282
separator : '' ,
279
283
wrapper : function ( ) {
280
- return [ '' , loaded_modules . reduce ( function ( wrapper , name ) {
284
+ return [ '' , loaded_plugins . reduce ( function ( wrapper , name ) {
281
285
if ( grunt . file . exists ( 'dist/scss/plugins/' + name + '.scss' ) ) {
282
286
wrapper += '\n@import \'plugins/' + name + '\';' ;
283
287
}
@@ -370,8 +374,8 @@ module.exports = function(grunt) {
370
374
371
375
scripts += '\n' ;
372
376
373
- for ( var m in all_modules ) {
374
- scripts += '<script src="../' + all_modules [ m ] + '" data-cover></script>\n' ;
377
+ for ( var p in all_plugins ) {
378
+ scripts += '<script src="../' + all_plugins [ p ] + '" data-cover></script>\n' ;
375
379
}
376
380
377
381
return m1 + scripts + m2 ;
@@ -462,10 +466,10 @@ module.exports = function(grunt) {
462
466
grunt . registerTask ( 'list_modules' , 'List QueryBuilder plugins and languages.' , function ( ) {
463
467
grunt . log . writeln ( '\nAvailable QueryBuilder plugins:\n' ) ;
464
468
465
- for ( var m in all_modules ) {
466
- grunt . log . write ( m [ 'cyan' ] ) ;
469
+ for ( var p in all_plugins ) {
470
+ grunt . log . write ( p [ 'cyan' ] ) ;
467
471
468
- if ( grunt . file . exists ( all_modules [ m ] . replace ( / j s $ / , 'scss' ) ) ) {
472
+ if ( grunt . file . exists ( all_plugins [ p ] . replace ( / j s $ / , 'scss' ) ) ) {
469
473
grunt . log . write ( ' + CSS' ) ;
470
474
}
471
475
0 commit comments