11var deepmerge = require ( 'deepmerge' ) ;
2+
23module . exports = function ( grunt ) {
34 grunt . util . linefeed = '\n' ;
45
@@ -17,8 +18,8 @@ module.exports = function(grunt) {
1718 grunt . config . set ( 'lang_author' , content . __author ) ;
1819 var header = grunt . template . process ( '<%= langBanner %>' ) ;
1920
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' ;
2223
2324 if ( grunt . file . exists ( plugin_file ) ) {
2425 content = deepmerge ( content , grunt . file . readJSON ( plugin_file ) ) ;
@@ -36,9 +37,9 @@ module.exports = function(grunt) {
3637 }
3738
3839
39- var all_modules = { } ,
40+ var all_plugins = { } ,
4041 all_langs = { } ,
41- loaded_modules = [ ] ,
42+ loaded_plugins = [ ] ,
4243 loaded_langs = [ ] ,
4344 js_core_files = [
4445 'src/main.js' ,
@@ -59,11 +60,11 @@ module.exports = function(grunt) {
5960
6061
6162 ( function ( ) {
62- // list available modules and languages
63+ // list available plugins and languages
6364 grunt . file . expand ( 'src/plugins/*/plugin.js' )
6465 . forEach ( function ( f ) {
6566 var n = f . split ( '/' ) [ 2 ] ;
66- all_modules [ n ] = f ;
67+ all_plugins [ n ] = f ;
6768 } ) ;
6869
6970 grunt . file . expand ( 'src/i18n/*.json' )
@@ -72,23 +73,23 @@ module.exports = function(grunt) {
7273 all_langs [ n ] = f ;
7374 } ) ;
7475
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 ) ;
8283 }
8384 else {
84- grunt . fail . warn ( 'Module ' + m + ' unknown' ) ;
85+ grunt . fail . warn ( 'Plugin ' + p + ' unknown' ) ;
8586 }
8687 } ) ;
8788 }
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 ) ;
9293 }
9394 }
9495
@@ -135,7 +136,10 @@ module.exports = function(grunt) {
135136 // bump version
136137 bump : {
137138 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
139143 }
140144 } ,
141145
@@ -166,7 +170,7 @@ module.exports = function(grunt) {
166170 } ]
167171 } ,
168172 sass_plugins : {
169- files : loaded_modules . map ( function ( name ) {
173+ files : loaded_plugins . map ( function ( name ) {
170174 return {
171175 src : 'src/plugins/' + name + '/plugin.scss' ,
172176 dest : 'dist/scss/plugins/' + name + '.scss'
@@ -209,7 +213,7 @@ module.exports = function(grunt) {
209213 files : Object . keys ( all_langs ) . map ( function ( name ) {
210214 return {
211215 src : 'src/i18n/' + name + '.json' ,
212- dest : 'dist/i18n/' + name + '.js'
216+ dest : 'dist/i18n/query-builder. ' + name + '.js'
213217 } ;
214218 } ) ,
215219 options : {
@@ -258,8 +262,8 @@ module.exports = function(grunt) {
258262 wrapper : function ( ) {
259263 var wrapper = grunt . file . read ( 'src/.wrapper.js' ) . replace ( / \r \n / g, '\n' ) . split ( / @ @ j s \n / ) ;
260264
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 ] ;
263267 }
264268 if ( loaded_langs . length ) {
265269 wrapper [ 0 ] = '// Languages: ' + loaded_langs . join ( ', ' ) + '\n' + wrapper [ 0 ] ;
@@ -277,7 +281,7 @@ module.exports = function(grunt) {
277281 options : {
278282 separator : '' ,
279283 wrapper : function ( ) {
280- return [ '' , loaded_modules . reduce ( function ( wrapper , name ) {
284+ return [ '' , loaded_plugins . reduce ( function ( wrapper , name ) {
281285 if ( grunt . file . exists ( 'dist/scss/plugins/' + name + '.scss' ) ) {
282286 wrapper += '\n@import \'plugins/' + name + '\';' ;
283287 }
@@ -370,8 +374,8 @@ module.exports = function(grunt) {
370374
371375 scripts += '\n' ;
372376
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' ;
375379 }
376380
377381 return m1 + scripts + m2 ;
@@ -462,10 +466,10 @@ module.exports = function(grunt) {
462466 grunt . registerTask ( 'list_modules' , 'List QueryBuilder plugins and languages.' , function ( ) {
463467 grunt . log . writeln ( '\nAvailable QueryBuilder plugins:\n' ) ;
464468
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' ] ) ;
467471
468- if ( grunt . file . exists ( all_modules [ m ] . replace ( / j s $ / , 'scss' ) ) ) {
472+ if ( grunt . file . exists ( all_plugins [ p ] . replace ( / j s $ / , 'scss' ) ) ) {
469473 grunt . log . write ( ' + CSS' ) ;
470474 }
471475
0 commit comments