-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod-files-recipe.js
40 lines (36 loc) · 1.09 KB
/
mod-files-recipe.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
/*global console, module*/
module.exports = [
{
"path": "package.json",
"callback": function (content, options) {
content.token.mapVersion = options.arg[0].substr(0, options.arg[0].lastIndexOf('.')); // Read all version element except last tag which is the build number
return content;
}
},
{
"path": "web.config",
"callback": function (content, options) {
var index,
value;
content.configuration.appSettings[0].add.forEach(function (node, i) {
if (node && node["$"] && node["$"].key === "BuildVersion") {
index = i;
}
});
content.configuration.appSettings[0].add[index]["$"].value = options.arg[0];
return content;
}
},
{
"path": "../.gitignore",
"callback": function (content, options) {
var staticFolder = "Move.Map.Web\/Static/",
pattern = new RegExp(staticFolder + "([0-9].[0-9]{1,2}.[0-9]{1,2})\/"),
matches = pattern.exec(content),
bad = staticFolder + matches[1] + "/",
good = staticFolder + (options.arg[0].substr(0, options.arg[0].lastIndexOf('.'))) + "/";
content = content.replace(bad, good);
return content;
}
}
];