rspec-buildkite 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE.txt +21 -0
- data/lib/rspec/buildkite/annotation_formatter.rb +2 -47
- data/lib/rspec/buildkite/recolorizer.rb +100 -0
- data/lib/rspec/buildkite/version.rb +1 -1
- metadata +3 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f058c354d38fd0c7582242351db571a0387751435d218ae30f5dc189541429
|
4
|
+
data.tar.gz: be569dcccb1a3782f770ada2c2827c5b8aa940ecf50cce6d5076be876995c357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c68824a91bbf9bc8c892678ac36b298dcb9d166897e8b937299807a47a08f482004f284ea86fe074d358c9c2155cd4923e3210ebb56c983b7dd9944e0c3d33
|
7
|
+
data.tar.gz: e31485ada8cadb4d9566af01b57d765dcdf4349bf1ab60311553353302086efb910a747d7d6031f8beb7964d7c3891a5453559788cced63e670a91d70bf452fa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Samuel Cochran
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "thread"
|
2
2
|
|
3
3
|
require "rspec/core"
|
4
|
+
require "rspec/buildkite/recolorizer"
|
4
5
|
|
5
6
|
module RSpec::Buildkite
|
6
7
|
# Create a Buildkite annotation for RSpec failures
|
@@ -56,56 +57,10 @@ module RSpec::Buildkite
|
|
56
57
|
|
57
58
|
"<details>\n" <<
|
58
59
|
"<summary>#{notification.description.encode(:xml => :text)}</summary>\n\n" <<
|
59
|
-
"<code><pre>#{recolorize(notification.colorized_message_lines.join("\n").encode(:xml => :text))}</pre></code>\n\n" <<
|
60
|
+
"<code><pre>#{Recolorizer.recolorize(notification.colorized_message_lines.join("\n").encode(:xml => :text))}</pre></code>\n\n" <<
|
60
61
|
%{in <a href=#{job_url.encode(:xml => :attr)}>Job ##{job_id.encode(:xml => :text)}</a>\n} <<
|
61
62
|
"</details>" <<
|
62
63
|
"\n\n\n"
|
63
64
|
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
# Re-color an ANSI-colorized string using terminal CSS classes:
|
68
|
-
# https://github.com/buildkite/terminal/blob/05a77905c468b9150cac41298fdb8a0735024d42/style.go#L34
|
69
|
-
def recolorize(string)
|
70
|
-
level = 0
|
71
|
-
string.gsub(/\e\[(\d+(?:;\d+)*)m/) do
|
72
|
-
"".tap do |buffer|
|
73
|
-
codes = $1.split(";").map(&:to_i)
|
74
|
-
|
75
|
-
classes = []
|
76
|
-
while code = codes.shift
|
77
|
-
case code
|
78
|
-
when 0
|
79
|
-
classes.clear
|
80
|
-
buffer << ("</span>" * level)
|
81
|
-
level = 0
|
82
|
-
when 1..5, 9, 30..37, 90..97
|
83
|
-
classes << "term-fg#{code}"
|
84
|
-
when 40..47, 100..107
|
85
|
-
classes << "term-bg#{code}"
|
86
|
-
when 38
|
87
|
-
if codes[0] == 5
|
88
|
-
codes.shift
|
89
|
-
if codes[0]
|
90
|
-
classes << "term-fgx#{codes.shift}"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
when 48
|
94
|
-
if codes[0] == 5
|
95
|
-
codes.shift
|
96
|
-
if codes[0]
|
97
|
-
classes << "term-bgx#{codes.shift}"
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
if classes.any?
|
104
|
-
level += 1
|
105
|
-
buffer << %{<span class=#{classes.map { |klass| klass }.join(" ").encode(:xml => :attr)}>}
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end << ("</span>" * level)
|
109
|
-
end
|
110
65
|
end
|
111
66
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module RSpec::Buildkite
|
2
|
+
module Recolorizer
|
3
|
+
module_function
|
4
|
+
|
5
|
+
# Re-color an ANSI-colorized string using terminal CSS classes:
|
6
|
+
# https://github.com/buildkite/terminal/blob/05a77905c468b9150cac41298fdb8a0735024d42/style.go#L34
|
7
|
+
def recolorize(string)
|
8
|
+
level = 0
|
9
|
+
string.gsub(/\e\[(\d+(?:;\d+)*)m/) do
|
10
|
+
"".tap do |buffer|
|
11
|
+
codes = $1.split(";").map(&:to_i)
|
12
|
+
|
13
|
+
classes = []
|
14
|
+
while code = codes.shift
|
15
|
+
case code
|
16
|
+
when 0
|
17
|
+
classes.clear
|
18
|
+
buffer << ("</span>" * level)
|
19
|
+
level = 0
|
20
|
+
when 1..5, 9, 30..37
|
21
|
+
classes << "term-fg#{code}"
|
22
|
+
when 38
|
23
|
+
if codes[0] == 5
|
24
|
+
codes.shift
|
25
|
+
if codes[0]
|
26
|
+
classes << "term-fgx#{codes.shift}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
when 40..47
|
30
|
+
classes << "term-bg#{code}"
|
31
|
+
when 48
|
32
|
+
if codes[0] == 5
|
33
|
+
codes.shift
|
34
|
+
if codes[0]
|
35
|
+
classes << "term-bgx#{codes.shift}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
when 90..97
|
39
|
+
classes << "term-fgi#{code}"
|
40
|
+
when 100..107
|
41
|
+
classes << "term-bgi#{code}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if classes.any?
|
46
|
+
level += 1
|
47
|
+
buffer << %{<span class=#{classes.map { |klass| klass }.join(" ").encode(:xml => :attr)}>}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end << ("</span>" * level)
|
51
|
+
end
|
52
|
+
# Re-color an ANSI-colorized string using terminal CSS classes:
|
53
|
+
# https://github.com/buildkite/terminal/blob/05a77905c468b9150cac41298fdb8a0735024d42/style.go#L34
|
54
|
+
def recolorize(string)
|
55
|
+
level = 0
|
56
|
+
string.gsub(/\e\[(\d+(?:;\d+)*)m/) do
|
57
|
+
"".tap do |buffer|
|
58
|
+
codes = $1.split(";").map(&:to_i)
|
59
|
+
|
60
|
+
classes = []
|
61
|
+
while code = codes.shift
|
62
|
+
case code
|
63
|
+
when 0
|
64
|
+
classes.clear
|
65
|
+
buffer << ("</span>" * level)
|
66
|
+
level = 0
|
67
|
+
when 1..5, 9, 30..37
|
68
|
+
classes << "term-fg#{code}"
|
69
|
+
when 38
|
70
|
+
if codes[0] == 5
|
71
|
+
codes.shift
|
72
|
+
if codes[0]
|
73
|
+
classes << "term-fgx#{codes.shift}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
when 40..47
|
77
|
+
classes << "term-bg#{code}"
|
78
|
+
when 48
|
79
|
+
if codes[0] == 5
|
80
|
+
codes.shift
|
81
|
+
if codes[0]
|
82
|
+
classes << "term-bgx#{codes.shift}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
when 90..97
|
86
|
+
classes << "term-fgi#{code}"
|
87
|
+
when 100..107
|
88
|
+
classes << "term-bgi#{code}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
if classes.any?
|
93
|
+
level += 1
|
94
|
+
buffer << %{<span class=#{classes.map { |klass| klass }.join(" ").encode(:xml => :attr)}>}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end << ("</span>" * level)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-buildkite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Cochran
|
@@ -120,9 +120,11 @@ executables: []
|
|
120
120
|
extensions: []
|
121
121
|
extra_rdoc_files: []
|
122
122
|
files:
|
123
|
+
- LICENSE.txt
|
123
124
|
- README.md
|
124
125
|
- lib/rspec/buildkite.rb
|
125
126
|
- lib/rspec/buildkite/annotation_formatter.rb
|
127
|
+
- lib/rspec/buildkite/recolorizer.rb
|
126
128
|
- lib/rspec/buildkite/version.rb
|
127
129
|
homepage: https://github.com/sj26/rspec-buildkite
|
128
130
|
licenses:
|
metadata.gz.sig
CHANGED
Binary file
|