2015-02-13 03:10:38 +00:00
|
|
|
/*global module:false*/
|
|
|
|
module.exports = function( grunt ) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var pkg = grunt.file.readJSON( 'package.json' ),
|
|
|
|
tasks,
|
|
|
|
widgetFilePrefix,
|
|
|
|
widgetFileSuffix,
|
|
|
|
|
|
|
|
defaults = {
|
|
|
|
dependencies : {
|
|
|
|
widgets: {
|
|
|
|
'saveSort resizable pager filter columnSelector' : 'storage',
|
|
|
|
'filter-formatter-html5 filter-formatter-jui filter-formatter-select2' : 'filter'
|
|
|
|
// 'stickyHeaders' : 'addResizeEvent' // included with stickyHeaders widget (for now)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
standardWidgets: [
|
|
|
|
'storage', // req by saveSort; optional in others
|
|
|
|
'uitheme',
|
|
|
|
'columns',
|
|
|
|
'filter',
|
|
|
|
'stickyHeaders',
|
|
|
|
'resizable',
|
|
|
|
'saveSort'
|
|
|
|
// 'addResizeEvent', // included with stickyHeaders widget
|
2015-03-28 20:03:50 +00:00
|
|
|
// 'zebra' // included in core
|
|
|
|
],
|
|
|
|
standardWidgetFileName: 'jquery.tablesorter.widgets.js',
|
|
|
|
wrappers : {
|
|
|
|
widgetPrefix: 'js/widgets/widget-',
|
|
|
|
widgetSuffix: '.js',
|
|
|
|
parserPrefix: 'js/parsers/parser-',
|
|
|
|
parserSuffix: '.js'
|
|
|
|
},
|
|
|
|
wrapperUMD: {
|
|
|
|
// tablesorter core
|
|
|
|
coreBanner: '(function(factory) {\n' +
|
|
|
|
" if (typeof define === 'function' && define.amd) {\n" +
|
|
|
|
" define(['jquery'], factory);\n" +
|
|
|
|
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
|
|
|
" module.exports = factory(require('jquery'));\n" +
|
|
|
|
' } else {\n' +
|
|
|
|
' factory(jQuery);\n' +
|
|
|
|
' }\n' +
|
|
|
|
'}(function($) {\n\n',
|
|
|
|
// widgets wrapper & combined wrapper - may need a separate entry when this wrapper is redefined to make
|
|
|
|
// widgets a dependency of the core (see https://github.com/Mottie/tablesorter/issues/855)
|
|
|
|
banner: '<%= pkg.banner %>/* Includes widgets ( <%= pkg.selectedWidgets %> <%= pkg.selectedParsers %>) */\n' +
|
|
|
|
'(function(factory) {\n' +
|
|
|
|
" if (typeof define === 'function' && define.amd) {\n" +
|
|
|
|
" define(['jquery'], factory);\n" +
|
|
|
|
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
|
|
|
" module.exports = factory(require('jquery'));\n" +
|
|
|
|
' } else {\n' +
|
|
|
|
' factory(jQuery);\n' +
|
|
|
|
' }\n' +
|
|
|
|
'}(function($) {\n\n',
|
|
|
|
footer: '\nreturn $.tablesorter;\n}));\n'
|
|
|
|
},
|
|
|
|
noModBanner: '/*** This file is dynamically generated ***\n' +
|
|
|
|
'█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██\n' +
|
|
|
|
'██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██\n' +
|
|
|
|
'██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██\n' +
|
|
|
|
'█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀\n*/\n'
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
|
|
|
|
2015-03-28 20:03:50 +00:00
|
|
|
// example widgets = [ 'pager', 'column', 'filter', 'stickyHeaders' ];
|
|
|
|
addWidgetDependencies = function( widgets ) {
|
2015-02-13 03:10:38 +00:00
|
|
|
var indx, dep,
|
|
|
|
maxDeps = 40, // just in case (there are currently 27 widgets)
|
|
|
|
len = widgets.length,
|
|
|
|
deps = defaults.dependencies.widgets;
|
|
|
|
for ( dep in deps ) {
|
|
|
|
if ( typeof dep === 'string' ) {
|
|
|
|
for ( indx = 0; indx < len; indx++ ) {
|
2015-03-28 20:03:50 +00:00
|
|
|
// make sure indexOf is not matching 'column' instead of 'columnSelector' with surrounding spaces
|
|
|
|
if ( ( ' ' + dep + ' ' ).indexOf( ' ' + widgets[indx] + ' ' ) >= 0 && widgets.indexOf( deps[ dep ] ) < 0 ) {
|
|
|
|
widgets.push( deps[ dep ] );
|
|
|
|
// keep checking newly added widgets, in case 'filter' is added and 'storage' hasn't been
|
|
|
|
if ( len < maxDeps ) { len++; }
|
2015-02-13 03:10:38 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return widgets;
|
|
|
|
},
|
2015-03-28 20:03:50 +00:00
|
|
|
formFileNames = function() {
|
|
|
|
var wrap = defaults.wrappers;
|
2015-02-13 03:10:38 +00:00
|
|
|
// add widget path & file extension
|
2015-03-28 20:03:50 +00:00
|
|
|
pkg.processedWidgets = ( wrap.widgetPrefix +
|
|
|
|
pkg.selectedWidgets.join( wrap.widgetSuffix + ',' + wrap.widgetPrefix ) +
|
|
|
|
wrap.widgetSuffix ).split( ',' );
|
2015-02-13 03:10:38 +00:00
|
|
|
console.info( 'Creating a widgets file with: ' + pkg.selectedWidgets.join(', ') );
|
2015-03-28 20:03:50 +00:00
|
|
|
|
|
|
|
if ( pkg.selectedParsers ) {
|
|
|
|
// parser path & file extension
|
|
|
|
pkg.processedParsers = ( wrap.parserPrefix +
|
|
|
|
pkg.selectedParsers.join( wrap.parserSuffix + ',' + wrap.parserPrefix ) +
|
|
|
|
wrap.parserSuffix ).split( ',' );
|
|
|
|
console.info( 'Creating a combined file with selected widgets & these parsers: ' + pkg.selectedParsers.join(', ') );
|
|
|
|
// make this look nice for the banner
|
|
|
|
pkg.selectedParsers = ') & parsers ( ' + pkg.selectedParsers + ' ';
|
|
|
|
}
|
|
|
|
console.info( pkg.processedParsers );
|
2015-02-13 03:10:38 +00:00
|
|
|
};
|
|
|
|
|
2015-02-21 00:48:25 +00:00
|
|
|
// minified banner template - updated ##/##/20## (v2.##.##)
|
2015-03-28 20:03:50 +00:00
|
|
|
pkg.banner = '/*! <%= pkg.name %> (FORK) - updated ' +
|
2015-02-13 03:10:38 +00:00
|
|
|
'<%= grunt.template.today("mm-dd-yyyy") %> (v<%= pkg.version %>)*/\n';
|
|
|
|
|
2015-03-28 20:03:50 +00:00
|
|
|
pkg.buildWidget = defaults.standardWidgetFileName;
|
|
|
|
pkg.buildCombined = 'jquery.tablesorter.combined.js';
|
|
|
|
pkg.processedParsers = '!js/parsers/*.js';
|
2015-02-13 03:10:38 +00:00
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: pkg,
|
|
|
|
|
|
|
|
clean: {
|
|
|
|
build: {
|
|
|
|
src: [ 'dist/**/**/**/*', 'dist/**/**/*', 'dist/**/*', 'dist' ]
|
|
|
|
},
|
2015-02-13 04:13:45 +00:00
|
|
|
css: {
|
|
|
|
src: [ 'dist/css/*.css', '!dist/css/*.min.css' ]
|
2015-02-13 03:10:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
copy: {
|
|
|
|
css: {
|
|
|
|
files : [{
|
|
|
|
expand: true,
|
|
|
|
dot: true,
|
|
|
|
flatten: true,
|
2015-03-28 20:03:50 +00:00
|
|
|
src: [ 'css/*.css', 'addons/pager/*.css' ],
|
2015-02-20 23:57:57 +00:00
|
|
|
dest: 'dist/css/',
|
2015-03-28 20:03:50 +00:00
|
|
|
rename: function( dest, src ) {
|
|
|
|
if ( /black-ice/.test( src ) ) {
|
|
|
|
src = src.replace( /-/, '' );
|
2015-02-20 23:57:57 +00:00
|
|
|
}
|
|
|
|
return dest + src;
|
|
|
|
}
|
2015-02-13 03:10:38 +00:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
less: {
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
src: 'css/*.less',
|
|
|
|
dest: 'dist/css/less/'
|
|
|
|
},
|
|
|
|
images: {
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
src: [ 'addons/pager/icons/*', 'css/images/*' ],
|
|
|
|
dest: 'dist/css/images/'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
concat: {
|
2015-03-28 20:03:50 +00:00
|
|
|
main: {
|
|
|
|
options: {
|
|
|
|
banner: defaults.wrapperUMD.coreBanner,
|
|
|
|
footer: defaults.wrapperUMD.footer
|
|
|
|
},
|
|
|
|
src: [ 'js/jquery.tablesorter.js' ],
|
|
|
|
dest: 'dist/js/jquery.tablesorter.js'
|
|
|
|
},
|
2015-02-13 03:10:38 +00:00
|
|
|
widgets: {
|
|
|
|
options: {
|
2015-03-28 20:03:50 +00:00
|
|
|
banner: defaults.wrapperUMD.banner,
|
|
|
|
footer: defaults.wrapperUMD.footer
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
|
|
|
src: [
|
|
|
|
'<%= pkg.processedWidgets %>',
|
|
|
|
'!js/widgets/_test-*.js',
|
|
|
|
'!js/widgets/*.min.js'
|
|
|
|
],
|
2015-03-24 23:58:34 +00:00
|
|
|
dest: 'dist/js/<%= pkg.buildWidget %>'
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
2015-03-28 20:03:50 +00:00
|
|
|
everything: {
|
|
|
|
options: {
|
|
|
|
banner: defaults.wrapperUMD.banner,
|
|
|
|
footer: defaults.wrapperUMD.footer
|
|
|
|
},
|
|
|
|
src: [
|
|
|
|
'js/jquery.tablesorter.js',
|
|
|
|
'<%= pkg.processedWidgets %>',
|
|
|
|
'<%= pkg.processedParsers %>',
|
|
|
|
'!js/widgets/_test-*.js',
|
|
|
|
'!js/widgets/*.min.js'
|
|
|
|
],
|
|
|
|
dest: 'dist/js/<%= pkg.buildCombined %>'
|
|
|
|
},
|
2015-02-13 03:10:38 +00:00
|
|
|
// keep all the existing jsFiddle demos from breaking
|
2015-03-28 20:03:50 +00:00
|
|
|
copybackWidgets: {
|
2015-02-13 03:10:38 +00:00
|
|
|
options: {
|
2015-03-28 20:03:50 +00:00
|
|
|
banner: defaults.noModBanner
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
2015-03-24 23:58:34 +00:00
|
|
|
src : ['dist/js/<%= pkg.buildWidget %>'],
|
|
|
|
dest: 'js/<%= pkg.buildWidget %>'
|
2015-03-28 20:03:50 +00:00
|
|
|
},
|
|
|
|
copybackCombined: {
|
|
|
|
options: {
|
|
|
|
banner: defaults.noModBanner
|
|
|
|
},
|
|
|
|
src : ['dist/js/<%= pkg.buildCombined %>'],
|
|
|
|
dest: 'js/<%= pkg.buildCombined %>'
|
2015-02-13 03:10:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-07-23 04:29:51 +00:00
|
|
|
jscs: {
|
|
|
|
src: [
|
|
|
|
'addons/pager/*.js',
|
|
|
|
'!addons/pager/*.min.js',
|
|
|
|
'js/jquery.*.js',
|
|
|
|
'js/**/*.js',
|
|
|
|
'!js/_test-*.js',
|
|
|
|
'!js/jquery.tablesorter.combined.js',
|
|
|
|
'!js/jquery.tablesorter.widgets.js',
|
|
|
|
'!js/extras/jquery.dragtable.mod.js', // indents with spaces; keeping original formatting to make diffs easier
|
|
|
|
'!js/extras/jquery.metadata.js', // phasing this one out anyway
|
|
|
|
'!js/**/_test-*.js',
|
|
|
|
'!js/*.min.js',
|
|
|
|
'!js/**/semver*.js'
|
|
|
|
],
|
|
|
|
options: {
|
|
|
|
config: '.jscsrc'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-02-13 03:10:38 +00:00
|
|
|
jshint: {
|
|
|
|
files: {
|
|
|
|
src: [
|
2015-03-28 20:03:50 +00:00
|
|
|
'addons/pager/*.js',
|
|
|
|
'!addons/pager/*.min.js',
|
|
|
|
'js/jquery.*.js',
|
|
|
|
'js/**/*.js',
|
|
|
|
'!js/_test-*.js',
|
|
|
|
'!js/**/_test-*.js',
|
|
|
|
'!js/*.min.js',
|
|
|
|
'!js/**/semver*.js'
|
2015-02-13 03:10:38 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
globals: {
|
2015-03-28 20:03:50 +00:00
|
|
|
'localStorage': false,
|
|
|
|
'navigator': false,
|
|
|
|
'console': false,
|
|
|
|
'alert': false
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
2015-03-28 20:03:50 +00:00
|
|
|
'loopfunc': true,
|
|
|
|
'jquery': true,
|
2015-06-19 08:57:27 +00:00
|
|
|
'browser': true,
|
|
|
|
'es3': true
|
2015-02-13 03:10:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some',
|
|
|
|
report: 'gzip'
|
|
|
|
},
|
|
|
|
allFiles: {
|
2015-02-13 04:13:45 +00:00
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: './js/', // Src matches are relative to this path.
|
|
|
|
src: [
|
|
|
|
'**/*.js',
|
2015-03-28 20:03:50 +00:00
|
|
|
'!jquery.tablesorter.js',
|
2015-02-13 04:13:45 +00:00
|
|
|
'!_test-*.js',
|
|
|
|
'!**/_test-*.js',
|
|
|
|
'!*.min.js',
|
|
|
|
'!**/semver.js'
|
|
|
|
],
|
|
|
|
dest: 'dist/js/',
|
|
|
|
ext: '.min.js', // Dist files will have this extension.
|
2015-03-28 20:03:50 +00:00
|
|
|
extDot: 'last' // Extensions in filenames begin after this dot
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
// jquery.tablesorter.min.js is being minified from js/jquery.tablesorter.js
|
|
|
|
// so it doesn't include the UMD wrapper! Point to the dist/js/ version
|
|
|
|
main: {
|
|
|
|
files : [{
|
|
|
|
expand: true,
|
|
|
|
cwd: './dist/js/',
|
|
|
|
src: [ 'jquery.tablesorter.js' ],
|
|
|
|
dest: 'dist/js/',
|
|
|
|
ext: '.min.js', // Dist files will have this extension.
|
|
|
|
extDot: 'last' // Extensions in filenames begin after this dot
|
2015-02-13 04:13:45 +00:00
|
|
|
}]
|
2015-02-13 03:10:38 +00:00
|
|
|
},
|
|
|
|
pageraddon: {
|
|
|
|
files: {
|
|
|
|
'dist/js/extras/jquery.tablesorter.pager.min.js': [ 'addons/pager/*.js' ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
cssmin: {
|
|
|
|
target: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
2015-02-13 04:13:45 +00:00
|
|
|
cwd: 'dist/css',
|
2015-03-28 20:03:50 +00:00
|
|
|
src: ['*.css', '!_test-*.css'],
|
2015-02-13 04:13:45 +00:00
|
|
|
dest: 'dist/css',
|
|
|
|
ext: '.min.css',
|
|
|
|
extDot: 'last'
|
2015-02-13 03:10:38 +00:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
qunit: {
|
|
|
|
files: [ 'test.html' ]
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
scripts: {
|
|
|
|
files: [
|
|
|
|
'js/*.js',
|
|
|
|
'js/**/*.js',
|
|
|
|
'!js/_test-*.js',
|
|
|
|
'!js/*.min.js'
|
|
|
|
],
|
|
|
|
tasks: [ 'build' ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-clean' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-concat' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-copy' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
|
2015-07-23 04:29:51 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-jscs' );
|
2015-02-13 03:10:38 +00:00
|
|
|
|
2015-07-23 04:29:51 +00:00
|
|
|
grunt.registerTask( 'test', [ 'jscs', 'jshint', 'qunit' ] );
|
2015-02-13 03:10:38 +00:00
|
|
|
|
|
|
|
tasks = [
|
|
|
|
'clean:build',
|
2015-02-13 04:13:45 +00:00
|
|
|
'copy',
|
2015-02-13 03:10:38 +00:00
|
|
|
'concat',
|
|
|
|
'uglify',
|
|
|
|
'cssmin',
|
2015-02-13 04:13:45 +00:00
|
|
|
'clean:css',
|
2015-02-13 03:10:38 +00:00
|
|
|
'updateManifest'
|
|
|
|
];
|
|
|
|
|
|
|
|
// basic = same as before: core, widgets, filterformatter all separate
|
2015-03-28 20:03:50 +00:00
|
|
|
grunt.registerTask( 'default', 'Default build', function() {
|
2015-02-13 03:10:38 +00:00
|
|
|
pkg.selectedWidgets = addWidgetDependencies( defaults.standardWidgets );
|
|
|
|
formFileNames();
|
|
|
|
grunt.task.run(tasks);
|
|
|
|
});
|
|
|
|
|
2015-04-28 22:56:56 +00:00
|
|
|
// quick build to just minify files for pushes between updates
|
|
|
|
grunt.registerTask( 'quick', [ 'copy', 'uglify', 'clean:css' ] );
|
|
|
|
|
2015-03-28 20:03:50 +00:00
|
|
|
// enter 'grunt custom:{filename}' (not including the '.json')
|
2015-02-13 03:10:38 +00:00
|
|
|
// to load in a custom json file
|
|
|
|
// the expected JSON format is (with custom widgets in a string):
|
|
|
|
// { "widgets" : "columnHighlight filter resizable saveSort stickyHeaders uitheme" }
|
2015-03-28 20:03:50 +00:00
|
|
|
grunt.registerTask( 'custom', 'Custom build', function(file) {
|
|
|
|
var temp, widgets,
|
|
|
|
parsers = '',
|
|
|
|
deps = true;
|
2015-02-13 03:10:38 +00:00
|
|
|
|
|
|
|
/* Allow developer to set up a custom widget build (json file will have settings)*/
|
|
|
|
try {
|
|
|
|
temp = grunt.file.readJSON( file );
|
2015-03-28 20:03:50 +00:00
|
|
|
if ( temp ) {
|
|
|
|
parsers = temp.parsers;
|
2015-03-24 23:58:34 +00:00
|
|
|
// include dependencies?
|
2015-02-13 03:10:38 +00:00
|
|
|
deps = ('includeDependencies' in temp) ? temp.includeDependencies : true;
|
2015-03-24 23:58:34 +00:00
|
|
|
// custom file name?
|
2015-03-28 20:03:50 +00:00
|
|
|
pkg.buildWidget = ('destFileName' in temp) ? temp.destFileName : 'jquery.tablesorter.custom-widgets.js';
|
2015-03-24 23:58:34 +00:00
|
|
|
// widgets to include
|
|
|
|
widgets = (temp.widgets || '');
|
|
|
|
if (widgets.replace(/\s+/g,'') === '') {
|
2015-03-28 20:03:50 +00:00
|
|
|
grunt.log.error('No widgets found in custom build file.');
|
|
|
|
console.info('Continuing build with default widgets...');
|
|
|
|
temp = defaults.standardWidgets;
|
|
|
|
pkg.buildWidget = defaults.standardWidgetFileName;
|
2015-03-24 23:58:34 +00:00
|
|
|
} else {
|
|
|
|
temp = widgets.split(/\s+/);
|
|
|
|
}
|
2015-02-13 03:10:38 +00:00
|
|
|
}
|
|
|
|
} catch (err) {
|
2015-02-13 04:13:45 +00:00
|
|
|
grunt.log.error('Custom build json not found - Use "grunt custom:{filename}"');
|
2015-03-24 23:58:34 +00:00
|
|
|
console.info('Continuing build with default settings');
|
2015-02-13 03:10:38 +00:00
|
|
|
temp = defaults.standardWidgets;
|
|
|
|
}
|
|
|
|
// add dependencies
|
|
|
|
pkg.selectedWidgets = deps ? addWidgetDependencies( temp ) : temp;
|
2015-03-28 20:03:50 +00:00
|
|
|
pkg.selectedParsers = parsers.split( /\s+/ );
|
2015-02-13 03:10:38 +00:00
|
|
|
formFileNames();
|
|
|
|
grunt.task.run(tasks);
|
|
|
|
});
|
|
|
|
|
|
|
|
// update bower.json & tablesorter.jquery.json file version numbers to match the package.json version
|
|
|
|
grunt.registerTask( 'updateManifest', function() {
|
|
|
|
var i, project,
|
2015-06-13 02:19:23 +00:00
|
|
|
projectFile = [ 'tablesorter.jquery.json' ],
|
2015-02-13 03:10:38 +00:00
|
|
|
len = projectFile.length;
|
|
|
|
for ( i = 0; i < len; i++ ) {
|
|
|
|
if ( !grunt.file.exists( projectFile[ i ] ) ) {
|
2015-03-28 20:03:50 +00:00
|
|
|
grunt.log.error( 'file ' + projectFile[ i ] + ' not found' );
|
2015-02-13 03:10:38 +00:00
|
|
|
return true; // return false to abort the execution
|
|
|
|
}
|
|
|
|
project = grunt.file.readJSON( projectFile[ i ] ); // get file as json object
|
|
|
|
project.version = pkg.version;
|
|
|
|
grunt.file.write( projectFile[i], JSON.stringify( project, null, 2 ) ); // serialize it back to file
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|