Skip to content
Browse files

Add bower.json and update Grunt tasks to update version number in all…

… *.json files.
  • Loading branch information...
1 parent 4b417f1 commit 051befb933777df4609a4ba9c39b1ce8431d5b4d @remybach committed May 28, 2013
Showing with 37 additions and 32 deletions.
  1. +3 −3 Gruntfile.js
  2. +1 −0 bower.json
  3. +0 −29 tasks/checkjQueryJSON.js
  4. +33 −0 tasks/updateVersion.js
View
6 Gruntfile.js
@@ -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',
@@ -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"]);
};
View
1 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"}]}
View
29 tasks/checkjQueryJSON.js
@@ -1,29 +0,0 @@
-module.exports = function(grunt) {
- 'use strict';
-
- grunt.registerTask('checkjQueryJSON', 'Update the version number in the jquery.json file.', function() {
- var filename;
-
- grunt.config.requires('checkjQueryJSON.filename');
-
- filename = grunt.config('checkjQueryJSON.filename');
-
- var json;
-
- // 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);
- });
-};
View
33 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.
Something went wrong with that request. Please try again.