forked from jamesshore/object_playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integrate.jakefile
49 lines (42 loc) · 1.37 KB
/
integrate.jakefile
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
42
43
44
45
46
47
48
49
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
/*global desc, task, jake, fail, complete */
var build_command = require("./build/util/build_command.js");
var sh = require("./build/util/sh.js");
(function() {
"use strict";
task("default", ["promote"]);
desc("Merge master branch into integration branch.");
task("promote", ["status"], function() {
checkoutAndBuild(afterSuccessfulBuild, afterFailedBuild);
function checkoutAndBuild(successCallback, failureCallback) {
sh.runMany([
"git checkout master",
build_command()
], successCallback, failureCallback);
}
function afterSuccessfulBuild() {
run([
"git checkout integration",
"git merge master --no-ff --log=500 -m INTEGRATE: --edit",
"git checkout master",
"git merge integration"
], complete);
}
function afterFailedBuild() {
fail("Integration failed.");
}
});
// Ensure there aren't any files that need to be checked in or ignored
task("status", function() {
run(["git status --porcelain"], function(stdout) {
if (stdout[0]) fail("Working directory contains files to commit or ignore.");
complete();
});
}, {async:true});
function run(commands, callback, errorMessage) {
errorMessage = errorMessage || "shell command exited with error code";
sh.runMany(commands, callback, function() {
fail(errorMessage);
});
}
}());