-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.php
More file actions
29 lines (25 loc) · 769 Bytes
/
check.php
File metadata and controls
29 lines (25 loc) · 769 Bytes
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
<?php
namespace Deployer;
task('check:uncommited', function() {
$result = run("cd {{deploy_path}} && if [ -d current ]; then cd current && {{bin/git}} status --porcelain; fi")->toString();
if (strlen($result) > 0) {
throw new \RuntimeException(
"Working copy contains uncommited/unstaged changes"
);
}
});
task('check:unpushed', function() {
$result = run("cd {{deploy_path}} && if [ -d current ]; then cd current && {{bin/git}} log --oneline origin/{{branch}}..{{branch}}; fi")->toString();
if (strlen($result) > 0) {
throw new \RuntimeException(
"Working copy contains unpushed changes"
);
}
});
task(
'check',
[
'check:uncommited',
'check:unpushed'
]
);