Skip to content

Commit 2a69b18

Browse files
Adam DraperAdam Draper
authored andcommitted
task for versioning of son files
1 parent ac93c80 commit 2a69b18

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

Gruntfile.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ module.exports = function(grunt) {
4444
grunt.file.write('numeral.js', numeral);
4545
};
4646

47+
require('load-grunt-tasks')(grunt);
48+
4749
grunt.initConfig({
4850
mochaTest : {
4951
all: [
@@ -152,12 +154,6 @@ module.exports = function(grunt) {
152154
}
153155
});
154156

155-
grunt.loadNpmTasks('grunt-contrib-copy');
156-
grunt.loadNpmTasks('grunt-contrib-uglify');
157-
grunt.loadNpmTasks('grunt-contrib-jshint');
158-
grunt.loadNpmTasks('grunt-mocha-test');
159-
grunt.loadNpmTasks('grunt-karma');
160-
161157
grunt.registerTask('default', [
162158
'test'
163159
]);
@@ -194,6 +190,32 @@ module.exports = function(grunt) {
194190
'uglify'
195191
]);
196192

193+
grunt.registerTask('version', function (version) {
194+
if (!version || version.split('.').length !== 3) {
195+
grunt.fail.fatal('malformed version. Use\n\n grunt version:1.2.3');
196+
}
197+
198+
grunt.config('string-replace.json', {
199+
files: {
200+
'package.json': 'package.json',
201+
'component.json': 'component.json',
202+
'bower.json': 'bower.json'
203+
},
204+
options: {
205+
replacements: [
206+
{
207+
pattern: /"version": .*/,
208+
replacement: '"version": "' + version + '",'
209+
}
210+
]
211+
}
212+
});
213+
214+
grunt.task.run([
215+
'string-replace:json'
216+
]);
217+
});
218+
197219
// Travis CI task.
198220
grunt.registerTask('travis', [
199221
'build',

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "numeral",
33
"repo": "adamwdraper/Numeral-js",
4-
"version": "2.0.3",
4+
"version": "2.0.4",
55
"description": "Format and manipulate numbers.",
66
"keywords": [
77
"numeral",

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "numeral",
33
"repo": "adamwdraper/Numeral-js",
4-
"version": "2.0.3",
4+
"version": "2.0.4",
55
"description": "Format and manipulate numbers.",
66
"keywords": [
77
"numeral",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "numeral",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Format and manipulate numbers.",
55
"homepage": "http://numeraljs.com",
66
"author": {
@@ -38,13 +38,15 @@
3838
"grunt-karma": "^2.0.0",
3939
"grunt-mocha-test": "^0.13.2",
4040
"grunt-saucelabs": "*",
41+
"grunt-string-replace": "^1.3.1",
4142
"karma": "^1.3.0",
4243
"karma-chai": "^0.1.0",
4344
"karma-chrome-launcher": "^2.0.0",
4445
"karma-firefox-launcher": "^1.0.0",
4546
"karma-mocha": "^1.3.0",
4647
"karma-mocha-reporter": "^2.2.1",
4748
"karma-sauce-launcher": "^1.1.0",
49+
"load-grunt-tasks": "^3.5.2",
4850
"mocha": "^3.1.2",
4951
"uglify-js": "latest"
5052
},

0 commit comments

Comments
 (0)