Created
March 18, 2014 18:45
-
-
Save derikwhittaker/9626683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerTask('parse', function(){ | |
grunt.log.writeln('About to parse the assembly files'); | |
var assemblyFile = grunt.file.read('./SharedAssemblyInfo.cs'); | |
var lines = assemblyFile.split('\n'); | |
var version = ''; | |
var versionParts = ''; | |
var searchString = 'AssemblyVersion'; | |
_.each(lines, function (line, index) { | |
if (line.indexOf(searchString) != -1) { | |
version = line.match(/\d+\.\d+\.\d+\.\d+/g).toString(); | |
versionParts = version.split('.'); | |
versionParts[3] = parseInt(versionParts[3], 10) + 1; | |
lines[index] = line.replace(version, versionParts.join('.')); | |
} | |
}); | |
var updatedAssemblyFile = lines.join('\n'); | |
grunt.file.write('./SharedAssemblyInfo.cs', updatedAssemblyFile); | |
grunt.log.write('Updated to version: ' + versionParts); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment