Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Add bower.json and update Grunt tasks to update version number in all…
Browse files Browse the repository at this point in the history
… *.json files.
  • Loading branch information
remybach committed May 28, 2013
1 parent 4b417f1 commit 051befb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
6 changes: 3 additions & 3 deletions Gruntfile.js
Expand Up @@ -53,8 +53,8 @@ module.exports = function(grunt) {
checkBanner: {
filename: 'jquery.superLabels.js'
},
checkjQueryJSON: {
filename: 'superLabels.jquery.json'
updateVersion: {
files: [ 'superLabels.jquery.json', 'bower.json' ]
},
minify: {
dest: 'jquery.superLabels.min.js',
Expand All @@ -77,5 +77,5 @@ module.exports = function(grunt) {
grunt.loadTasks('tasks');

// Default task - Run JS Hint, check the version in the jquery.json file matches what's in packages.json, update the banner in the superlabels file, and minify.
grunt.registerTask('default', ["jshint", "checkjQueryJSON", "checkBanner", "minify"]);
grunt.registerTask('default', ["jshint", "updateVersion", "checkBanner", "minify"]);
};
1 change: 1 addition & 0 deletions bower.json
@@ -0,0 +1 @@
{"name":"jQuery.superLabels","version":"2.0.4","description":"Give your forms a helping of awesome!","homepage":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues","repository":{"type":"git","url":"https://github.com/remybach/jQuery.superLabels"},"main":"jquery.superLabels.min.js","licenses":[{"type":"MIT"}]}
29 changes: 0 additions & 29 deletions tasks/checkjQueryJSON.js

This file was deleted.

33 changes: 33 additions & 0 deletions tasks/updateVersion.js
@@ -0,0 +1,33 @@
module.exports = function(grunt) {
'use strict';

grunt.registerTask('updateVersion', 'Update the version number in all relevant *.json files.', function() {
var filename,
files,
json;

grunt.config.requires('updateVersion.files');

files = grunt.config('updateVersion.files');

for (var i = files.length - 1; i >= 0; i--) {
filename = files[i];

// Warn on and remove invalid source files (if nonull was set).
if (!grunt.file.exists(filename)) {
grunt.log.warn('Source file not found at "' + filename + '"');
return false;
}

grunt.log.writeln('Updating Banner for: '+filename);

json = grunt.file.readJSON(filename);

json.version = grunt.config('meta.version');

grunt.file.write(filename, JSON.stringify(json));

grunt.log.writeln('Done updating version in: '+filename);
}
});
};

0 comments on commit 051befb

Please sign in to comment.