progress 3.3.2 → 3.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64ca0726e8a2eb5bfd62828a9f9aeec7b0fc49b5
4
- data.tar.gz: e7b15fed0cb040c622fc381a4922fd697c071ad5
3
+ metadata.gz: ed83a839d83aa17fc079ed2a5d16c5fa2b9c4d07
4
+ data.tar.gz: 419b4c459474fd7b8f73c325006bc9d33a30c25d
5
5
  SHA512:
6
- metadata.gz: cda7bef90d61b0eed3af7397af5d2dc8a00fb8f2bf52539feef2edd9a5efc1d99ea9ea85d71465b8145f3fffad87cbe2ae43cc51ae3975f9475c681e110e647e
7
- data.tar.gz: c20fd466c9d7a061035d4450a9c046d472f58c2bf43e49509c11717e9380bb28e04703aa8abcd810c1aeb8a2120ce6aabcd7083d9478a113c01329633c534c8e
6
+ metadata.gz: c98e8c3477ca6a71b7de133afec93bf1fcfeaa53924f7dca5369b1b808f2aca9b5ce14faf19a889677245b21d8deeea9d9d0f29e9770f3eac9f2d211a0a9c944
7
+ data.tar.gz: 9ea259515c34274950bbc5916035ded346837f5f36d7af6cdbf4fa31ce589b186c07d6ab0d0aa4b98121dea43ddb42948ce65243cf9af1249362a08011a1274e
@@ -45,9 +45,6 @@ Metrics/ModuleLength:
45
45
  Metrics/PerceivedComplexity:
46
46
  Max: 10
47
47
 
48
- Performance/RedundantBlockCall:
49
- Enabled: false
50
-
51
48
  Style/Alias:
52
49
  EnforcedStyle: prefer_alias_method
53
50
 
@@ -63,9 +60,6 @@ Style/EmptyCaseCondition:
63
60
  Style/Encoding:
64
61
  Enabled: false
65
62
 
66
- Style/HashSyntax:
67
- EnforcedStyle: hash_rockets
68
-
69
63
  Style/IfUnlessModifier:
70
64
  MaxLineLength: 40
71
65
 
@@ -3,7 +3,6 @@ language: ruby
3
3
  before_install:
4
4
  - gem update bundler
5
5
  rvm:
6
- - '1.8.7-p371'
7
6
  - '1.9.3-p551'
8
7
  - '2.0.0-p648'
9
8
  - '2.1.10'
@@ -0,0 +1,257 @@
1
+ # ChangeLog
2
+
3
+ ## unreleased
4
+
5
+ ## v3.4.0 (2017-10-11)
6
+
7
+ * Remove special handling for CSV in ruby 1.8 [@toy](https://github.com/toy)
8
+ * Set minimum ruby version to 1.9.3 [@toy](https://github.com/toy)
9
+ * Support `Enumerable#each_with_index` which stopped working since [45435b3](https://github.com/toy/progress/commit/45435b31ae0f9ad42255d9105d264f5fe9722c88) ([v3.2.2](#v322-2016-07-27)), not compatible with ruby 1.8 [#9](https://github.com/toy/progress/pull/9) [@amatsuda](https://github.com/amatsuda)
10
+
11
+ ## v3.3.2 (2017-10-09)
12
+
13
+ * Support `Enumerable#each_with_index` which stopped working since [45435b3](https://github.com/toy/progress/commit/45435b31ae0f9ad42255d9105d264f5fe9722c88) ([v3.2.2](#v322-2016-07-27)), compatible with ruby 1.8 [#10](https://github.com/toy/progress/pull/10) [@amatsuda](https://github.com/amatsuda)
14
+
15
+ ## v3.3.1 (2017-02-22)
16
+
17
+ * Fix for jruby raising wrong exception when checking if io is seekable [@toy](https://github.com/toy)
18
+
19
+ ## v3.3.0 (2017-01-30)
20
+
21
+ * Add public setter for `io` and make `io` and `io_tty?` methods public [#8](https://github.com/toy/progress/issues/8) [@toy](https://github.com/toy)
22
+
23
+ ## v3.2.2 (2016-07-27)
24
+
25
+ * Fix block arguments for `Hash` in ruby < 1.9 [@toy](https://github.com/toy)
26
+
27
+ ## v3.2.1 (2016-07-26)
28
+
29
+ * Fix `respond_to?` for non existing methods in ruby < 1.9 [@toy](https://github.com/toy)
30
+
31
+ ## v3.2.0 (2016-07-26)
32
+
33
+ * Provide `respond_to_missing?` instead of `respond_to?` in `WithProgress` [@toy](https://github.com/toy)
34
+
35
+ ## v3.1.1 (2016-01-11)
36
+
37
+ * Fix `Thread.exclusive` deprecation in Ruby 2.3.0 [#4](https://github.com/toy/progress/pull/4) [@katsuma](https://github.com/katsuma)
38
+
39
+ ## v3.1.0 (2014-12-22)
40
+
41
+ * Add handling for CSV in ruby 1.8 [@toy](https://github.com/toy)
42
+ * Fix getting total for progress on `Range` [@toy](https://github.com/toy)
43
+ * Use `StringIO` for `String` progress and `pos`/`size` for `IO` progress to not convert to array before progress [@toy](https://github.com/toy)
44
+ * Set `WithProgress` title to `nil` by default [@toy](https://github.com/toy)
45
+ * Fix return value from `with_progress{}` to equal `with_progress.each{}` [@toy](https://github.com/toy)
46
+ * Fix wrong variable name in `WithProgress#respond_to?` [@toy](https://github.com/toy)
47
+ * Fix using wrong constant `TempFile` instead of `Tempfile` [@toy](https://github.com/toy)
48
+ * Remove methods `eta` and `elapsed` created for mocking eta [@toy](https://github.com/toy)
49
+ * Rename `set_terminal_title` to `terminal_title` [@toy](https://github.com/toy)
50
+
51
+ ## v3.0.2 (2014-12-19)
52
+
53
+ * Restore updating eta when there is no progress [@toy](https://github.com/toy)
54
+
55
+ ## v3.0.1 (2014-08-18)
56
+
57
+ * Step once when running without block [@toy](https://github.com/toy)
58
+ * Fix working with `in_threads` by removing `WithProgress` inheritance of `Delegator` [@toy](https://github.com/toy)
59
+
60
+ ## v3.0.0 (2013-08-20)
61
+
62
+ * Befriend with [`in_threads`](https://rubygems.org/gems/in_threads) gem [@toy](https://github.com/toy)
63
+ * Warn and use `to_a` on `IO` and `String` related objects before running progress, for other objects use for length in order: `size`, `length`, `count` [@toy](https://github.com/toy)
64
+ * Make `WithProgress` inherit `Delegator` [@toy](https://github.com/toy)
65
+ * Show elapsed time on finish [@toy](https://github.com/toy)
66
+ * Cleanup/rewrite, extract `Eta` and `Beeper` [@toy](https://github.com/toy)
67
+ * Conditionally require active_record support instead of conditionally creating module [@toy](https://github.com/toy)
68
+ * Don't kill dead thread for eta output without progress [@toy](https://github.com/toy)
69
+ * Don't show eta until at least one second passed [@toy](https://github.com/toy)
70
+
71
+ ## v2.4.0 (2012-01-03)
72
+
73
+ * Add `Progress.running?` for checking if progress is running [@toy](https://github.com/toy)
74
+
75
+ ## v2.3.0 (2011-12-25)
76
+
77
+ * Better handle edge cases of eta output without progress [@toy](https://github.com/toy)
78
+ * Call each only once for enumerable that can not be reused [@toy](https://github.com/toy)
79
+ * Allow to set length directly when calling `with_progress` [@toy](https://github.com/toy)
80
+
81
+ ## v2.2.0 (2011-12-05)
82
+
83
+ * Make `with_progress.with_progress` create new instance instead of changing current, added enumerable and title attribute readers [@toy](https://github.com/toy)
84
+
85
+ ## v2.1.1 (2011-12-04)
86
+
87
+ * Fix `with_progress.with_progress` with block not calling each [@toy](https://github.com/toy)
88
+
89
+ ## v2.1.0 (2011-11-29)
90
+
91
+ * Change title when overriding progress with another call to `with_progress` [@toy](https://github.com/toy)
92
+ * Allow to directly specify length when initialising `WithProgress` [@toy](https://github.com/toy)
93
+
94
+ ## v2.0.0 (2011-11-28)
95
+
96
+ * Show eta every second instead of every three when there is no progress [@toy](https://github.com/toy)
97
+ * Cache calculated length [@toy](https://github.com/toy)
98
+ * Use count method of enumerable if available to determine total for progress [@toy](https://github.com/toy)
99
+ * Call `each` with progress when `with_progress` is called with block [@toy](https://github.com/toy)
100
+ * Stop thread triggering eta update [@toy](https://github.com/toy)
101
+ * Rework `WithProgress` [@toy](https://github.com/toy)
102
+ * Remove `each_with_progress` and `each_with_index_and_progress` [@toy](https://github.com/toy)
103
+
104
+ ## v1.2.1 (2011-10-18)
105
+
106
+ * Add missing `require 'thread'` [@toy](https://github.com/toy)
107
+
108
+ ## v1.2.0 (2011-10-18)
109
+
110
+ * Updated eta every 3 seconds if nothing is happening [@toy](https://github.com/toy)
111
+
112
+ ## v1.1.3 (2011-01-15)
113
+
114
+ * Fix `io` method, so `$stderr` can be silenced using `reopen` [@toy](https://github.com/toy)
115
+ * Remove `require 'rubygems'` [@toy](https://github.com/toy)
116
+
117
+ ## v1.1.2.1 (2010-12-15)
118
+
119
+ * Internal gem changes [@toy](https://github.com/toy)
120
+
121
+ ## v1.1.2 (2010-12-09)
122
+
123
+ * Use control character to clear line to end [@toy](https://github.com/toy)
124
+
125
+ ## v1.1.1 (2010-12-07)
126
+
127
+ * Fix in notes handling [@toy](https://github.com/toy)
128
+
129
+ ## v1.1.0 (2010-12-07)
130
+
131
+ * Add note for step [@toy](https://github.com/toy)
132
+
133
+ ## v1.0.1 (2010-11-14)
134
+
135
+ * Fix progress by using `step` with block everywhere [@toy](https://github.com/toy)
136
+ * Separate `step` arguments to numerator and denominator [@toy](https://github.com/toy)
137
+
138
+ ## v1.0.0 (2010-11-14)
139
+
140
+ * Show progress in terminal title [@toy](https://github.com/toy)
141
+ * Add eta [@toy](https://github.com/toy)
142
+ * Fix `step` by implementing through `set` and fix `set` return value [@toy](https://github.com/toy)
143
+
144
+ ## v0.4.1 (2010-11-13)
145
+
146
+ * Fix active record batch extension inclusion [@toy](https://github.com/toy)
147
+
148
+ ## v0.4.0 (2010-11-13)
149
+
150
+ * Add support for active record batch progress [@toy](https://github.com/toy)
151
+ * Fix `each_with_index_and_progress` requiring title [@toy](https://github.com/toy)
152
+
153
+ ## v0.3.0 (2010-11-13)
154
+
155
+ * Allow progress without title [@toy](https://github.com/toy)
156
+
157
+ ## v0.2.2 (2010-01-20)
158
+
159
+ * Fix bug in i18n gem [@toy](https://github.com/toy)
160
+
161
+ ## v0.2.1 (2010-01-16)
162
+
163
+ * Ensure outputting final 100% of outer progress [@toy](https://github.com/toy)
164
+
165
+ ## v0.2.0 (2009-12-30)
166
+
167
+ * Limit frequency of progress output [@toy](https://github.com/toy)
168
+
169
+ ## v0.1.2 (2009-12-29)
170
+
171
+ * Internal gem changes [@toy](https://github.com/toy)
172
+
173
+ ## v0.1.1.3 (2009-09-28)
174
+
175
+ * Remove debugging character from output [@toy](https://github.com/toy)
176
+
177
+ ## v0.1.1.2 (2009-09-28)
178
+
179
+ * Fix highlighting [@toy](https://github.com/toy)
180
+
181
+ ## v0.1.1.0 (2009-09-21)
182
+
183
+ * Allow `Progress(…)` instead `Progress.start(…)` [@toy](https://github.com/toy)
184
+ * Allow `step` to accept block for valid counting of custom progress [@toy](https://github.com/toy)
185
+ * Kill progress on cycle break [@toy](https://github.com/toy)
186
+
187
+ ## v0.1.0.3 (2009-09-21)
188
+
189
+ * Internal gem changes [@toy](https://github.com/toy)
190
+
191
+ ## v0.1.0.2 (2009-08-19)
192
+
193
+ * Don't raise error on extra `Progress.stop` [@toy](https://github.com/toy)
194
+
195
+ ## v0.1.0.1 (2009-08-19)
196
+
197
+ * Fix output by verifying and converting progress to float [@toy](https://github.com/toy)
198
+
199
+ ## v0.1.0.0 (2009-08-19)
200
+
201
+ * Inner progress increases outer progress, ability to set progress using `set` alongside stepping using `step` [@toy](https://github.com/toy)
202
+
203
+ ## v0.0.9.3 (2009-08-06)
204
+
205
+ * Use space instead of `'>'` for padding [@toy](https://github.com/toy)
206
+
207
+ ## v0.0.9.2 (2009-07-28)
208
+
209
+ * Force behaving as with tty by setting `PROGRESS_TTY` environment variable [@toy](https://github.com/toy)
210
+
211
+ ## v0.0.9.1 (2009-07-28)
212
+
213
+ * Separate handling of staying on same line and colourising output [@toy](https://github.com/toy)
214
+
215
+ ## v0.0.9.0 (2009-07-20)
216
+
217
+ * Add `Enumerable#with_progress` on which any enumerable method can be called [@toy](https://github.com/toy)
218
+
219
+ ## v0.0.8.1 (2009-05-02)
220
+
221
+ * Return to line start after printing message instead of before [@toy](https://github.com/toy)
222
+
223
+ ## v0.0.8 (2009-04-27)
224
+
225
+ * No colours and don't stay on same line when not on tty or explicitly using `:lines => true` option [@toy](https://github.com/toy)
226
+
227
+ ## v0.0.7.1 (2009-04-24)
228
+
229
+ * Internal gem changes [@toy](https://github.com/toy)
230
+
231
+ ## v0.0.7 (2009-03-24)
232
+
233
+ * Internal gem changes [@toy](https://github.com/toy)
234
+
235
+ ## v0.0.6 (2009-02-19)
236
+
237
+ * Output to stderr [@toy](https://github.com/toy)
238
+
239
+ ## v0.0.5 (2008-11-07)
240
+
241
+ * Return result of enumerable method [@toy](https://github.com/toy)
242
+
243
+ ## v0.0.4 (2008-11-06)
244
+
245
+ * Allow to change step size [@toy](https://github.com/toy)
246
+
247
+ ## v0.0.3 (2008-11-01)
248
+
249
+ * Output final newline after finishing progress [@toy](https://github.com/toy)
250
+
251
+ ## v0.0.2 (2008-10-31)
252
+
253
+ * Allow enclosed progress [@toy](https://github.com/toy)
254
+
255
+ ## v0.0.1 (2008-08-10)
256
+
257
+ * Initial [@toy](https://github.com/toy)
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2017 Ivan Kuchin
1
+ Copyright (c) 2008-2017 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -137,4 +137,4 @@ Or if you know that B runs 9 times faster than C:
137
137
 
138
138
  ## Copyright
139
139
 
140
- Copyright (c) 2010-2017 Ivan Kuchin. See LICENSE.txt for details.
140
+ Copyright (c) 2008-2017 Ivan Kuchin. See LICENSE.txt for details.
@@ -10,7 +10,7 @@ class Progress
10
10
  # start progress indication
11
11
  def start(total = nil, title = nil)
12
12
  init(total, title)
13
- print_message :force => true
13
+ print_message force: true
14
14
  return unless block_given?
15
15
  begin
16
16
  yield
@@ -45,7 +45,7 @@ class Progress
45
45
  def stop
46
46
  return unless running?
47
47
  if @levels.length == 1
48
- print_message :force => true, :finish => true
48
+ print_message force: true, finish: true
49
49
  stop_beeper
50
50
  end
51
51
  @levels.pop
@@ -64,8 +64,6 @@ class Progress
64
64
  run_for_string(method, *args, &block)
65
65
  when io?
66
66
  run_for_io(method, *args, &block)
67
- when defined?(CSV::Reader) && @enum.is_a?(CSV::Reader)
68
- run_for_ruby18_csv(method, *args, &block)
69
67
  else
70
68
  run_with_length(@enum, enum_length(@enum), method, *args, &block)
71
69
  end
@@ -88,13 +86,6 @@ class Progress
88
86
  end
89
87
  end
90
88
 
91
- def run_for_ruby18_csv(method, *args, &block)
92
- warn "Progress: #{@enum.class} doesn't expose IO, collecting elements"
93
- with_substitute(@enum.to_a) do |lines|
94
- run_with_length(lines, lines.length, method, *args, &block)
95
- end
96
- end
97
-
98
89
  def run_without_block(enum, method, *args)
99
90
  Progress.start(@title) do
100
91
  Progress.step do
@@ -103,22 +94,22 @@ class Progress
103
94
  end
104
95
  end
105
96
 
106
- def run_with_length(enum, length, method, *args, &block)
97
+ def run_with_length(enum, length, method, *args)
107
98
  Progress.start(@title, length) do
108
99
  enum.send(method, *args) do |*block_args|
109
100
  Progress.step do
110
- block.call(*block_args)
101
+ yield(*block_args)
111
102
  end
112
103
  end
113
104
  end
114
105
  end
115
106
 
116
- def run_with_pos(io, method, *args, &block)
107
+ def run_with_pos(io, method, *args)
117
108
  size = io.respond_to?(:size) ? io.size : io.stat.size
118
109
  Progress.start(@title, size) do
119
110
  io.send(method, *args) do |*block_args|
120
111
  Progress.set(io.pos) do
121
- block.call(*block_args)
112
+ yield(*block_args)
122
113
  end
123
114
  end
124
115
  end
@@ -2,12 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'progress'
5
- s.version = '3.3.2'
5
+ s.version = '3.4.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']
9
9
  s.license = 'MIT'
10
10
 
11
+ s.required_ruby_version = '>= 1.9.3'
12
+
11
13
  s.rubyforge_project = s.name
12
14
 
13
15
  s.files = `git ls-files`.split("\n")
@@ -13,7 +13,7 @@ describe Progress do
13
13
  allow(Progress).to receive(:start_beeper)
14
14
  allow(Progress).to receive(:time_to_print?).and_return(true)
15
15
 
16
- eta = instance_double(Progress::Eta, :left => nil, :elapsed => '0s')
16
+ eta = instance_double(Progress::Eta, left: nil, elapsed: '0s')
17
17
  allow(Progress).to receive(:eta).and_return(eta)
18
18
  end
19
19
 
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.3.2
4
+ version: 3.4.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: 2017-10-08 00:00:00.000000000 Z
11
+ date: 2017-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -47,6 +47,7 @@ files:
47
47
  - ".gitignore"
48
48
  - ".rubocop.yml"
49
49
  - ".travis.yml"
50
+ - CHANGELOG.markdown
50
51
  - Gemfile
51
52
  - LICENSE.txt
52
53
  - README.markdown
@@ -74,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
75
  requirements:
75
76
  - - ">="
76
77
  - !ruby/object:Gem::Version
77
- version: '0'
78
+ version: 1.9.3
78
79
  required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="