circler 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/circler/cli.rb +1 -0
- data/lib/circler/printer/step_printer.rb +19 -11
- data/lib/circler/response/action.rb +29 -0
- data/lib/circler/response/build.rb +1 -1
- data/lib/circler/response/step.rb +3 -7
- data/lib/circler/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a2915be4476721570000fcd1fb54d7e42100969
|
4
|
+
data.tar.gz: d469bbb48a50f212f332c4fa07348388f6f5f8f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 520a6987ac1086744907dcd82b7edfe9458eaf1897f77ef7d2a4778565db4d44f478c57c43f684948b60e62e7a301efabe12e634828516951a563325d371b422
|
7
|
+
data.tar.gz: aed62cc99804a8f87cd0f5b4e46e4ce81c9ae3070a3f5b062468a029e06337ea5e3e4efa8fae897bd2632638b7f718b3e3d50d8804a0069a70fac1f1ad39b6a8
|
data/Gemfile.lock
CHANGED
data/lib/circler/cli.rb
CHANGED
@@ -15,6 +15,7 @@ require 'circler/command/browse_command'
|
|
15
15
|
require 'circler/response/project'
|
16
16
|
require 'circler/response/build'
|
17
17
|
require 'circler/response/step'
|
18
|
+
require 'circler/response/action'
|
18
19
|
require 'circler/printer/project_printer'
|
19
20
|
require 'circler/printer/build_printer'
|
20
21
|
require 'circler/printer/step_printer'
|
@@ -7,17 +7,25 @@ module Circler
|
|
7
7
|
|
8
8
|
def to_s
|
9
9
|
table = Terminal::Table.new do |t|
|
10
|
-
@steps
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
t << [
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
@steps
|
11
|
+
.group_by {|s| s.type }
|
12
|
+
.each do |key, steps|
|
13
|
+
t << :separator
|
14
|
+
t << [{ value: key.green, alignment: :center, :colspan => 2 }]
|
15
|
+
steps.each do |s|
|
16
|
+
t << :separator
|
17
|
+
|
18
|
+
s.actions.each do |a|
|
19
|
+
t << [
|
20
|
+
colorize_by_status(a.name.slice(0..120), a.status),
|
21
|
+
format_time(a.run_time_millis)
|
22
|
+
]
|
23
|
+
if a.failed? && a.log
|
24
|
+
t << [{ value: a.log, alignment: :left, colspan: 2}]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
18
28
|
end
|
19
|
-
t << :separator
|
20
|
-
end
|
21
29
|
end
|
22
30
|
table.to_s
|
23
31
|
end
|
@@ -28,7 +36,7 @@ module Circler
|
|
28
36
|
case status
|
29
37
|
when 'success', 'fixed' then string.green
|
30
38
|
when 'canceled' then string.yellow
|
31
|
-
when 'failed' then string.red
|
39
|
+
when 'failed', 'timedout' then string.red
|
32
40
|
when 'no_tests', 'not_run' then string.light_black
|
33
41
|
else string
|
34
42
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Circler
|
2
|
+
class Action
|
3
|
+
attr_reader :name, :status, :run_time_millis
|
4
|
+
def initialize(hash)
|
5
|
+
@hash = hash
|
6
|
+
@name = hash['name']
|
7
|
+
@status = hash['status']
|
8
|
+
@run_time_millis = hash['run_time_millis']
|
9
|
+
end
|
10
|
+
|
11
|
+
def log
|
12
|
+
request(@hash['output_url'])
|
13
|
+
.map{ |r| r['message']}
|
14
|
+
.join
|
15
|
+
.gsub(/.{120}/, "\\0\n")
|
16
|
+
.gsub(/\r/, '')
|
17
|
+
end
|
18
|
+
|
19
|
+
def failed?
|
20
|
+
@status == 'timedout' || @status == 'failed'
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def request(url)
|
26
|
+
JSON.parse(Faraday.new(url).get.body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,20 +1,16 @@
|
|
1
1
|
module Circler
|
2
2
|
class Step
|
3
3
|
attr_reader :type
|
4
|
+
attr_reader :status
|
4
5
|
|
5
6
|
def initialize(type, hash)
|
6
7
|
@type = type
|
8
|
+
@status = hash['status']
|
7
9
|
@hash = hash
|
8
10
|
end
|
9
11
|
|
10
12
|
def actions
|
11
|
-
@hash.
|
12
|
-
end
|
13
|
-
|
14
|
-
def logs
|
15
|
-
actions.map do |a|
|
16
|
-
Faraday.new(a.output_url).get.body
|
17
|
-
end
|
13
|
+
@hash['actions'].map{ |a| Action.new(a) }
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
data/lib/circler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unhappychoice
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/circler/printer/build_printer.rb
|
194
194
|
- lib/circler/printer/project_printer.rb
|
195
195
|
- lib/circler/printer/step_printer.rb
|
196
|
+
- lib/circler/response/action.rb
|
196
197
|
- lib/circler/response/build.rb
|
197
198
|
- lib/circler/response/project.rb
|
198
199
|
- lib/circler/response/step.rb
|