ruby-progressbar 1.7.5 → 1.8.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 +4 -4
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +2 -0
- data/LICENSE.txt +19 -0
- data/README.md +4 -2
- data/lib/ruby-progressbar/base.rb +3 -5
- data/lib/ruby-progressbar/calculators/length.rb +1 -0
- data/lib/ruby-progressbar/components/bar.rb +3 -3
- data/lib/ruby-progressbar/components/time.rb +7 -7
- data/lib/ruby-progressbar/components/title.rb +1 -1
- data/lib/ruby-progressbar/format/molecule.rb +5 -5
- data/lib/ruby-progressbar/outputs/non_tty.rb +1 -1
- data/lib/ruby-progressbar/outputs/tty.rb +2 -2
- data/lib/ruby-progressbar/progress.rb +7 -7
- data/lib/ruby-progressbar/time.rb +18 -13
- data/lib/ruby-progressbar/timer.rb +1 -1
- data/lib/ruby-progressbar/version.rb +2 -2
- data/spec/ruby-progressbar/base_spec.rb +3 -3
- data/spec/ruby-progressbar/calculators/running_average_spec.rb +3 -3
- data/spec/ruby-progressbar/components/bar_spec.rb +3 -3
- data/spec/ruby-progressbar/components/percentage_spec.rb +3 -3
- data/spec/ruby-progressbar/components/rate_spec.rb +3 -3
- data/spec/ruby-progressbar/components/throttle_spec.rb +2 -2
- data/spec/ruby-progressbar/components/time_spec.rb +6 -7
- data/spec/ruby-progressbar/components/title_spec.rb +3 -3
- data/spec/ruby-progressbar/format/formatter_spec.rb +3 -3
- data/spec/ruby-progressbar/format/molecule_spec.rb +3 -3
- data/spec/ruby-progressbar/format/string_spec.rb +3 -3
- data/spec/ruby-progressbar/output_spec.rb +2 -2
- data/spec/ruby-progressbar/outputs/non_tty_spec.rb +3 -3
- data/spec/ruby-progressbar/outputs/tty_spec.rb +3 -3
- data/spec/ruby-progressbar/progress_spec.rb +8 -2
- data/spec/ruby-progressbar/time_spec.rb +18 -10
- data/spec/ruby-progressbar/timer_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/time.rb +2 -6
- metadata +36 -27
- metadata.gz.sig +1 -0
- data/LICENSE +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 606a4e3b06bf9d08347c6c8c01037b5f8ef3bf09
|
|
4
|
+
data.tar.gz: 25c6bab28e08070dd601a4247b286d9d70a9fc52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 967e83539bc0cb7fa68ccd274ef396d8a8e027df2c6c4c072c1063e51b1dbda8ca5bd3fa7af11ba015f758281e7715ca8f5fbc1e03991b5fd05b81d4887230e4
|
|
7
|
+
data.tar.gz: 21b358e4e19060b99490b57bf0ce8f39bc8119c4637030df12e6622e3a18d2771fb02b6a339ade460bb330daf4069c217098edd98a9fd6a9cc21ab92e0988ce0
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2010-2016 The Kompanee, Ltd
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Ruby/ProgressBar
|
|
2
2
|
================================
|
|
3
|
-
[](https://rubygems.org/gems/ruby-progressbar)    [](http://travis-ci.org/jfelchner/ruby-progressbar) [](https://codeclimate.com/github/jfelchner/ruby-progressbar) [](https://codeclimate.com/github/jfelchner/ruby-progressbar)
|
|
4
4
|
|
|
5
5
|
<img src="https://www.dropbox.com/s/pe9o1yobxtubof8/ruby-progressbar-cage.png?dl=1" align="right" />
|
|
6
6
|
|
|
@@ -15,6 +15,8 @@ Full Reference
|
|
|
15
15
|
|
|
16
16
|
There's gotten to be too much awesome to pack into one page. Visit the [wiki](https://github.com/jfelchner/ruby-progressbar/wiki) for the full documentation.
|
|
17
17
|
|
|
18
|
+
Here's a [quick link](https://github.com/jfelchner/ruby-progressbar/wiki/Basic-Usage) to the 'Basic Usage' section.
|
|
19
|
+
|
|
18
20
|
Issues
|
|
19
21
|
--------------------------------
|
|
20
22
|
|
|
@@ -32,5 +34,5 @@ The names and logos for The Kompanee are trademarks of The Kompanee, Ltd.
|
|
|
32
34
|
License
|
|
33
35
|
--------------------------------
|
|
34
36
|
|
|
35
|
-
ruby-progressbar 1.0 is Copyright © 2011-
|
|
37
|
+
ruby-progressbar 1.0 is Copyright © 2011-2016 The Kompanee. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
|
36
38
|
ruby-progressbar 0.9.0 is Copyright © 2008 [Satoru Takabayashi](http://namazu.org/~satoru/)
|
|
@@ -13,7 +13,6 @@ class Base
|
|
|
13
13
|
:progress,
|
|
14
14
|
:total
|
|
15
15
|
|
|
16
|
-
# rubocop:disable Metrics/AbcSize
|
|
17
16
|
def initialize(options = {})
|
|
18
17
|
self.autostart = options.fetch(:autostart, true)
|
|
19
18
|
self.autofinish = options.fetch(:autofinish, true)
|
|
@@ -36,7 +35,6 @@ class Base
|
|
|
36
35
|
|
|
37
36
|
start :at => options[:starting_at] if autostart
|
|
38
37
|
end
|
|
39
|
-
# rubocop:enable Metrics/AbcSize
|
|
40
38
|
|
|
41
39
|
def start(options = {})
|
|
42
40
|
clear
|
|
@@ -77,7 +75,7 @@ class Base
|
|
|
77
75
|
timer.stopped? || finished?
|
|
78
76
|
end
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
alias paused? stopped?
|
|
81
79
|
|
|
82
80
|
def finished?
|
|
83
81
|
finished || (autofinish && progressable.finished?)
|
|
@@ -135,7 +133,7 @@ class Base
|
|
|
135
133
|
end
|
|
136
134
|
end
|
|
137
135
|
|
|
138
|
-
|
|
136
|
+
alias format format=
|
|
139
137
|
|
|
140
138
|
protected
|
|
141
139
|
|
|
@@ -153,7 +151,7 @@ class Base
|
|
|
153
151
|
|
|
154
152
|
def update_progress(*args)
|
|
155
153
|
output.with_refresh do
|
|
156
|
-
progressable.
|
|
154
|
+
progressable.__send__(*args)
|
|
157
155
|
timer.stop if finished?
|
|
158
156
|
end
|
|
159
157
|
end
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
class ProgressBar
|
|
5
5
|
module Components
|
|
6
6
|
class Bar
|
|
7
|
-
DEFAULT_PROGRESS_MARK = '='
|
|
8
|
-
DEFAULT_REMAINDER_MARK = ' '
|
|
9
|
-
DEFAULT_UPA_STEPS = ['=---', '-=--', '--=-', '---=']
|
|
7
|
+
DEFAULT_PROGRESS_MARK = '='.freeze
|
|
8
|
+
DEFAULT_REMAINDER_MARK = ' '.freeze
|
|
9
|
+
DEFAULT_UPA_STEPS = ['=---', '-=--', '--=-', '---='].freeze
|
|
10
10
|
|
|
11
11
|
attr_accessor :progress_mark,
|
|
12
12
|
:remainder_mark,
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
class ProgressBar
|
|
5
5
|
module Components
|
|
6
6
|
class Time
|
|
7
|
-
TIME_FORMAT = '%02d:%02d:%02d'
|
|
8
|
-
OOB_TIME_FORMATS = [:unknown, :friendly, nil]
|
|
7
|
+
TIME_FORMAT = '%02d:%02d:%02d'.freeze
|
|
8
|
+
OOB_TIME_FORMATS = [:unknown, :friendly, nil].freeze
|
|
9
9
|
OOB_LIMIT_IN_HOURS = 99
|
|
10
|
-
OOB_UNKNOWN_TIME_TEXT = '??:??:??'
|
|
11
|
-
OOB_FRIENDLY_TIME_TEXT = '> 4 Days'
|
|
12
|
-
NO_TIME_ELAPSED_TEXT = '--:--:--'
|
|
13
|
-
ESTIMATED_LABEL = ' ETA'
|
|
14
|
-
ELAPSED_LABEL = 'Time'
|
|
10
|
+
OOB_UNKNOWN_TIME_TEXT = '??:??:??'.freeze
|
|
11
|
+
OOB_FRIENDLY_TIME_TEXT = '> 4 Days'.freeze
|
|
12
|
+
NO_TIME_ELAPSED_TEXT = '--:--:--'.freeze
|
|
13
|
+
ESTIMATED_LABEL = ' ETA'.freeze
|
|
14
|
+
ELAPSED_LABEL = 'Time'.freeze
|
|
15
15
|
|
|
16
16
|
def initialize(options = {})
|
|
17
17
|
self.out_of_bounds_time_format = options[:out_of_bounds_time_format]
|
|
@@ -20,9 +20,9 @@ class Molecule
|
|
|
20
20
|
:i => [:bar, :incomplete_space],
|
|
21
21
|
:r => [:rate, :rate_of_change],
|
|
22
22
|
:R => [:rate, :rate_of_change_with_precision],
|
|
23
|
-
}
|
|
23
|
+
}.freeze
|
|
24
24
|
|
|
25
|
-
BAR_MOLECULES = %w{w B b i}
|
|
25
|
+
BAR_MOLECULES = %w{w B b i}.freeze
|
|
26
26
|
|
|
27
27
|
attr_accessor :key,
|
|
28
28
|
:method_name
|
|
@@ -45,12 +45,12 @@ class Molecule
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def lookup_value(environment, length = 0)
|
|
48
|
-
component = environment.
|
|
48
|
+
component = environment.__send__(method_name[0])
|
|
49
49
|
|
|
50
50
|
if bar_molecule?
|
|
51
|
-
component.
|
|
51
|
+
component.__send__(method_name[1], length).to_s
|
|
52
52
|
else
|
|
53
|
-
component.
|
|
53
|
+
component.__send__(method_name[1]).to_s
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -3,9 +3,9 @@ require 'ruby-progressbar/output'
|
|
|
3
3
|
class ProgressBar
|
|
4
4
|
module Outputs
|
|
5
5
|
class Tty < Output
|
|
6
|
-
DEFAULT_FORMAT_STRING = '%t: |%B|'
|
|
6
|
+
DEFAULT_FORMAT_STRING = '%t: |%B|'.freeze
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
alias refresh_with_format_change with_refresh
|
|
9
9
|
|
|
10
10
|
def clear
|
|
11
11
|
stream.print clear_string
|
|
@@ -23,11 +23,11 @@ class Progress
|
|
|
23
23
|
def start(options = {})
|
|
24
24
|
self.running_average = 0
|
|
25
25
|
self.progress = \
|
|
26
|
-
|
|
26
|
+
self.starting_position = options[:at] || progress
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def finish
|
|
30
|
-
self.progress = total
|
|
30
|
+
self.progress = total unless unknown?
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def finished?
|
|
@@ -36,16 +36,16 @@ class Progress
|
|
|
36
36
|
|
|
37
37
|
def increment
|
|
38
38
|
warn "WARNING: Your progress bar is currently at #{progress} out of #{total} " \
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
"and cannot be incremented. In v2.0.0 this will become a " \
|
|
40
|
+
"ProgressBar::InvalidProgressError." if progress == total
|
|
41
41
|
|
|
42
42
|
self.progress += 1 unless progress == total
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def decrement
|
|
46
46
|
warn "WARNING: Your progress bar is currently at #{progress} out of #{total} " \
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
"and cannot be decremented. In v2.0.0 this will become a " \
|
|
48
|
+
"ProgressBar::InvalidProgressError." if progress == 0
|
|
49
49
|
|
|
50
50
|
self.progress -= 1 unless progress == 0
|
|
51
51
|
end
|
|
@@ -101,7 +101,7 @@ class Progress
|
|
|
101
101
|
return 100.0 if total == 0
|
|
102
102
|
return 0.0 if total.nil?
|
|
103
103
|
|
|
104
|
-
'%5.2f' % [(progress
|
|
104
|
+
'%5.2f' % [(progress * 100 / total.to_f * 100).floor / 100.0]
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def absolute
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
class ProgressBar
|
|
2
2
|
class Time
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
TIME_MOCKING_LIBRARY_METHODS = [
|
|
4
|
+
:__simple_stub__now, # ActiveSupport
|
|
5
|
+
:now_without_mock_time, # Timecop
|
|
6
|
+
:now_without_delorean, # Delorean
|
|
7
|
+
:now # Actual
|
|
8
|
+
].freeze
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
def initialize(time = ::Time)
|
|
11
|
+
self.time = time
|
|
7
12
|
end
|
|
8
13
|
|
|
9
|
-
def
|
|
14
|
+
def now
|
|
15
|
+
time.__send__ unmocked_time_method
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def unmocked_time_method
|
|
10
19
|
@unmocked_time_method ||= begin
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
TIME_MOCKING_LIBRARY_METHODS.find do |method|
|
|
21
|
+
time.respond_to? method
|
|
13
22
|
end
|
|
14
23
|
end
|
|
15
24
|
end
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
:now_without_delorean, # Delorean
|
|
21
|
-
:now # Actual
|
|
22
|
-
]
|
|
23
|
-
end
|
|
26
|
+
protected
|
|
27
|
+
|
|
28
|
+
attr_accessor :time
|
|
24
29
|
end
|
|
25
30
|
end
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
class
|
|
2
|
-
VERSION = '1.
|
|
1
|
+
class ProgressBar
|
|
2
|
+
VERSION = '1.8.0'.freeze
|
|
3
3
|
end
|
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
|
2
2
|
require 'support/time'
|
|
3
3
|
require 'stringio'
|
|
4
4
|
|
|
5
|
-
# rubocop:disable Metrics/LineLength
|
|
6
|
-
describe ProgressBar::Base do
|
|
5
|
+
# rubocop:disable Metrics/LineLength, Style/UnneededInterpolation, Performance/EndWith
|
|
6
|
+
RSpec.describe ProgressBar::Base do
|
|
7
7
|
let(:output) do
|
|
8
8
|
StringIO.new('', 'w+').tap do |io|
|
|
9
9
|
allow(io).to receive(:tty?).and_return true
|
|
@@ -418,7 +418,7 @@ describe ProgressBar::Base do
|
|
|
418
418
|
end
|
|
419
419
|
|
|
420
420
|
context 'when a bar is started' do
|
|
421
|
-
let(:progressbar) { ProgressBar::Base.new(:starting_at => 0, :total => 100, :output => output, :length => 80, :throttle_rate
|
|
421
|
+
let(:progressbar) { ProgressBar::Base.new(:starting_at => 0, :total => 100, :output => output, :length => 80, :throttle_rate => 0.0) }
|
|
422
422
|
|
|
423
423
|
context 'and it is incremented any number of times' do
|
|
424
424
|
before { 10.times { progressbar.increment } }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/calculators/running_average'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
module
|
|
6
|
-
describe RunningAverage do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
module Calculators
|
|
6
|
+
RSpec.describe RunningAverage do
|
|
7
7
|
it 'can properly calculate a running average' do
|
|
8
8
|
first_average = RunningAverage.calculate(4.5, 12, 0.1)
|
|
9
9
|
expect(first_average).to be_within(0.001).of 11.25
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/components/bar'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
module
|
|
6
|
-
describe Bar do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
module Components
|
|
6
|
+
RSpec.describe Bar do
|
|
7
7
|
it 'has a default mark when a new bar is created and no parameters are passed' do
|
|
8
8
|
expect(Bar.new.progress_mark).to eql Bar::DEFAULT_PROGRESS_MARK
|
|
9
9
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/progress'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
describe Throttle do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
RSpec.describe Throttle do
|
|
6
6
|
let(:timer) { ProgressBar::Timer.new(:time => ::Time) }
|
|
7
7
|
|
|
8
8
|
it 'yields the first time if the throttle rate is given and the timer is not started' do
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/components/time'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
module
|
|
6
|
-
describe Time do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
module Components
|
|
6
|
+
RSpec.describe Time do
|
|
7
7
|
let(:timer) { Timer.new(:time => ::Time) }
|
|
8
8
|
|
|
9
9
|
it 'displays an unknown estimated time remaining when the timer has been started ' \
|
|
@@ -226,7 +226,8 @@ describe Time do
|
|
|
226
226
|
' ETA: 00:00:01',
|
|
227
227
|
' ETA: 00:00:01',
|
|
228
228
|
' ETA: 00:00:00',
|
|
229
|
-
]
|
|
229
|
+
]
|
|
230
|
+
)
|
|
230
231
|
end
|
|
231
232
|
|
|
232
233
|
it 'displays unknown elapsed time when the timer has not been started' do
|
|
@@ -297,9 +298,7 @@ describe Time do
|
|
|
297
298
|
end
|
|
298
299
|
|
|
299
300
|
it 'raises an exception when an invalid out of bounds time format is specified' do
|
|
300
|
-
expect
|
|
301
|
-
Time.new(:out_of_bounds_time_format => :foo)
|
|
302
|
-
end.
|
|
301
|
+
expect { Time.new(:out_of_bounds_time_format => :foo) }.
|
|
303
302
|
to raise_error 'Invalid Out Of Bounds time format. Valid formats are ' \
|
|
304
303
|
'[:unknown, :friendly, nil]'
|
|
305
304
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/components/title'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
module
|
|
6
|
-
describe Title do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
module Components
|
|
6
|
+
RSpec.describe Title do
|
|
7
7
|
it 'can use the default title if none is specified' do
|
|
8
8
|
expect(Title.new.title).to eql Title::DEFAULT_TITLE
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/format/molecule'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
module
|
|
6
|
-
describe Molecule do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
module Format
|
|
6
|
+
RSpec.describe Molecule do
|
|
7
7
|
it 'sets the key when initialized' do
|
|
8
8
|
molecule = Molecule.new('t')
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'rspectacular'
|
|
2
2
|
require 'ruby-progressbar/progress'
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
describe Progress do
|
|
4
|
+
class ProgressBar
|
|
5
|
+
RSpec.describe Progress do
|
|
6
6
|
it 'knows the default total when no parameters are passed' do
|
|
7
7
|
progress = Progress.new
|
|
8
8
|
|
|
@@ -37,6 +37,12 @@ describe Progress do
|
|
|
37
37
|
expect(progress.progress).to eql 10
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
it 'knows how to finish itself even if the total is unknown' do
|
|
41
|
+
progress = Progress.new :total => nil
|
|
42
|
+
|
|
43
|
+
expect(progress.finish).to be_nil
|
|
44
|
+
end
|
|
45
|
+
|
|
40
46
|
it 'knows the overridden total when the total is passed in' do
|
|
41
47
|
progress = Progress.new(:total => 12,
|
|
42
48
|
:progress_mark => 'x',
|
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
class TimeMockedWithTimecop
|
|
4
|
-
def self.now; end
|
|
5
4
|
def self.now_without_mock_time; end
|
|
6
5
|
end
|
|
7
6
|
|
|
8
7
|
class TimeMockedWithDelorean
|
|
9
|
-
def self.now; end
|
|
10
8
|
def self.now_without_delorean; end
|
|
11
9
|
end
|
|
12
10
|
|
|
11
|
+
class TimeMockedWithActiveSupport
|
|
12
|
+
def self.__simple_stub__now; end
|
|
13
|
+
end
|
|
14
|
+
|
|
13
15
|
class UnmockedTime
|
|
14
16
|
def self.now; end
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
class
|
|
18
|
-
describe Time do
|
|
19
|
+
class ProgressBar
|
|
20
|
+
RSpec.describe Time do
|
|
19
21
|
it 'when Time is being mocked by Timecop retrieves the unmocked Timecop time' do
|
|
20
|
-
|
|
22
|
+
expect(TimeMockedWithTimecop).to receive(:now_without_mock_time).once
|
|
21
23
|
|
|
22
|
-
Time.
|
|
24
|
+
Time.new(TimeMockedWithTimecop).now
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
it 'when Time is being mocked by Delorean retrieves the unmocked Delorean time' do
|
|
26
|
-
|
|
28
|
+
expect(TimeMockedWithDelorean).to receive(:now_without_delorean).once
|
|
29
|
+
|
|
30
|
+
Time.new(TimeMockedWithDelorean).now
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'when Time is being mocked by ActiveSupport retrieves the unmocked time' do
|
|
34
|
+
expect(TimeMockedWithActiveSupport).to receive(:__simple_stub__now).once
|
|
27
35
|
|
|
28
|
-
Time.
|
|
36
|
+
Time.new(TimeMockedWithActiveSupport).now
|
|
29
37
|
end
|
|
30
38
|
|
|
31
39
|
it 'when Time is not being mocked will return the actual time' do
|
|
32
|
-
|
|
40
|
+
expect(UnmockedTime).to receive(:now).once
|
|
33
41
|
|
|
34
|
-
Time.
|
|
42
|
+
Time.new(UnmockedTime).now
|
|
35
43
|
end
|
|
36
44
|
end
|
|
37
45
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/time.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-progressbar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thekompanee
|
|
8
8
|
- jfelchner
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
|
-
cert_chain:
|
|
12
|
-
|
|
11
|
+
cert_chain:
|
|
12
|
+
- |
|
|
13
|
+
-----BEGIN CERTIFICATE-----
|
|
14
|
+
MIIDrjCCApagAwIBAgIBATANBgkqhkiG9w0BAQUFADBOMRowGAYDVQQDDBFhY2Nv
|
|
15
|
+
dW50c19ydWJ5Z2VtczEbMBkGCgmSJomT8ixkARkWC3RoZWtvbXBhbmVlMRMwEQYK
|
|
16
|
+
CZImiZPyLGQBGRYDY29tMB4XDTE2MDQyNDAyNTEyM1oXDTE3MDQyNDAyNTEyM1ow
|
|
17
|
+
TjEaMBgGA1UEAwwRYWNjb3VudHNfcnVieWdlbXMxGzAZBgoJkiaJk/IsZAEZFgt0
|
|
18
|
+
aGVrb21wYW5lZTETMBEGCgmSJomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEB
|
|
19
|
+
BQADggEPADCCAQoCggEBANklzdaVeHtut6LTe/hrl6Krz2Z60InEbNb+TMG43tww
|
|
20
|
+
jBpWZrdU/SBkR3EYbTAQv/yGTuMHoVKGK2kDlFvdofW2hX0d14qPyYJUNYt+7VWE
|
|
21
|
+
3UhPSxw1i6MxeU1QwfkIyaN8A5lj0225+rwI/mbplv+lSXPlJEroCQ9EfniZD4jL
|
|
22
|
+
URlrHWl/UejcQ32C1IzBwth3+nacrO1197v5nSdozFzQwm4groaggXn9F/WpThu+
|
|
23
|
+
MhcE4bfttwEjAfU3zAThyzOFoVPpACP+SwOuyPJSl02+9BiwzeAnFJDfge7+rsd5
|
|
24
|
+
64W/VzBIklEKUZMmxZwr5DwpSXLrknBDtHLABG9Nr3cCAwEAAaOBljCBkzAJBgNV
|
|
25
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUP7v0f/qfa0LMrhkzHRI3l10X
|
|
26
|
+
LYIwLAYDVR0RBCUwI4EhYWNjb3VudHMrcnVieWdlbXNAdGhla29tcGFuZWUuY29t
|
|
27
|
+
MCwGA1UdEgQlMCOBIWFjY291bnRzK3J1YnlnZW1zQHRoZWtvbXBhbmVlLmNvbTAN
|
|
28
|
+
BgkqhkiG9w0BAQUFAAOCAQEASqdfJKMun1twosHfvdDH7Vgrb5VqX28qJ6MgnhjF
|
|
29
|
+
p+3HYTjYo/KMQqu78TegUFO5xQ4oumU0FTXADW0ryXZvUGV74M0zwqpFqeo8onII
|
|
30
|
+
lsVsWdMCLZS21M0uCQmcV+OQMNxL8jV3c0D3x9Srr9yO4oamW3seIdb+b9RfhmV2
|
|
31
|
+
ryr+NH8U/4xgzdJ4hWV4qk93nwigp4lwJ4u93XJ7Cdyw7itvaEPnn8HpCfzsiLcw
|
|
32
|
+
QwSfDGz6+zsImi5N3UT71+mk7YcviQSgvMRl3VkAv8MZ6wcJ5SQRpf9w0OeFH6Ln
|
|
33
|
+
nNbCoHiYeXX/lz/M6AIbxDIZZTwxcyvF7bdrQ2fbH5MsfQ==
|
|
34
|
+
-----END CERTIFICATE-----
|
|
35
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
|
13
36
|
dependencies:
|
|
14
37
|
- !ruby/object:Gem::Dependency
|
|
15
38
|
name: rspec
|
|
@@ -17,28 +40,28 @@ dependencies:
|
|
|
17
40
|
requirements:
|
|
18
41
|
- - "~>"
|
|
19
42
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '3.
|
|
43
|
+
version: '3.2'
|
|
21
44
|
type: :development
|
|
22
45
|
prerelease: false
|
|
23
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
47
|
requirements:
|
|
25
48
|
- - "~>"
|
|
26
49
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '3.
|
|
50
|
+
version: '3.2'
|
|
28
51
|
- !ruby/object:Gem::Dependency
|
|
29
52
|
name: rspectacular
|
|
30
53
|
requirement: !ruby/object:Gem::Requirement
|
|
31
54
|
requirements:
|
|
32
55
|
- - "~>"
|
|
33
56
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 0.
|
|
57
|
+
version: 0.70.6
|
|
35
58
|
type: :development
|
|
36
59
|
prerelease: false
|
|
37
60
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
61
|
requirements:
|
|
39
62
|
- - "~>"
|
|
40
63
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: 0.
|
|
64
|
+
version: 0.70.6
|
|
42
65
|
- !ruby/object:Gem::Dependency
|
|
43
66
|
name: fuubar
|
|
44
67
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -71,30 +94,16 @@ dependencies:
|
|
|
71
94
|
name: timecop
|
|
72
95
|
requirement: !ruby/object:Gem::Requirement
|
|
73
96
|
requirements:
|
|
74
|
-
- -
|
|
97
|
+
- - '='
|
|
75
98
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: 0.6.
|
|
99
|
+
version: 0.6.1
|
|
77
100
|
type: :development
|
|
78
101
|
prerelease: false
|
|
79
102
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
103
|
requirements:
|
|
81
|
-
- -
|
|
82
|
-
- !ruby/object:Gem::Version
|
|
83
|
-
version: 0.6.0
|
|
84
|
-
- !ruby/object:Gem::Dependency
|
|
85
|
-
name: codeclimate-test-reporter
|
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
|
87
|
-
requirements:
|
|
88
|
-
- - "~>"
|
|
89
|
-
- !ruby/object:Gem::Version
|
|
90
|
-
version: 0.3.0
|
|
91
|
-
type: :development
|
|
92
|
-
prerelease: false
|
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
-
requirements:
|
|
95
|
-
- - "~>"
|
|
104
|
+
- - '='
|
|
96
105
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 0.
|
|
106
|
+
version: 0.6.1
|
|
98
107
|
description: |
|
|
99
108
|
Ruby/ProgressBar is an extremely flexible text progress bar library for Ruby.
|
|
100
109
|
The output can be customized with a flexible formatting system including:
|
|
@@ -104,7 +113,7 @@ executables: []
|
|
|
104
113
|
extensions: []
|
|
105
114
|
extra_rdoc_files: []
|
|
106
115
|
files:
|
|
107
|
-
- LICENSE
|
|
116
|
+
- LICENSE.txt
|
|
108
117
|
- README.md
|
|
109
118
|
- Rakefile
|
|
110
119
|
- lib/ruby-progressbar.rb
|
|
@@ -171,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
180
|
version: '0'
|
|
172
181
|
requirements: []
|
|
173
182
|
rubyforge_project:
|
|
174
|
-
rubygems_version: 2.
|
|
183
|
+
rubygems_version: 2.5.1
|
|
175
184
|
signing_key:
|
|
176
185
|
specification_version: 4
|
|
177
186
|
summary: Ruby/ProgressBar is a flexible text progress bar library for Ruby.
|
metadata.gz.sig
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
q7�r?-z��� ���H���||py�Q��Y��B�|b�1���V�dQO�N���/0�7!�{k���2N *���R��kc��fq��в���a*��=�M`�fg�(ȫ1� )�R�h�;����p�w�ĩ���`��1�.K���d�
|
data/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2011 The Kompanee - Jeff Felchner
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|