infobar 0.0.5 → 0.0.6
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/README.md +4 -1
- data/VERSION +1 -1
- data/infobar.gemspec +4 -4
- data/lib/infobar.rb +20 -0
- data/lib/infobar/spinner.rb +2 -0
- data/lib/infobar/version.rb +1 -1
- data/spec/infobar_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e3227748461c02d74abab7629613f81b573329a
|
4
|
+
data.tar.gz: d506cbe77093832a1d0f7c0f0819cbbd46b408b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f14234acd42a2f1e17d74e3884b8712ce5a2f0138399a3075a49f51d40186c59dd56d41aab3bb31fb4448682de559b41e6186c1b7ac3d8ab414047d115a079
|
7
|
+
data.tar.gz: 5055eb206b181521df6e0bb7fa7ccd405a943456dbfab2c05bcefe18d5b954cfa3490f04eab0f9327d15dea99aba4230bb93a601eb6540af27874a94c75ea1a4
|
data/README.md
CHANGED
@@ -21,7 +21,10 @@ Display progress of computations and additional information to the terminal.
|
|
21
21
|
|
22
22
|
## Changes
|
23
23
|
|
24
|
-
* 2017-03-
|
24
|
+
* 2017-03-24 Release 0.0.6
|
25
|
+
- Add busybar functionality via Infobar.busy { … } call
|
26
|
+
|
27
|
+
* 2017-03-10 Release 0.0.5
|
25
28
|
- Always provide a default unit for rate display, 'i/s' for "items per second".
|
26
29
|
|
27
30
|
* 2017-03-10 Release 0.0.4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/infobar.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: infobar 0.0.
|
2
|
+
# stub: infobar 0.0.6 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "infobar".freeze
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.6"
|
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-03-
|
11
|
+
s.date = "2017-03-24"
|
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.6.
|
19
|
+
s.rubygems_version = "2.6.11".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
|
|
data/lib/infobar.rb
CHANGED
@@ -76,6 +76,26 @@ class Infobar
|
|
76
76
|
self
|
77
77
|
end
|
78
78
|
|
79
|
+
def busy(**opts)
|
80
|
+
block_given? or raise ArgumentError, 'block is required as an argument'
|
81
|
+
duration = opts.delete(:sleep) || 0.1
|
82
|
+
call({
|
83
|
+
total: Float::INFINITY,
|
84
|
+
message: { format: ' %l %te %s ', '%s' => { frames: :circle1 } },
|
85
|
+
} | opts)
|
86
|
+
ib = Thread.new {
|
87
|
+
loop do
|
88
|
+
+infobar
|
89
|
+
sleep duration
|
90
|
+
end
|
91
|
+
}
|
92
|
+
r = nil
|
93
|
+
t = Thread.new { r = yield }
|
94
|
+
t.join
|
95
|
+
ib.kill
|
96
|
+
r
|
97
|
+
end
|
98
|
+
|
79
99
|
def reset
|
80
100
|
@message = convert_to_message('%l %c/%t in %te, ETA %e @%E %s')
|
81
101
|
counter.reset(total: 0, current: 0)
|
data/lib/infobar/spinner.rb
CHANGED
@@ -19,6 +19,8 @@ class Infobar::Spinner
|
|
19
19
|
cylon: [ '● ', ' ● ', ' ●', ' ● ' ],
|
20
20
|
pacman: [ 'ᗧ∙∙∙∙●', ' O∙∙∙●', ' ᗧ∙∙●',' O∙●', ' ᗧ●', 'ᗣ O', ' ᗣ ᗤ', ' ᗣ O ', ' ᗣ ᗤ ', ' ᗣO ', ' ᗤ ', 'O ∞ ', 'ᗧ ∞ ', 'O ' ],
|
21
21
|
asteroids: [ 'ᐊ ◍', 'ᐃ ◍', 'ᐓ ◍', 'ᐅ· ◍', 'ᐅ ·◍', 'ᐅ ○', 'ᐅ ◌', 'ᐁ ' ],
|
22
|
+
clock: %w[ 🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🕛 🕧 ],
|
23
|
+
hourglass: %w[ ⏳ ⌛ ],
|
22
24
|
}
|
23
25
|
|
24
26
|
def initialize(frames = nil)
|
data/lib/infobar/version.rb
CHANGED
data/spec/infobar_spec.rb
CHANGED
@@ -12,6 +12,12 @@ describe Infobar do
|
|
12
12
|
expect(infobar.counter.total).to eq 10
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'can be used to signal being busy with a block' do
|
16
|
+
expect { Infobar.busy }.to raise_error ArgumentError
|
17
|
+
expect(infobar.display).to receive(:update).at_least(1).and_call_original
|
18
|
+
Infobar.busy { sleep 0.2 }
|
19
|
+
end
|
20
|
+
|
15
21
|
it 'can be called and update instantly' do
|
16
22
|
expect(infobar).to receive(:update).and_call_original
|
17
23
|
Infobar(total: 10, update: true)
|
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.0.
|
4
|
+
version: 0.0.6
|
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-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.6.
|
217
|
+
rubygems_version: 2.6.11
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Gem to display information about computations.
|