infobar 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +3 -0
- data/VERSION +1 -1
- data/infobar.gemspec +7 -7
- data/lib/infobar.rb +2 -2
- data/lib/infobar/counter.rb +1 -1
- data/lib/infobar/display.rb +5 -4
- data/lib/infobar/fancy_interface.rb +10 -2
- data/lib/infobar/version.rb +1 -1
- data/spec/infobar_spec.rb +24 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b49251df4d88a23dad1fc63b3098cbc4cbfa1e621fd52fbb59f3425d277a38
|
4
|
+
data.tar.gz: c997c2b5c5a10ce7bd9a4c15fe9d964ce897fe0497ab5bd262b8b29aa283c403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecfaedb518237aa4d19c5ae349cfae5f8424ee6630c0674366acaaa900655249d4eb9bf817cd5699eaa6a4ea543ed8a6f497d98f8b6aee78a38b5f8f4ba653bf
|
7
|
+
data.tar.gz: d487777c25896417f4cbc0a0414d379b9cfb0fd5b4b8234870645a926bae2db7ae9ca33edaabea0f49c6d9c719ca233384f4831e028911f3fd32df405c6dbd1c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/infobar.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: infobar 0.
|
2
|
+
# stub: infobar 0.6.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "infobar".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.6.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2019-01-31"
|
12
12
|
s.description = "This gem displays progress of computations and additional information to the terminal.".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.extra_rdoc_files = ["README.md".freeze, "lib/infobar.rb".freeze, "lib/infobar/counter.rb".freeze, "lib/infobar/display.rb".freeze, "lib/infobar/duration.rb".freeze, "lib/infobar/fancy_interface.rb".freeze, "lib/infobar/fifo.rb".freeze, "lib/infobar/frequency.rb".freeze, "lib/infobar/input_output.rb".freeze, "lib/infobar/message.rb".freeze, "lib/infobar/number.rb".freeze, "lib/infobar/rate.rb".freeze, "lib/infobar/spinner.rb".freeze, "lib/infobar/timer.rb".freeze, "lib/infobar/trend.rb".freeze, "lib/infobar/version.rb".freeze]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = "http://flori.github.com/infobar".freeze
|
17
17
|
s.rdoc_options = ["--title".freeze, "Infobar".freeze, "--main".freeze, "README.md".freeze]
|
18
18
|
s.required_ruby_version = Gem::Requirement.new(">= 2.3".freeze)
|
19
|
-
s.rubygems_version = "
|
19
|
+
s.rubygems_version = "3.0.1".freeze
|
20
20
|
s.summary = "Gem to display information about computations.".freeze
|
21
21
|
s.test_files = ["spec/infobar/config_spec.rb".freeze, "spec/infobar/counter_spec.rb".freeze, "spec/infobar/display_spec.rb".freeze, "spec/infobar/duration_spec.rb".freeze, "spec/infobar/fifo_spec.rb".freeze, "spec/infobar/frequency_spec.rb".freeze, "spec/infobar/input_output_spec.rb".freeze, "spec/infobar/message_spec.rb".freeze, "spec/infobar/number_spec.rb".freeze, "spec/infobar/rate_spec.rb".freeze, "spec/infobar/spinner_spec.rb".freeze, "spec/infobar/timer_spec.rb".freeze, "spec/infobar/trend_spec.rb".freeze, "spec/infobar_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
22
22
|
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
29
29
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
31
|
-
s.add_runtime_dependency(%q<tins>.freeze, ["
|
31
|
+
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.0", ">= 1.15.0"])
|
32
32
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.4"])
|
33
33
|
s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.10"])
|
34
34
|
s.add_runtime_dependency(%q<more_math>.freeze, [">= 0"])
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
38
38
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
39
39
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
40
|
-
s.add_dependency(%q<tins>.freeze, ["
|
40
|
+
s.add_dependency(%q<tins>.freeze, ["~> 1.0", ">= 1.15.0"])
|
41
41
|
s.add_dependency(%q<term-ansicolor>.freeze, ["~> 1.4"])
|
42
42
|
s.add_dependency(%q<complex_config>.freeze, ["~> 0.10"])
|
43
43
|
s.add_dependency(%q<more_math>.freeze, [">= 0"])
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
48
48
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
49
49
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
50
|
-
s.add_dependency(%q<tins>.freeze, ["
|
50
|
+
s.add_dependency(%q<tins>.freeze, ["~> 1.0", ">= 1.15.0"])
|
51
51
|
s.add_dependency(%q<term-ansicolor>.freeze, ["~> 1.4"])
|
52
52
|
s.add_dependency(%q<complex_config>.freeze, ["~> 0.10"])
|
53
53
|
s.add_dependency(%q<more_math>.freeze, [">= 0"])
|
data/lib/infobar.rb
CHANGED
@@ -63,10 +63,10 @@ class Infobar
|
|
63
63
|
label: cc.infobar?&.label || 'Infobar',
|
64
64
|
message: cc.infobar?&.message?&.to_h,
|
65
65
|
show: cc.infobar?&.show?,
|
66
|
-
style: cc.infobar?&.style?&.to_h,
|
66
|
+
style: cc.infobar?&.style?&.to_h&.symbolize_keys_recursive,
|
67
|
+
as_styles: cc.infobar?&.as_styles?&.to_h&.symbolize_keys_recursive,
|
67
68
|
frequency: cc.infobar?&.frequency?,
|
68
69
|
update: false,
|
69
|
-
as_styles: nil,
|
70
70
|
input: $stdin,
|
71
71
|
output: $stdout
|
72
72
|
)
|
data/lib/infobar/counter.rb
CHANGED
data/lib/infobar/display.rb
CHANGED
@@ -74,7 +74,7 @@ class Infobar::Display
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def as_styles=(styles)
|
77
|
-
@as_styles = styles.to_h.
|
77
|
+
@as_styles = styles.to_h.symbolize_keys_recursive
|
78
78
|
@as_styles.default_proc = proc { style.subhash(/\Adone_/) }
|
79
79
|
end
|
80
80
|
|
@@ -98,9 +98,10 @@ class Infobar::Display
|
|
98
98
|
|
99
99
|
total_done = 0
|
100
100
|
counter.as.each_with_index do |(name, count), i|
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
style_name = name.to_s.to_sym
|
102
|
+
done_fill = as_styles[style_name].fetch(:done_fill) { @style[:done_fill] }
|
103
|
+
done_fg_color = as_styles[style_name].fetch(:done_fg_color) { @style[:done_fg_color] }
|
104
|
+
done_bg_color = as_styles[style_name].fetch(:done_bg_color) { @style[:done_bg_color] }
|
104
105
|
|
105
106
|
as_progressed = count / counter.total.to_f
|
106
107
|
as_done = as_progressed * cols
|
@@ -4,11 +4,19 @@ module Infobar::FancyInterface
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def +@
|
7
|
-
progress by: 1
|
7
|
+
progress by: 1, as: true
|
8
|
+
end
|
9
|
+
|
10
|
+
def -@
|
11
|
+
progress by: 1, as: false
|
8
12
|
end
|
9
13
|
|
10
14
|
def +(by)
|
11
|
-
progress by: by
|
15
|
+
progress by: by, as: true
|
16
|
+
end
|
17
|
+
|
18
|
+
def -(by)
|
19
|
+
progress by: by, as: false
|
12
20
|
end
|
13
21
|
|
14
22
|
def coerce(other)
|
data/lib/infobar/version.rb
CHANGED
data/spec/infobar_spec.rb
CHANGED
@@ -54,6 +54,15 @@ describe Infobar do
|
|
54
54
|
expect(infobar.counter.current).to eq 1
|
55
55
|
end
|
56
56
|
|
57
|
+
it 'can be progressing with unary - as false' do
|
58
|
+
Infobar(total: 10)
|
59
|
+
expect(infobar.counter.current).to eq 0
|
60
|
+
expect(infobar.counter.as[false]).to eq 0
|
61
|
+
expect(-infobar).to eq infobar
|
62
|
+
expect(infobar.counter.current).to eq 1
|
63
|
+
expect(infobar.counter.as[false]).to eq 1
|
64
|
+
end
|
65
|
+
|
57
66
|
it 'can be progressing by n' do
|
58
67
|
Infobar(total: 10)
|
59
68
|
expect(infobar.counter.current).to eq 0
|
@@ -72,6 +81,21 @@ describe Infobar do
|
|
72
81
|
expect(infobar.counter.current).to eq 7
|
73
82
|
end
|
74
83
|
|
84
|
+
it 'can be progressing by n with binary - as false' do
|
85
|
+
infobar = Infobar(total: 10)
|
86
|
+
expect(infobar.counter.current).to eq 0
|
87
|
+
expect(infobar.counter.as[false]).to eq 0
|
88
|
+
expect(infobar - 3).to eq infobar
|
89
|
+
expect(infobar.counter.current).to eq 3
|
90
|
+
expect(infobar.counter.as[false]).to eq 3
|
91
|
+
expect(2 - infobar).to eq infobar
|
92
|
+
expect(infobar.counter.current).to eq 5
|
93
|
+
expect(infobar.counter.as[false]).to eq 5
|
94
|
+
expect(infobar -= 2).to eq infobar # only for variables
|
95
|
+
expect(infobar.counter.current).to eq 7
|
96
|
+
expect(infobar.counter.as[false]).to eq 7
|
97
|
+
end
|
98
|
+
|
75
99
|
it 'can progress as some kind' do
|
76
100
|
Infobar(total: 10)
|
77
101
|
expect(infobar.counter.current).to eq 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infobar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -215,8 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
|
-
|
219
|
-
rubygems_version: 2.7.6
|
218
|
+
rubygems_version: 3.0.1
|
220
219
|
signing_key:
|
221
220
|
specification_version: 4
|
222
221
|
summary: Gem to display information about computations.
|