1 | 'use strict';
|
2 |
|
3 | function pendingDescription(release, runningRelease, runningSlug) {
|
4 | if (runningRelease && runningRelease.id === release.id && hasReleasePhase(runningSlug)) {
|
5 | return 'release command executing';
|
6 | } else {
|
7 | return 'pending';
|
8 | }
|
9 | }
|
10 |
|
11 | function hasReleasePhase(slug) {
|
12 | return slug && slug.process_types && slug.process_types.release;
|
13 | }
|
14 |
|
15 | module.exports.description = function (release, runningRelease, runningSlug) {
|
16 | switch (release.status) {
|
17 | case 'pending':
|
18 | return pendingDescription(release, runningRelease, runningSlug);
|
19 | case 'failed':
|
20 | return 'release command failed';
|
21 | default:
|
22 | }
|
23 | };
|
24 |
|
25 | module.exports.color = function (s) {
|
26 | switch (s) {
|
27 | case 'pending':
|
28 | return 'yellow';
|
29 | case 'failed':
|
30 | return 'red';
|
31 | default:
|
32 | return 'white';
|
33 | }
|
34 | }; |
\ | No newline at end of file |