progress 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.rubocop.yml +13 -1
- data/.travis.yml +1 -2
- data/README.markdown +1 -1
- data/lib/progress/beeper.rb +2 -2
- data/lib/progress/class_methods.rb +2 -2
- data/lib/progress/with_progress.rb +8 -6
- data/progress.gemspec +2 -2
- data/spec/progress_spec.rb +8 -0
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NWJkMDUyYmIyOTg3MzM5NGViMWVmMDRkYTk0ZTYyMGI0ZTNhN2EyZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c00acbc8425bb23667a673353ddd47b7be8ec83c
|
4
|
+
data.tar.gz: f8ddbf3d1bd749a58dc127ba8e2eff03dc47b8ab
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YWM0ZTQ3MmUzNGUxZWMzNDNiNzIzZTA2NDM0ZDEzZTVlYWNlOWY0MjRjOWJl
|
11
|
-
Nzg0N2ZiZjA5ZTU1MjlkMTZkZDNhZTBiOGE4YWJhNzNhZGVmNjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZjJiYzE4OTY4YmM0OThhYzMwNGE2YmRjZTQ5MmM4MzFhZWIyNzVjM2U5YTg5
|
14
|
-
ZGFmMjUxZThkNjA4MzhiNjFiZmZjNDk4YzA5MDcxZjRlZmQ4NzdjYThkMDg5
|
15
|
-
YTIwM2QwZTJkOWNkYzJhNGYyNWNkMDY2NmRiMGViZWM5MjI2ODI=
|
6
|
+
metadata.gz: 34afc9915d5e631a10d120e5e165a5520a31606080aa54303ff3fa7f0ddb2ee2b3badf8fee08140cc170bc9117cc58d5bafd7c8a311ab335a6f7b0d49af09bf7
|
7
|
+
data.tar.gz: 15520d62ffbcade6b38fb17b318e73587318668f15c7036538c40b0e5852d2eab35a477a5b21aeea6c7fe71ed12ccf3dc7fa6778d3d6ca708ef50ab47354bb37
|
data/.rubocop.yml
CHANGED
@@ -26,6 +26,9 @@ Metrics/PerceivedComplexity:
|
|
26
26
|
Style/AccessModifierIndentation:
|
27
27
|
EnforcedStyle: outdent
|
28
28
|
|
29
|
+
Style/Alias:
|
30
|
+
EnforcedStyle: prefer_alias_method
|
31
|
+
|
29
32
|
Style/BracesAroundHashParameters:
|
30
33
|
Enabled: false
|
31
34
|
|
@@ -38,6 +41,9 @@ Style/DotPosition:
|
|
38
41
|
Style/DoubleNegation:
|
39
42
|
Enabled: false
|
40
43
|
|
44
|
+
Style/EmptyCaseCondition:
|
45
|
+
Enabled: false
|
46
|
+
|
41
47
|
Style/Encoding:
|
42
48
|
EnforcedStyle: when_needed
|
43
49
|
|
@@ -50,6 +56,9 @@ Style/IfUnlessModifier:
|
|
50
56
|
Style/IndentHash:
|
51
57
|
EnforcedStyle: consistent
|
52
58
|
|
59
|
+
Style/NumericPredicate:
|
60
|
+
Enabled: false
|
61
|
+
|
53
62
|
Style/ParallelAssignment:
|
54
63
|
Enabled: false
|
55
64
|
|
@@ -67,5 +76,8 @@ Style/SpaceBeforeBlockBraces:
|
|
67
76
|
Style/SpaceInsideHashLiteralBraces:
|
68
77
|
EnforcedStyle: no_space
|
69
78
|
|
70
|
-
Style/
|
79
|
+
Style/TrailingCommaInArguments:
|
80
|
+
EnforcedStyleForMultiline: no_comma
|
81
|
+
|
82
|
+
Style/TrailingCommaInLiteral:
|
71
83
|
EnforcedStyleForMultiline: comma
|
data/.travis.yml
CHANGED
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Build Status](https://img.shields.io/travis/toy/progress/master.svg?style=flat)](https://travis-ci.org/toy/progress)
|
3
3
|
[![Code Climate](https://img.shields.io/codeclimate/github/toy/progress.svg?style=flat)](https://codeclimate.com/github/toy/progress)
|
4
4
|
[![Dependency Status](https://img.shields.io/gemnasium/toy/progress.svg?style=flat)](https://gemnasium.com/toy/progress)
|
5
|
-
[![Inch CI](
|
5
|
+
[![Inch CI](https://inch-ci.org/github/toy/progress.svg?branch=master&style=flat)](https://inch-ci.org/github/toy/progress)
|
6
6
|
|
7
7
|
# progress
|
8
8
|
|
data/lib/progress/beeper.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
class Progress
|
2
2
|
# Repeatedly run block of code after time interval
|
3
3
|
class Beeper
|
4
|
-
def initialize(time
|
4
|
+
def initialize(time)
|
5
5
|
@thread = Thread.new do
|
6
6
|
loop do
|
7
7
|
@skip = false
|
8
8
|
sleep time
|
9
|
-
|
9
|
+
yield unless @skip
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -30,15 +30,17 @@ class Progress
|
|
30
30
|
super
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def respond_to_missing?(method, include_private = false)
|
34
34
|
enumerable_method?(method) || super
|
35
35
|
end
|
36
36
|
|
37
|
+
alias_method :respond_to?, :respond_to_missing? if RUBY_VERSION < '1.9'
|
38
|
+
|
37
39
|
def method_missing(method, *args, &block)
|
38
40
|
if enumerable_method?(method)
|
39
41
|
run(method, *args, &block)
|
40
42
|
else
|
41
|
-
super
|
43
|
+
super
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -97,22 +99,22 @@ class Progress
|
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
100
|
-
def run_with_length(enum, length, method, *args
|
102
|
+
def run_with_length(enum, length, method, *args)
|
101
103
|
Progress.start(@title, length) do
|
102
104
|
enum.send(method, *args) do |*block_args|
|
103
105
|
Progress.step do
|
104
|
-
|
106
|
+
yield(*block_args)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
110
|
-
def run_with_pos(io, method, *args
|
112
|
+
def run_with_pos(io, method, *args)
|
111
113
|
size = io.respond_to?(:size) ? io.size : io.stat.size
|
112
114
|
Progress.start(@title, size) do
|
113
115
|
io.send(method, *args) do |*block_args|
|
114
116
|
Progress.set(io.pos) do
|
115
|
-
|
117
|
+
yield(*block_args)
|
116
118
|
end
|
117
119
|
end
|
118
120
|
end
|
data/progress.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'progress'
|
5
|
-
s.version = '3.
|
5
|
+
s.version = '3.2.0'
|
6
6
|
s.summary = %q{Show progress of long running tasks}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_paths = %w[lib]
|
17
17
|
|
18
18
|
s.add_development_dependency 'rspec', '~> 3.0'
|
19
|
-
if
|
19
|
+
if RUBY_VERSION >= '2.0'
|
20
20
|
s.add_development_dependency 'rubocop', '~> 0.27'
|
21
21
|
end
|
22
22
|
end
|
data/spec/progress_spec.rb
CHANGED
@@ -49,6 +49,14 @@ describe Progress do
|
|
49
49
|
end).to eq([[1, 2, 3], [2, 4, 6], [3, 6, 9]])
|
50
50
|
end
|
51
51
|
|
52
|
+
it 'checks respond_to? methods of self and of Enumerable' do
|
53
|
+
with_progress = [1, 2, 3].with_progress
|
54
|
+
|
55
|
+
([:each, :with_progress] + Enumerable.instance_methods).each do |method|
|
56
|
+
expect(with_progress).to respond_to(method)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
52
60
|
it 'does not raise errors on extra step or stop' do
|
53
61
|
expect do
|
54
62
|
3.times_with_progress do
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: progress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.27'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.27'
|
41
41
|
description:
|
@@ -44,9 +44,9 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
- .gitignore
|
48
|
-
- .rubocop.yml
|
49
|
-
- .travis.yml
|
47
|
+
- ".gitignore"
|
48
|
+
- ".rubocop.yml"
|
49
|
+
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.markdown
|
@@ -72,21 +72,20 @@ require_paths:
|
|
72
72
|
- lib
|
73
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project: progress
|
85
|
-
rubygems_version: 2.4
|
85
|
+
rubygems_version: 2.6.4
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Show progress of long running tasks
|
89
89
|
test_files:
|
90
90
|
- spec/progress_spec.rb
|
91
91
|
- spec/test.csv
|
92
|
-
has_rdoc:
|