ruby-progressbar 1.4.2 → 1.5.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 +7 -0
- data/README.md +52 -24
- data/lib/ruby-progressbar/base.rb +3 -0
- data/lib/ruby-progressbar/components.rb +1 -0
- data/lib/ruby-progressbar/components/progressable.rb +5 -5
- data/lib/ruby-progressbar/components/rate.rb +69 -0
- data/lib/ruby-progressbar/format/molecule.rb +18 -17
- data/lib/ruby-progressbar/formatter.rb +8 -0
- data/lib/ruby-progressbar/version.rb +1 -1
- data/spec/lib/ruby-progressbar/base_spec.rb +231 -86
- data/spec/lib/ruby-progressbar/components/bar_spec.rb +27 -27
- data/spec/lib/ruby-progressbar/components/elapsed_timer_spec.rb +10 -10
- data/spec/lib/ruby-progressbar/components/estimated_timer_spec.rb +21 -19
- data/spec/lib/ruby-progressbar/components/progressable_spec.rb +15 -6
- data/spec/lib/ruby-progressbar/components/throttle_spec.rb +10 -11
- data/spec/lib/ruby-progressbar/format/molecule_spec.rb +4 -4
- data/spec/lib/ruby-progressbar/running_average_calculator_spec.rb +4 -4
- data/spec/lib/ruby-progressbar/time_spec.rb +4 -6
- metadata +59 -44
- data/spec/spec_helper.rb +0 -6
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'timecop'
|
1
|
+
require 'rspectacular'
|
3
2
|
|
4
3
|
describe ProgressBar::Components::Throttle do
|
5
4
|
context 'given a numeric period' do
|
@@ -15,12 +14,12 @@ describe ProgressBar::Components::Throttle do
|
|
15
14
|
|
16
15
|
@throttle.choke { yielded = true }
|
17
16
|
|
18
|
-
yielded.
|
17
|
+
expect(yielded).to eql true
|
19
18
|
end
|
20
19
|
|
21
|
-
context 'after initial yield' do
|
20
|
+
context 'after initial yield', :time_mock do
|
22
21
|
before do
|
23
|
-
|
22
|
+
@throttle.choke { }
|
24
23
|
end
|
25
24
|
|
26
25
|
it "doesn't yield if period hasn't passed yet" do
|
@@ -29,7 +28,7 @@ describe ProgressBar::Components::Throttle do
|
|
29
28
|
(1..9).each do |t|
|
30
29
|
Timecop.freeze(t) { @throttle.choke { yielded = true } }
|
31
30
|
|
32
|
-
yielded.
|
31
|
+
expect(yielded).to eql false
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
@@ -39,7 +38,7 @@ describe ProgressBar::Components::Throttle do
|
|
39
38
|
(0..25).each do |t|
|
40
39
|
Timecop.freeze(t) { @throttle.choke(true) { yielded += 1 } }
|
41
40
|
|
42
|
-
yielded.
|
41
|
+
expect(yielded).to eql t
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
@@ -48,7 +47,7 @@ describe ProgressBar::Components::Throttle do
|
|
48
47
|
|
49
48
|
Timecop.freeze(15) { @throttle.choke { yielded = true } }
|
50
49
|
|
51
|
-
yielded.
|
50
|
+
expect(yielded).to eql true
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
@@ -64,7 +63,7 @@ describe ProgressBar::Components::Throttle do
|
|
64
63
|
(16..24).each do |t|
|
65
64
|
Timecop.freeze(t) { @throttle.choke { yielded = true } }
|
66
65
|
|
67
|
-
yielded.
|
66
|
+
expect(yielded).to eql false
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
@@ -73,7 +72,7 @@ describe ProgressBar::Components::Throttle do
|
|
73
72
|
|
74
73
|
Timecop.freeze(25) { @throttle.choke { yielded = true } }
|
75
74
|
|
76
|
-
yielded.
|
75
|
+
expect(yielded).to eql true
|
77
76
|
end
|
78
77
|
end
|
79
78
|
end
|
@@ -93,7 +92,7 @@ describe ProgressBar::Components::Throttle do
|
|
93
92
|
(0..25).each do |t|
|
94
93
|
Timecop.freeze(t) { @throttle.choke { yielded += 1 } }
|
95
94
|
|
96
|
-
yielded.
|
95
|
+
expect(yielded).to eql t
|
97
96
|
end
|
98
97
|
end
|
99
98
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspectacular'
|
2
2
|
|
3
3
|
describe ProgressBar::Format::Molecule do
|
4
4
|
describe '#new' do
|
5
5
|
before { @molecule = ProgressBar::Format::Molecule.new('e') }
|
6
6
|
|
7
7
|
it 'sets the key when initialized' do
|
8
|
-
@molecule.key.
|
8
|
+
expect(@molecule.key).to eql 'e'
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'sets the method name when initialized' do
|
12
|
-
@molecule.method_name.
|
12
|
+
expect(@molecule.method_name).to eql :estimated_time_with_unknown_oob
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#bar_molecule?' do
|
17
17
|
it "is true if the molecule's key is a representation of the progress bar graphic" do
|
18
18
|
molecule = ProgressBar::Format::Molecule.new('B')
|
19
|
-
molecule.
|
19
|
+
expect(molecule).to be_bar_molecule
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspectacular'
|
2
2
|
|
3
3
|
describe ProgressBar::RunningAverageCalculator do
|
4
4
|
describe '.calculate' do
|
5
5
|
it 'calculates properly' do
|
6
|
-
ProgressBar::RunningAverageCalculator.calculate(4.5, 12, 0.1).
|
7
|
-
ProgressBar::RunningAverageCalculator.calculate(8.2, 51, 0.7).
|
8
|
-
ProgressBar::RunningAverageCalculator.calculate(41.8, 100, 0.59).
|
6
|
+
expect(ProgressBar::RunningAverageCalculator.calculate(4.5, 12, 0.1)).to be_within(0.001).of 11.25
|
7
|
+
expect(ProgressBar::RunningAverageCalculator.calculate(8.2, 51, 0.7)).to be_within(0.001).of 21.04
|
8
|
+
expect(ProgressBar::RunningAverageCalculator.calculate(41.8, 100, 0.59)).to be_within(0.001).of 65.662
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspectacular'
|
2
2
|
|
3
3
|
class TimeMockedWithTimecop
|
4
4
|
def self.now; end
|
@@ -20,8 +20,7 @@ describe ProgressBar::Time do
|
|
20
20
|
subject { ProgressBar::Time.now ::TimeMockedWithTimecop }
|
21
21
|
|
22
22
|
it 'retrieves the unmocked Timecop time' do
|
23
|
-
::TimeMockedWithTimecop.
|
24
|
-
::TimeMockedWithTimecop.should_not_receive(:now)
|
23
|
+
allow(::TimeMockedWithTimecop).to receive(:now_without_mock_time).once
|
25
24
|
|
26
25
|
subject
|
27
26
|
end
|
@@ -31,8 +30,7 @@ describe ProgressBar::Time do
|
|
31
30
|
subject { ProgressBar::Time.now ::TimeMockedWithDelorean }
|
32
31
|
|
33
32
|
it 'retrieves the unmocked Delorean time' do
|
34
|
-
::TimeMockedWithDelorean.
|
35
|
-
::TimeMockedWithDelorean.should_not_receive(:now)
|
33
|
+
allow(::TimeMockedWithDelorean).to receive(:now_without_delorean).once
|
36
34
|
|
37
35
|
subject
|
38
36
|
end
|
@@ -42,7 +40,7 @@ describe ProgressBar::Time do
|
|
42
40
|
subject { ProgressBar::Time.now ::UnmockedTime }
|
43
41
|
|
44
42
|
it 'will return the actual time' do
|
45
|
-
::UnmockedTime.
|
43
|
+
allow(::UnmockedTime).to receive(:now).once
|
46
44
|
|
47
45
|
subject
|
48
46
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-progressbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- thekompanee
|
@@ -10,64 +9,82 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-
|
12
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- - ~>
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
version: 3.0.0beta
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- - ~>
|
25
|
+
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
27
|
+
version: 3.0.0beta
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspectacular
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.21.6
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.21.6
|
31
42
|
- !ruby/object:Gem::Dependency
|
32
43
|
name: fuubar
|
33
44
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
45
|
requirements:
|
36
|
-
- - ~>
|
46
|
+
- - "~>"
|
37
47
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
48
|
+
version: 2.0beta
|
39
49
|
type: :development
|
40
50
|
prerelease: false
|
41
51
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
52
|
requirements:
|
44
|
-
- - ~>
|
53
|
+
- - "~>"
|
45
54
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
55
|
+
version: 2.0beta
|
47
56
|
- !ruby/object:Gem::Dependency
|
48
57
|
name: timecop
|
49
58
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
59
|
requirements:
|
52
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.6.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.6.0
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: codeclimate-test-reporter
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
53
75
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
76
|
+
version: 0.3.0
|
55
77
|
type: :development
|
56
78
|
prerelease: false
|
57
79
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
80
|
requirements:
|
60
|
-
- - ~>
|
81
|
+
- - "~>"
|
61
82
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
63
|
-
description:
|
64
|
-
for Ruby.
|
65
|
-
|
83
|
+
version: 0.3.0
|
84
|
+
description: |
|
85
|
+
Ruby/ProgressBar is an extremely flexible text progress bar library for Ruby.
|
66
86
|
The output can be customized with a flexible formatting system including:
|
67
|
-
|
68
87
|
percentage, bars of various formats, elapsed time and estimated time remaining.
|
69
|
-
|
70
|
-
'
|
71
88
|
email: support@thekompanee.com
|
72
89
|
executables: []
|
73
90
|
extensions: []
|
@@ -75,26 +92,27 @@ extra_rdoc_files:
|
|
75
92
|
- README.md
|
76
93
|
- LICENSE
|
77
94
|
files:
|
95
|
+
- LICENSE
|
96
|
+
- README.md
|
97
|
+
- lib/ruby-progressbar.rb
|
78
98
|
- lib/ruby-progressbar/base.rb
|
99
|
+
- lib/ruby-progressbar/components.rb
|
79
100
|
- lib/ruby-progressbar/components/bar.rb
|
80
101
|
- lib/ruby-progressbar/components/elapsed_timer.rb
|
81
102
|
- lib/ruby-progressbar/components/estimated_timer.rb
|
82
103
|
- lib/ruby-progressbar/components/progressable.rb
|
104
|
+
- lib/ruby-progressbar/components/rate.rb
|
83
105
|
- lib/ruby-progressbar/components/throttle.rb
|
84
106
|
- lib/ruby-progressbar/components/timer.rb
|
85
|
-
- lib/ruby-progressbar/components.rb
|
86
107
|
- lib/ruby-progressbar/errors/invalid_progress_error.rb
|
108
|
+
- lib/ruby-progressbar/format.rb
|
87
109
|
- lib/ruby-progressbar/format/base.rb
|
88
110
|
- lib/ruby-progressbar/format/molecule.rb
|
89
|
-
- lib/ruby-progressbar/format.rb
|
90
111
|
- lib/ruby-progressbar/formatter.rb
|
91
112
|
- lib/ruby-progressbar/length_calculator.rb
|
92
113
|
- lib/ruby-progressbar/running_average_calculator.rb
|
93
114
|
- lib/ruby-progressbar/time.rb
|
94
115
|
- lib/ruby-progressbar/version.rb
|
95
|
-
- lib/ruby-progressbar.rb
|
96
|
-
- README.md
|
97
|
-
- LICENSE
|
98
116
|
- spec/fixtures/benchmark.rb
|
99
117
|
- spec/lib/ruby-progressbar/base_spec.rb
|
100
118
|
- spec/lib/ruby-progressbar/components/bar_spec.rb
|
@@ -105,33 +123,32 @@ files:
|
|
105
123
|
- spec/lib/ruby-progressbar/format/molecule_spec.rb
|
106
124
|
- spec/lib/ruby-progressbar/running_average_calculator_spec.rb
|
107
125
|
- spec/lib/ruby-progressbar/time_spec.rb
|
108
|
-
- spec/spec_helper.rb
|
109
126
|
- spec/support/time.rb
|
110
127
|
homepage: https://github.com/jfelchner/ruby-progressbar
|
111
|
-
licenses:
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
112
131
|
post_install_message:
|
113
132
|
rdoc_options:
|
114
|
-
- --charset
|
133
|
+
- "--charset"
|
115
134
|
- UTF-8
|
116
135
|
require_paths:
|
117
136
|
- lib
|
118
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
138
|
requirements:
|
121
|
-
- -
|
139
|
+
- - ">="
|
122
140
|
- !ruby/object:Gem::Version
|
123
141
|
version: '0'
|
124
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
143
|
requirements:
|
127
|
-
- -
|
144
|
+
- - ">="
|
128
145
|
- !ruby/object:Gem::Version
|
129
146
|
version: '0'
|
130
147
|
requirements: []
|
131
|
-
rubyforge_project:
|
132
|
-
rubygems_version:
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.2.2
|
133
150
|
signing_key:
|
134
|
-
specification_version:
|
151
|
+
specification_version: 4
|
135
152
|
summary: Ruby/ProgressBar is a flexible text progress bar library for Ruby.
|
136
153
|
test_files:
|
137
154
|
- spec/fixtures/benchmark.rb
|
@@ -144,6 +161,4 @@ test_files:
|
|
144
161
|
- spec/lib/ruby-progressbar/format/molecule_spec.rb
|
145
162
|
- spec/lib/ruby-progressbar/running_average_calculator_spec.rb
|
146
163
|
- spec/lib/ruby-progressbar/time_spec.rb
|
147
|
-
- spec/spec_helper.rb
|
148
164
|
- spec/support/time.rb
|
149
|
-
has_rdoc:
|
data/spec/spec_helper.rb
DELETED