diff options
author | UbitUmarov | 2015-09-01 11:43:07 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 11:43:07 +0100 |
commit | fb78b182520fc9bb0f971afd0322029c70278ea6 (patch) | |
tree | b4e30d383938fdeef8c92d1d1c2f44bb61d329bd /nant-color | |
parent | lixo (diff) | |
parent | Mantis #7713: fixed bug introduced by 1st MOSES patch. (diff) | |
download | opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.zip opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.gz opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.bz2 opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.xz |
Merge remote-tracking branch 'os/master'
Diffstat (limited to 'nant-color')
-rwxr-xr-x | nant-color | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/nant-color b/nant-color new file mode 100755 index 0000000..b368986 --- /dev/null +++ b/nant-color | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/usr/bin/env ruby | ||
2 | |||
3 | def main | ||
4 | IO.popen("nant #{ARGV.join(' ')}") { |pipe| | ||
5 | pipe.sync = true | ||
6 | while str = pipe.gets | ||
7 | str.sub!(/\n+/, '') | ||
8 | puts colorize(str) | ||
9 | end | ||
10 | } | ||
11 | end | ||
12 | |||
13 | def clear | ||
14 | return "\e[0m" | ||
15 | end | ||
16 | |||
17 | def red(str) | ||
18 | return "\e[31m" + str + clear | ||
19 | end | ||
20 | |||
21 | def green(str) | ||
22 | return "\e[32m" + str + clear | ||
23 | end | ||
24 | |||
25 | def yellow(str) | ||
26 | return "\e[33m" + str + clear | ||
27 | end | ||
28 | |||
29 | def black | ||
30 | return "\e[30m" | ||
31 | end | ||
32 | |||
33 | def hide | ||
34 | return "\e[8m" | ||
35 | end | ||
36 | |||
37 | def bright | ||
38 | return "\e[1m" | ||
39 | end | ||
40 | |||
41 | def colorize(str) | ||
42 | str.sub!(/(error \w+:.*)/, red('\1')) | ||
43 | str.sub!(/(warning \w+:.*)/, yellow('\1')) | ||
44 | |||
45 | str.sub!(/(Build Succeeded)/i, green('\1')) | ||
46 | str.sub!(/(Compilation succeeded)/, green('\1')) | ||
47 | str.sub!(/(\d+ warning\(s\))/, yellow('\1')) | ||
48 | str.sub!(/(Build Failed)/i, red('\1')) | ||
49 | |||
50 | str.sub!(/(Tests run: \d+, Failures: 0, Not run: 0,.*)/, green('\1')) | ||
51 | str.sub!(/(Tests run: \d+, Failures: 0, Not run: [1-9].*)/, yellow('\1')) | ||
52 | str.sub!(/(Tests run: \d+, Failures: [1-9].*)/, red('\1')) | ||
53 | str.sub!(/(Test Case Failures:)/, red('\1')) | ||
54 | return str | ||
55 | end | ||
56 | |||
57 | main() | ||