progress 3.5.1 → 3.5.2

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
  SHA256:
3
- metadata.gz: d9c6656ecc53abb76bdb2dab90d3edcab0ee8ab7d44be05ac3107365a5b410db
4
- data.tar.gz: fc6183213347b561fa6e8c05ded7100df53850c215974c3daaebad5e90e5ea62
3
+ metadata.gz: 968512bbd9522d70ff093587d4ec2f75a82b8cfe3af204bbec0ccf461474ffa4
4
+ data.tar.gz: df95743ec5de95729873bc5afa3ffd7e507bd4f515b0918287cf69d1a3b70c07
5
5
  SHA512:
6
- metadata.gz: eea0fea5cac40f654272d8e0250b310f136bad26b5aa4fdac811c673a51829d9397e1d84a4498657daa050744478fe4c707e96563017c2636df080f2f7d7a1d2
7
- data.tar.gz: f1d3cf03b6b24311fca2f852e248b741f9a05b68790b8f71d4842b483755c7eb5bc362c921c4bf13732d9882bc8f4ba4cd99428de72241466d7da164ea84adb3
6
+ metadata.gz: 7767fac01705f63d745a64aa352aa9ce4afa998d33874967ddf397c912629f3b0a2b288bdab80c97123ff90be7432e43053301a643da47e2ab88d17359d16ad0
7
+ data.tar.gz: 8c1b6a5e2be195328dc59c15b5d9acdd3ed9bd93d76ca4c60301d9a33857174b45a8e78aa0c9b2e5a688fad0577f133a821fffac818bd00e71184d463495b8b7
@@ -1,4 +1,5 @@
1
1
  sudo: false
2
+ dist: trusty
2
3
  language: ruby
3
4
  before_install:
4
5
  - gem install bundler || gem install bundler --version '< 2'
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v3.5.2 (2019-07-14)
6
+
7
+ * Remove deprecated `rubyforge_project` attribute from gemspec [rubygems/rubygems#2436](https://github.com/rubygems/rubygems/pull/2436) [@toy](https://github.com/toy)
8
+
5
9
  ## v3.5.1 (2019-05-25)
6
10
 
7
11
  * Enable frozen string literals [@toy](https://github.com/toy)
@@ -14,126 +14,152 @@ Show progress during console script run.
14
14
 
15
15
  ## Usage
16
16
 
17
- 1000.times_with_progress('Counting to 1000') do |i|
18
- # do something with i
19
- end
17
+ ```ruby
18
+ 1000.times_with_progress('Counting to 1000') do |i|
19
+ # do something with i
20
+ end
21
+ ```
20
22
 
21
23
  or without title:
22
24
 
23
- 1000.times_with_progress do |i|
24
- # do something with i
25
- end
25
+ ```ruby
26
+ 1000.times_with_progress do |i|
27
+ # do something with i
28
+ end
29
+ ```
26
30
 
27
31
  With array:
28
32
 
29
- [1, 2, 3].with_progress('1…2…3').each do |i|
30
- # still counting
31
- end
33
+ ```ruby
34
+ [1, 2, 3].with_progress('1…2…3').each do |i|
35
+ # still counting
36
+ end
37
+ ```
32
38
 
33
39
  `.each` is optional:
34
40
 
35
- [1, 2, 3].with_progress('1…2…3') do |i|
36
- # =||=
37
- end
41
+ ```ruby
42
+ [1, 2, 3].with_progress('1…2…3') do |i|
43
+ # =||=
44
+ end
45
+ ```
38
46
 
39
47
  Nested progress
40
48
 
41
- (1..10).with_progress('Outer').map do |a|
42
- (1..10).with_progress('Middle').map do |b|
43
- (1..10).with_progress('Inner').map do |c|
44
- # do something with a, b and c
45
- end
46
- end
49
+ ```ruby
50
+ (1..10).with_progress('Outer').map do |a|
51
+ (1..10).with_progress('Middle').map do |b|
52
+ (1..10).with_progress('Inner').map do |c|
53
+ # do something with a, b and c
47
54
  end
55
+ end
56
+ end
57
+ ```
48
58
 
49
59
  You can also show note:
50
60
 
51
- [1, 2, 3].with_progress do |i|
52
- Progress.note = i
53
- sleep 5
54
- end
61
+ ```ruby
62
+ [1, 2, 3].with_progress do |i|
63
+ Progress.note = i
64
+ sleep 5
65
+ end
66
+ ```
55
67
 
56
68
  You can use any enumerable method:
57
69
 
58
- [1, 2, 3].with_progress.map{ |i| 'do stuff' }
59
- [1, 2, 3].with_progress.each_cons(3){ |i| 'do stuff' }
60
- [1, 2, 3].with_progress.each_slice(2){ |i| 'do stuff' }
61
- #
70
+ ```ruby
71
+ [1, 2, 3].with_progress.map{ |i| 'do stuff' }
72
+ [1, 2, 3].with_progress.each_cons(3){ |i| 'do stuff' }
73
+ [1, 2, 3].with_progress.each_slice(2){ |i| 'do stuff' }
74
+ # …
75
+ ```
62
76
 
63
77
  Any enumerable will work:
64
78
 
65
- (1..100).with_progress('Wait') do |i|
66
- # ranges are good
67
- end
79
+ ```ruby
80
+ (1..100).with_progress('Wait') do |i|
81
+ # ranges are good
82
+ end
68
83
 
69
- Dir.new('.').with_progress do |path|
70
- # check path
71
- end
84
+ Dir.new('.').with_progress do |path|
85
+ # check path
86
+ end
87
+ ```
72
88
 
73
89
  NOTE: progress gets number of objects using `length`, `size`, `to_a.length` or just `inject` and if used on objects which needs rewind (like opened File), cycle itself will not work.
74
90
 
75
91
  Use simple blocks:
76
92
 
77
- symbols = []
78
- Progress.start('Input 100 symbols', 100) do
79
- while symbols.length < 100
80
- input = gets.scan(/\S/)
81
- symbols += input
82
- Progress.step input.length
83
- end
84
- end
93
+ ```ruby
94
+ symbols = []
95
+ Progress.start('Input 100 symbols', 100) do
96
+ while symbols.length < 100
97
+ input = gets.scan(/\S/)
98
+ symbols += input
99
+ Progress.step input.length
100
+ end
101
+ end
102
+ ```
85
103
 
86
104
  or just
87
105
 
88
- symbols = []
89
- Progress('Input 100 symbols', 100) do
90
- while symbols.length < 100
91
- input = gets.scan(/\S/)
92
- symbols += input
93
- Progress.step input.length
94
- end
95
- end
106
+ ```ruby
107
+ symbols = []
108
+ Progress('Input 100 symbols', 100) do
109
+ while symbols.length < 100
110
+ input = gets.scan(/\S/)
111
+ symbols += input
112
+ Progress.step input.length
113
+ end
114
+ end
115
+ ```
96
116
 
97
117
  NOTE: you will get WRONG progress if you use something like this:
98
118
 
99
- 10.times_with_progress('A') do |time|
100
- 10.times_with_progress('B') do
101
- # code
102
- end
103
- 10.times_with_progress('C') do
104
- # code
105
- end
106
- end
119
+ ```ruby
120
+ 10.times_with_progress('A') do |time|
121
+ 10.times_with_progress('B') do
122
+ # code
123
+ end
124
+ 10.times_with_progress('C') do
125
+ # code
126
+ end
127
+ end
128
+ ```
107
129
 
108
130
  But you can use this:
109
131
 
110
- 10.times_with_progress('A') do |time|
111
- Progress.step 5 do
112
- 10.times_with_progress('B') do
113
- # code
114
- end
115
- end
116
- Progress.step 5 do
117
- 10.times_with_progress('C') do
118
- # code
119
- end
120
- end
132
+ ```ruby
133
+ 10.times_with_progress('A') do |time|
134
+ Progress.step 5 do
135
+ 10.times_with_progress('B') do
136
+ # code
137
+ end
138
+ end
139
+ Progress.step 5 do
140
+ 10.times_with_progress('C') do
141
+ # code
121
142
  end
143
+ end
144
+ end
145
+ ```
122
146
 
123
147
  Or if you know that B runs 9 times faster than C:
124
148
 
125
- 10.times_with_progress('A') do |time|
126
- Progress.step 1 do
127
- 10.times_with_progress('B') do
128
- # code
129
- end
130
- end
131
- Progress.step 9 do
132
- 10.times_with_progress('C') do
133
- # code
134
- end
135
- end
149
+ ```ruby
150
+ 10.times_with_progress('A') do |time|
151
+ Progress.step 1 do
152
+ 10.times_with_progress('B') do
153
+ # code
154
+ end
155
+ end
156
+ Progress.step 9 do
157
+ 10.times_with_progress('C') do
158
+ # code
136
159
  end
160
+ end
161
+ end
162
+ ```
137
163
 
138
164
  ## Copyright
139
165
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'progress'
5
- s.version = '3.5.1'
5
+ s.version = '3.5.2'
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']
@@ -10,8 +10,6 @@ Gem::Specification.new do |s|
10
10
 
11
11
  s.required_ruby_version = '>= 1.9.3'
12
12
 
13
- s.rubyforge_project = s.name
14
-
15
13
  s.metadata = {
16
14
  'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
17
15
  'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-25 00:00:00.000000000 Z
11
+ date: 2019-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -69,7 +69,7 @@ licenses:
69
69
  metadata:
70
70
  bug_tracker_uri: https://github.com/toy/progress/issues
71
71
  changelog_uri: https://github.com/toy/progress/blob/master/CHANGELOG.markdown
72
- documentation_uri: https://www.rubydoc.info/gems/progress/3.5.1
72
+ documentation_uri: https://www.rubydoc.info/gems/progress/3.5.2
73
73
  source_code_uri: https://github.com/toy/progress
74
74
  post_install_message:
75
75
  rdoc_options: []