Skip to content

Commit

Permalink
next version is 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed May 6, 2015
1 parent 8918ff0 commit e764efe
Show file tree
Hide file tree
Showing 30 changed files with 851 additions and 473 deletions.
62 changes: 33 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var deepmerge = require('deepmerge');

module.exports = function(grunt) {
grunt.util.linefeed = '\n';

Expand All @@ -17,8 +18,8 @@ module.exports = function(grunt) {
grunt.config.set('lang_author', content.__author);
var header = grunt.template.process('<%= langBanner %>');

loaded_modules.forEach(function(m) {
var plugin_file = 'src/plugins/'+ m +'/i18n/'+ lang +'.json';
loaded_plugins.forEach(function(p) {
var plugin_file = 'src/plugins/'+ p +'/i18n/'+ lang +'.json';

if (grunt.file.exists(plugin_file)) {
content = deepmerge(content, grunt.file.readJSON(plugin_file));
Expand All @@ -36,9 +37,9 @@ module.exports = function(grunt) {
}


var all_modules = {},
var all_plugins = {},
all_langs = {},
loaded_modules = [],
loaded_plugins = [],
loaded_langs = [],
js_core_files = [
'src/main.js',
Expand All @@ -59,11 +60,11 @@ module.exports = function(grunt) {


(function(){
// list available modules and languages
// list available plugins and languages
grunt.file.expand('src/plugins/*/plugin.js')
.forEach(function(f) {
var n = f.split('/')[2];
all_modules[n] = f;
all_plugins[n] = f;
});

grunt.file.expand('src/i18n/*.json')
Expand All @@ -72,23 +73,23 @@ module.exports = function(grunt) {
all_langs[n] = f;
});

// parse 'modules' parameter
var arg_modules = grunt.option('modules');
if (typeof arg_modules === 'string') {
arg_modules.replace(/ /g, '').split(',').forEach(function(m) {
if (all_modules[m]) {
js_files_to_load.push(all_modules[m]);
loaded_modules.push(m);
// parse 'plugins' parameter
var arg_plugins = grunt.option('plugins');
if (typeof arg_plugins === 'string') {
arg_plugins.replace(/ /g, '').split(',').forEach(function(p) {
if (all_plugins[p]) {
js_files_to_load.push(all_plugins[p]);
loaded_plugins.push(p);
}
else {
grunt.fail.warn('Module '+ m +' unknown');
grunt.fail.warn('Plugin '+ p +' unknown');
}
});
}
else if (arg_modules === undefined) {
for (var m in all_modules) {
js_files_to_load.push(all_modules[m]);
loaded_modules.push(m);
else if (arg_plugins === undefined) {
for (var p in all_plugins) {
js_files_to_load.push(all_plugins[p]);
loaded_plugins.push(p);
}
}

Expand Down Expand Up @@ -135,7 +136,10 @@ module.exports = function(grunt) {
// bump version
bump: {
options: {
files: ['package.json', 'bower.json', 'composer.json']
files: ['package.json', 'bower.json', 'composer.json'],
createTag: false,
commit: false,
push: false
}
},

Expand Down Expand Up @@ -166,7 +170,7 @@ module.exports = function(grunt) {
}]
},
sass_plugins: {
files: loaded_modules.map(function(name) {
files: loaded_plugins.map(function(name) {
return {
src: 'src/plugins/'+ name +'/plugin.scss',
dest: 'dist/scss/plugins/' + name + '.scss'
Expand Down Expand Up @@ -209,7 +213,7 @@ module.exports = function(grunt) {
files: Object.keys(all_langs).map(function(name) {
return {
src: 'src/i18n/'+ name +'.json',
dest: 'dist/i18n/' + name + '.js'
dest: 'dist/i18n/query-builder.' + name + '.js'
};
}),
options: {
Expand Down Expand Up @@ -258,8 +262,8 @@ module.exports = function(grunt) {
wrapper: function() {
var wrapper = grunt.file.read('src/.wrapper.js').replace(/\r\n/g, '\n').split(/@@js\n/);

if (loaded_modules.length) {
wrapper[0] = '// Modules: ' + loaded_modules.join(', ') + '\n' + wrapper[0];
if (loaded_plugins.length) {
wrapper[0] = '// Plugins: ' + loaded_plugins.join(', ') + '\n' + wrapper[0];
}
if (loaded_langs.length) {
wrapper[0] = '// Languages: ' + loaded_langs.join(', ') + '\n' + wrapper[0];
Expand All @@ -277,7 +281,7 @@ module.exports = function(grunt) {
options: {
separator: '',
wrapper: function() {
return ['', loaded_modules.reduce(function(wrapper, name) {
return ['', loaded_plugins.reduce(function(wrapper, name) {
if (grunt.file.exists('dist/scss/plugins/' + name + '.scss')) {
wrapper+= '\n@import \'plugins/' + name + '\';';
}
Expand Down Expand Up @@ -370,8 +374,8 @@ module.exports = function(grunt) {

scripts+= '\n';

for (var m in all_modules) {
scripts+= '<script src="../' + all_modules[m] + '" data-cover></script>\n';
for (var p in all_plugins) {
scripts+= '<script src="../' + all_plugins[p] + '" data-cover></script>\n';
}

return m1 + scripts + m2;
Expand Down Expand Up @@ -462,10 +466,10 @@ module.exports = function(grunt) {
grunt.registerTask('list_modules', 'List QueryBuilder plugins and languages.', function() {
grunt.log.writeln('\nAvailable QueryBuilder plugins:\n');

for (var m in all_modules) {
grunt.log.write(m['cyan']);
for (var p in all_plugins) {
grunt.log.write(p['cyan']);

if (grunt.file.exists(all_modules[m].replace(/js$/, 'scss'))) {
if (grunt.file.exists(all_plugins[p].replace(/js$/, 'scss'))) {
grunt.log.write(' + CSS');
}

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ Install Node and Bower dependencies `npm install & bower install` then run `grun

#### Options

You can choose which plugins to include with `--modules` :
You can choose which plugins to include with `--plugins` :
```bash
# include "sql-support" plugin
grunt --modules=sql-support
grunt --plugins=sql-support

# disable all modules
grunt --modules=false
# disable all plugins
grunt --plugins=false
```
All plugins are included by default.

You can also include ONE language with `--lang` :
You can also include language files with `--languages` :
```bash
# include French translation
grunt --lang=fr
# include French & Italian translation
grunt --languages=fr,it
```

#### Other commands
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jQuery-QueryBuilder",
"version": "2.0.1",
"version": "2.1.0",
"authors": [{
"name": "Damien \"Mistic\" Sorel",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mistic100/jquery-querybuilder",
"version": "2.0.1",
"version": "2.1.0",
"authors": [{
"name": "Damien \"Mistic\" Sorel",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion dist/css/query-builder.dark.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery QueryBuilder 2.0.1
* jQuery QueryBuilder 2.1.0
* Copyright 2014-2015 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/css/query-builder.dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/query-builder.default.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery QueryBuilder 2.0.1
* jQuery QueryBuilder 2.1.0
* Copyright 2014-2015 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/css/query-builder.default.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 0 additions & 57 deletions dist/i18n/es.js

This file was deleted.

26 changes: 22 additions & 4 deletions dist/i18n/da.js → dist/i18n/query-builder.da.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
/*!
* jQuery QueryBuilder 2.0.1
* Oversat af Jna Borup Coyle, [email protected]
* jQuery QueryBuilder 2.1.0
* Locale: Danish (da)
* Author: Jna Borup Coyle, [email protected]
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/

jQuery.fn.queryBuilder.defaults({ lang: {
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery', 'query-builder'], factory);
}
else {
factory(root.jQuery);
}
}(this, function($) {
"use strict";

var QueryBuilder = $.fn.queryBuilder;

QueryBuilder.regional['da'] = {
"__locale": "Danish (da)",
"__author": "Jna Borup Coyle, [email protected]",
"add_rule": "Tilføj regel",
"add_group": "Tilføj gruppe",
"delete_rule": "Slet regel",
Expand Down Expand Up @@ -35,4 +50,7 @@ jQuery.fn.queryBuilder.defaults({ lang: {
"is_null": "er null",
"is_not_null": "er ikke null"
}
}});
};

QueryBuilder.defaults({ lang_code: 'da' });
}));
26 changes: 22 additions & 4 deletions dist/i18n/de.js → dist/i18n/query-builder.de.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
/*!
* jQuery QueryBuilder 2.0.1
* German translation by "raimu"
* jQuery QueryBuilder 2.1.0
* Locale: German (de)
* Author: "raimu"
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/

jQuery.fn.queryBuilder.defaults({ lang: {
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery', 'query-builder'], factory);
}
else {
factory(root.jQuery);
}
}(this, function($) {
"use strict";

var QueryBuilder = $.fn.queryBuilder;

QueryBuilder.regional['de'] = {
"__locale": "German (de)",
"__author": "\"raimu\"",
"add_rule": "neue Regel",
"add_group": "neue Gruppe",
"delete_rule": "löschen",
Expand Down Expand Up @@ -53,4 +68,7 @@ jQuery.fn.queryBuilder.defaults({ lang: {
"datetime_exceed_min": "Muss nach dem {0} sein",
"datetime_exceed_max": "Muss vor dem {0} sein"
}
}});
};

QueryBuilder.defaults({ lang_code: 'de' });
}));
Loading

0 comments on commit e764efe

Please sign in to comment.