-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSetVersion.js
41 lines (37 loc) · 1.44 KB
/
SetVersion.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// <binding />
module.exports = function (grunt) {
var version = grunt.option("semver");
if(!version || !/\d+\.\d+\.\d+/.test(version))
grunt.fail.fatal("Version is ether not specified by -semver option or has incorrect format. Correct version format is Major.Minor.Revision, 1.2.3 for example.")
grunt.initConfig({
version: version,
replace: {
bower: {
options: {
patterns: [{
match: /("version"\s*:\s*")\d+\.\d+\.\d+(")/,
replace: "$1<%=version%>$2"
}]
},
files: [
{ src: "bower.json", dest: "bower.json" },
{ src: "package.json", dest: "package.json" }
]
},
assemblyInfo: {
options: {
patterns: [{
match: /(let\s*Version\s*=\s*")\d+\.\d+\.\d+("\s*\/\/ Assembly semantic version)/,
replace: "$1<%=version%>$2"
}]
},
files: [
{ src: "src/Angara.Serialization/AssemblyInfo.fs", dest: "src/Angara.Serialization/AssemblyInfo.fs" },
{ src: "src/Angara.Serialization.Json/AssemblyInfo.fs", dest: "src/Angara.Serialization.Json/AssemblyInfo.fs" }
]
}
}
});
grunt.loadNpmTasks('grunt-replace');
grunt.registerTask('default', ['replace']);
};