infobar 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 0be5272638347ca61146d7e2896a77d93f255718
4
- data.tar.gz: dece81f98dd6f4ebcc75018f8e2671ea1ee8aad1
3
+ metadata.gz: 7a0c747745053b3efed4f91fa65814dd018778e9
4
+ data.tar.gz: 7e9789d2145df62b2ef89a41d0f02e62b1ef5cac
5
5
  SHA512:
6
- metadata.gz: 30e7d15b2ebdc70f40736b486089edab521ce736edd8c6f430b7989c74c7ff0a1c2f89fd3dcf698a23523d75c3b908f9810914481b0dc986eb8c825480e16c3c
7
- data.tar.gz: a3e2fd36c622f755a8e8210dae2cb73ca42a9630f4cbe7f7e12a6845d8ba08796c5b825b4846f90b2da4ad4351d6668d2e20d4a1670dc6f02d7504b0b207a352
6
+ metadata.gz: a611e03d678f785245d320b2289c3764d93914138ce445eb644fa56cbea05590d89c1e9e1f2cffa7b32d3e321a07fa2af4338aecc69d0d3fa37652d8241ad42d
7
+ data.tar.gz: dfd38f2927dd1c100c071a8a88495c17c54464273765989c4098bc9cb5772cd56be55d7445f9352272205ffafcdb5b53ef0fe03cdb2d0ea56588561d0fd3f9c2
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ GemHadar do
17
17
  title "#{name.camelize}"
18
18
 
19
19
  required_ruby_version '>= 2.3'
20
- dependency 'tins', '~> 1.0', '>= 1.13.2'
20
+ dependency 'tins', '~> 1.0', '>= 1.15.0'
21
21
  dependency 'term-ansicolor', '~> 1.4'
22
22
  dependency 'complex_config', '~> 0.10'
23
23
  dependency 'more_math'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: infobar 0.2.0 ruby lib
2
+ # stub: infobar 0.3.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "infobar".freeze
6
- s.version = "0.2.0"
6
+ s.version = "0.3.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 = "2017-05-24"
11
+ s.date = "2017-06-29"
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]
@@ -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.13.2", "~> 1.0"])
31
+ s.add_runtime_dependency(%q<tins>.freeze, [">= 1.15.0", "~> 1.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.13.2", "~> 1.0"])
40
+ s.add_dependency(%q<tins>.freeze, [">= 1.15.0", "~> 1.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.13.2", "~> 1.0"])
50
+ s.add_dependency(%q<tins>.freeze, [">= 1.15.0", "~> 1.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"])
@@ -25,18 +25,18 @@ class Infobar::Message
25
25
  end
26
26
 
27
27
  # current counter value of items
28
- register '%c' do
29
- Infobar.counter.current
28
+ register('%c', format: '%d', separate: ?_) do |directive, opts|
29
+ Infobar::Number.new(Infobar.counter.current, **opts)
30
30
  end
31
31
 
32
32
  # total counter value of items
33
- register '%t' do
34
- Infobar.counter.total
33
+ register('%t', format: '%d', separate: ?_) do |directive, opts|
34
+ Infobar::Number.new(Infobar.counter.total, **opts)
35
35
  end
36
36
 
37
37
  # number of items to go
38
- register '%T' do
39
- Infobar.counter.to_go
38
+ register('%T', format: '%d', separate: ?_) do |directive, opts|
39
+ Infobar::Number.new(Infobar.counter.to_go, **opts)
40
40
  end
41
41
 
42
42
  # label of progress bar
@@ -65,17 +65,17 @@ class Infobar::Message
65
65
  end
66
66
 
67
67
  # time elapsed as a duration
68
- register('%te', format: '%h:%m:%s') do |directive, opts|
68
+ register('%te', format: '%D') do |directive, opts|
69
69
  Infobar::Duration.new(Infobar.counter.time_elapsed, **opts)
70
70
  end
71
71
 
72
72
  # total time as a duration
73
- register('%tt', format: '%h:%m:%s') do |directive, opts|
73
+ register('%tt', format: '%D') do |directive, opts|
74
74
  Infobar::Duration.new(Infobar.counter.total_time, **opts)
75
75
  end
76
76
 
77
77
  # ETA as a duration
78
- register('%e', format: '%h:%m:%s') do |directive, opts|
78
+ register('%e', format: '%D') do |directive, opts|
79
79
  Infobar::Duration.new(Infobar.counter.time_remaining, **opts)
80
80
  end
81
81
 
@@ -1,7 +1,10 @@
1
1
  class Infobar::Number
2
- def initialize(value, format: nil)
2
+ def initialize(value, format: nil, separate: nil)
3
3
  duration = Tins::Duration.new(value)
4
- @string = format ? (format % value) : value.to_s
4
+ @string = format ? format % value : value.to_s
5
+ if Integer === value && separate
6
+ @string.gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{separate}")
7
+ end
5
8
  end
6
9
 
7
10
  def to_s
@@ -1,6 +1,6 @@
1
1
  class Infobar
2
2
  # Infobar version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.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:
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.2.0
4
+ version: 0.3.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: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -75,7 +75,7 @@ dependencies:
75
75
  version: '1.0'
76
76
  - - ">="
77
77
  - !ruby/object:Gem::Version
78
- version: 1.13.2
78
+ version: 1.15.0
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -85,7 +85,7 @@ dependencies:
85
85
  version: '1.0'
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: 1.13.2
88
+ version: 1.15.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: term-ansicolor
91
91
  requirement: !ruby/object:Gem::Requirement