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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f300b8193102474e354a5c4bae92fcda23208a601ee6429a41604621d375d1af
4
- data.tar.gz: 1e4e904949892f6c21f9659c2286cdf18391aeaa14a355f8f871243d8790a7e2
3
+ metadata.gz: 80b49251df4d88a23dad1fc63b3098cbc4cbfa1e621fd52fbb59f3425d277a38
4
+ data.tar.gz: c997c2b5c5a10ce7bd9a4c15fe9d964ce897fe0497ab5bd262b8b29aa283c403
5
5
  SHA512:
6
- metadata.gz: e749e37614ac18e6150a6c705e46e6caf511b338b98fdadcf35c2bb15cd2b521230aad49a9050bb54b96dbdde4595e0fff337412b7b9864f030869dbc925b6bd
7
- data.tar.gz: b01b7257e98ab896a2f21c08da44004e9e4eb23a3aeb723105ab690a6fd5a144e38848d79e8922bf7a3f2bfd71933ea5a00dbdba3b14a0d42751f274943bbc45
6
+ metadata.gz: ecfaedb518237aa4d19c5ae349cfae5f8424ee6630c0674366acaaa900655249d4eb9bf817cd5699eaa6a4ea543ed8a6f497d98f8b6aee78a38b5f8f4ba653bf
7
+ data.tar.gz: d487777c25896417f4cbc0a0414d379b9cfb0fd5b4b8234870645a926bae2db7ae9ca33edaabea0f49c6d9c719ca233384f4831e028911f3fd32df405c6dbd1c
@@ -2,6 +2,7 @@ rvm:
2
2
  - 2.3
3
3
  - 2.4
4
4
  - 2.5
5
+ - 2.6
5
6
  - ruby-head
6
7
  - jruby-head
7
8
  sudo: false
data/README.md CHANGED
@@ -21,6 +21,9 @@ Display progress of computations and additional information to the terminal.
21
21
 
22
22
  ## Changes
23
23
 
24
+ * 2019-01-31 Release 0.6.0
25
+ - Allow progressing with - as false.
26
+
24
27
  * 2018-11-01 Release 0.5.1
25
28
  - Allow busy bar message to be overwritten.
26
29
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.6.0
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: infobar 0.5.1 ruby lib
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.5.1"
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 = "2018-11-01"
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 = "2.7.6".freeze
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, [">= 1.15.0", "~> 1.0"])
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, [">= 1.15.0", "~> 1.0"])
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, [">= 1.15.0", "~> 1.0"])
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"])
@@ -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
  )
@@ -50,7 +50,7 @@ class Infobar::Counter
50
50
  @start ||= now
51
51
  @timer.add(now, by)
52
52
  @current += by
53
- @as[as] += 1
53
+ @as[as] += by
54
54
  end
55
55
  self
56
56
  end
@@ -74,7 +74,7 @@ class Infobar::Display
74
74
  end
75
75
 
76
76
  def as_styles=(styles)
77
- @as_styles = styles.to_h.dup
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
- done_fill = as_styles[name].fetch(:done_fill) { @style[:done_fill] }
102
- done_fg_color = as_styles[name].fetch(:done_fg_color) { @style[:done_fg_color] }
103
- done_bg_color = as_styles[name].fetch(:done_bg_color) { @style[:done_bg_color] }
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)
@@ -1,6 +1,6 @@
1
1
  class Infobar
2
2
  # Infobar version
3
- VERSION = '0.5.1'
3
+ VERSION = '0.6.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -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.5.1
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: 2018-11-01 00:00:00.000000000 Z
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
- rubyforge_project:
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.