rspec-parallel-go-go-go 0.1.0 → 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/lib/rspec/parallel/go_go_go/progress_framer.rb +27 -32
- data/lib/rspec/parallel/go_go_go/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b77beaad2d1a8376700f6177a390928fa77c246108bb9bf0a07eaee51b230f2
|
4
|
+
data.tar.gz: fe17dc417729624d26545add743b5b0264cefbe78e69126831ef7741bf8dd43f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba712ec607ecfe19052704040d5d705a5fa32d4d4c7c2b2b2139eb2ebf371a595bc44d9cef99a64d89c2bda48f0695eca48a63611cfafe55d13a278bdc3da631
|
7
|
+
data.tar.gz: 36d9d7ed820fa173ed63132a73b06f5d6220659f46b32faf328b43ff50b383bceca920c95d001a8443655372cecd602fac50a864654788014fa69dde7450b723
|
@@ -4,45 +4,34 @@ module RSpec
|
|
4
4
|
module Parallel
|
5
5
|
module GoGoGo
|
6
6
|
module ProgressFramer
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@cal_width ||= begin
|
11
|
-
width = terminal_width # terminal width
|
12
|
-
width -= result(counter).length
|
13
|
-
width -= rate(counter).length
|
14
|
-
width -= 5 # blank * 3 and "|" * 2
|
15
|
-
width
|
16
|
-
end
|
17
|
-
end
|
7
|
+
BAR_WIDTH = 5
|
8
|
+
BAR_CHAR = "oGo"
|
9
|
+
BAR_CHAR_LEN = BAR_CHAR.length
|
18
10
|
|
19
|
-
|
20
|
-
@terminal_width ||= `tput cols`.to_i
|
21
|
-
end
|
11
|
+
module_function
|
22
12
|
|
23
13
|
def init_display(total_processes)
|
24
14
|
"\n" * total_processes
|
25
15
|
end
|
26
16
|
|
27
17
|
def display(counter, move_number)
|
28
|
-
"\r\e[#{move_number}E" + "#{
|
18
|
+
"\r\e[#{move_number}E" + "#{rate(counter)} #{bar(counter)} #{result(counter)}" + "\e[#{move_number}F"
|
29
19
|
end
|
30
20
|
|
31
21
|
def bar(counter)
|
32
|
-
width = cal_width(counter)
|
33
22
|
progress_bar = if counter.rate >= 1
|
34
|
-
completed_progress_bar
|
35
|
-
elsif counter.rate <= 0
|
36
|
-
no_progress_bar(width)
|
23
|
+
completed_progress_bar
|
37
24
|
else
|
38
|
-
in_progress_bar(counter
|
25
|
+
in_progress_bar(counter)
|
39
26
|
end
|
40
27
|
RSpec::Core::Formatters::ConsoleCodes.wrap("|#{progress_bar}|", :magenta)
|
41
28
|
end
|
42
29
|
|
43
30
|
def result(counter)
|
44
|
-
|
45
|
-
|
31
|
+
checks = counter.checks
|
32
|
+
failures = counter.failures
|
33
|
+
|
34
|
+
format("%#{checks.to_s.length}s examples, %#{failures.to_s.length}s failures", checks, failures)
|
46
35
|
end
|
47
36
|
|
48
37
|
def rate(counter)
|
@@ -50,20 +39,26 @@ module RSpec
|
|
50
39
|
"#{format("%3s", percent)}%"
|
51
40
|
end
|
52
41
|
|
53
|
-
|
54
|
-
|
55
|
-
"
|
42
|
+
def in_progress_bar(counter)
|
43
|
+
width = BAR_WIDTH + BAR_CHAR_LEN + BAR_CHAR_LEN
|
44
|
+
blank_bar = (" " * blank_len(counter))
|
45
|
+
bar = "#{blank_bar}#{BAR_CHAR}".ljust(width, " ")
|
46
|
+
bar.slice(BAR_CHAR_LEN, BAR_WIDTH)
|
56
47
|
end
|
57
48
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
49
|
+
def blank_len(counter)
|
50
|
+
v_len = (BAR_WIDTH + BAR_CHAR_LEN) * 2
|
51
|
+
len = counter.checks % v_len
|
52
|
+
if len > BAR_WIDTH + BAR_CHAR_LEN
|
53
|
+
# reverse
|
54
|
+
v_len - len
|
55
|
+
else
|
56
|
+
len
|
57
|
+
end
|
62
58
|
end
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
"=" * width
|
60
|
+
def completed_progress_bar
|
61
|
+
"=" * BAR_WIDTH
|
67
62
|
end
|
68
63
|
end
|
69
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-parallel-go-go-go
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukurose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem is a kind of rspec format. You can run rspec with progress bar.
|
14
14
|
email:
|