grunt-gitrevision
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -33,2 +33,11 @@ /* | ||
} | ||
}, | ||
custom_options: { | ||
options: { | ||
revisionPrefix: ' (Build ', | ||
revisionSuffix: ')' | ||
}, | ||
files: { | ||
'tmp/custom.js': ['test/fixtures/testing.js'] | ||
} | ||
} | ||
@@ -35,0 +44,0 @@ } |
{ | ||
"name": "grunt-gitrevision", | ||
"description": "Grunt task to add version and Git's revision information to your project files.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/miwurster/grunt-gitrevision", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -22,2 +22,3 @@ # grunt-gitrevision | ||
## Getting Started | ||
@@ -62,3 +63,3 @@ | ||
#### options.prefix | ||
#### options.versionPattern | ||
Type: `String` | ||
@@ -69,2 +70,15 @@ Default value: `'[^\\-]version[\'"]?\\s*[:=]\\s*[\'"]'` | ||
#### options.revisionPrefix | ||
Type: `String` | ||
Default value: `'-r'` | ||
A string value prefixing the revision number. | ||
#### options.revisionSuffix | ||
Type: `String` | ||
Default value: `''` | ||
A string value which should be appended to the revision information. | ||
### Usage Examples | ||
@@ -71,0 +85,0 @@ |
@@ -20,4 +20,6 @@ /* | ||
var options = this.options({ | ||
prefix: '[^\\-]version[\'"]?\\s*[:=]\\s*[\'"]', | ||
replace: '[0-9a-zA-Z\\-_\\+\\.]+' | ||
versionPattern: '[^\\-]version[\'"]?\\s*[:=]\\s*[\'"]', | ||
replacePattern: '[0-9a-zA-Z\\-_\\+\\.]+', | ||
revisionPrefix: '-r', | ||
revisionSuffix: '' | ||
}); | ||
@@ -47,3 +49,3 @@ | ||
var revision = stdout.replace(/(\r\n|\n|\r)/gm, ""); | ||
var version = pkg.version + '-b' + revision; | ||
var version = pkg.version + options.revisionPrefix + revision + options.revisionSuffix; | ||
@@ -53,3 +55,3 @@ var content = grunt.file.read(filepath); | ||
// Apply the version string to the src file | ||
var pattern = new RegExp('(' + options.prefix + ')(' + options.replace + ')', 'g'); | ||
var pattern = new RegExp('(' + options.versionPattern + ')(' + options.replacePattern + ')', 'g'); | ||
var output = content.replace(pattern, '$1' + version); | ||
@@ -56,0 +58,0 @@ |
9133
100
102