with_progress 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
- ---
2
- SHA1:
3
- data.tar.gz: 3f2f0e11796ce29a15547e9b4999764f68690902
4
- metadata.gz: 2344dd81e4e3ff3c673ae204b7f099df34a21377
5
- SHA512:
6
- data.tar.gz: 435603621abd935122315fad2a8834847596d3c7fc27d188d8b402f9bf92a2b529ff31e14bbc2ea3ccdf8a85dd191ce4e5241e96e403111f04fbc5949c47bbba
7
- metadata.gz: 4438efe9f53a6e0e919b643bd01b3cf7e158d296745753233bfe0bb85639ce1bea31965fde7e8f30a686a4e945b98e940beaaac874b4f43899c9df1dc6d83696
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWQ4ZDJhZmIyZjAwNjBlMDliOTA2MjczYmEwOWVhOWE0ZTM0Y2VjZA==
5
+ data.tar.gz: !binary |-
6
+ YzhhMGM4M2E2MThkY2VjZDM1MmMwZWEyYTYyNTQ4M2VkNDYzYzgxZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ N2M5NDhiZjNiYTMwMWQ5ZmZkMjNhMjI4NjJlZjg1ODU3YzNlZDM1ZjI2YWY3
10
+ NDY5YjVjYzc5ZTA1NjAyMTkwYjVjZDEwNWZjYzdiNTExYzljY2YzZWM2NzY0
11
+ MWI0MWVjODMxNzljOWQ4NzQwNDVlYzU5MDc4OGY5YTk4NDdiZDE=
12
+ data.tar.gz: !binary |-
13
+ MWRlYzBmMTc2YWY1MTIxNWZlOTM5ZTJkOTA0ODAzMDJkZTJiMzFlMjU3Y2Iz
14
+ M2YzYmYyMTMxNzdjNGUxMmY3YmQ4YmQ5OWQ1YTQ3YzYwYTlmMGY5OTU1ZTVi
15
+ NjI4MWNjYjVmNjFjMWJjZGRjN2M0MmY2YmUwOTkxZjA3MzI4YTI=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # with_progress [<img src="https://travis-ci.org/marcandre/with_progress.png?branch=master">](https://travis-ci.org/marcandre/with_progress) [<img src="https://badge.fury.io/rb/with_progress.png" alt="Gem Version" />](http://badge.fury.io/rb/with_progress)
1
+ # with_progress [![Build Status](https://travis-ci.org/marcandre/with_progress.png?branch=master)](https://travis-ci.org/marcandre/with_progress) [![Gem Version](https://badge.fury.io/rb/with_progress.png)](http://badge.fury.io/rb/with_progress)
2
2
 
3
3
  Brings the great [ruby-progressbar](https://github.com/jfelchner/ruby-progressbar) to `Enumerable`.
4
4
 
@@ -12,7 +12,14 @@ It uses the [ruby-progressbar](https://github.com/jfelchner/ruby-progressbar) ge
12
12
 
13
13
  In Ruby 2.0+, most enumerables return a size, so `with_progress` uses that to deduce the `total`, there's no need to specify it:
14
14
 
15
- 42.times.with_progress { do_something } # Will provide {total: 42} option in Ruby 2.0+ and show the right progression
15
+ 42.times.with_progress { do_something }
16
+ # Will create the progress bar, provide the {total: 42} option
17
+ # (in Ruby 2.0+) and call increment after each do_something
18
+
19
+ For Ruby older than 2.0.0, some enumerators won't work, so progression will only show the elapsed time but won't be able to guess the remaining time. You can require some [backports](https://github.com/marcandre/backports) to improve the situation, for example:
20
+
21
+ require 'backports/2.0.0/range/size'
22
+ (10...42).with_progress { do_something } # will calculate the remaining time, even in old Rubies
16
23
 
17
24
  ## Installation
18
25
 
@@ -1,7 +1,6 @@
1
1
  require 'with_progress/version'
2
2
  require 'with_progress/extensions/enumerable'
3
3
  require 'ruby-progressbar'
4
- require 'backports/2.0.0/range/size'
5
4
 
6
5
  module WithProgress
7
6
  DEFAULTS = {:format => ENV['RUBY_WITH_PROGRESS'] || '%t: |%B| %E'}
@@ -4,7 +4,7 @@ module Enumerable
4
4
 
5
5
  options = WithProgress::DEFAULTS.merge(options)
6
6
  unless options.has_key?(:total)
7
- options[:total] = size rescue self.end - self.begin + (exclude_end? ? 0 : 1) rescue nil
7
+ options[:total] = size rescue nil
8
8
  end
9
9
 
10
10
  bar = ProgressBar.create(options)
@@ -1,3 +1,3 @@
1
1
  module WithProgress
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'with_progress'
2
+ require 'backports/2.0.0/range/size'
2
3
 
3
4
  describe "Progress" do
4
5
  it "looks good" do
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency 'ruby-progressbar', '~> 1.4'
22
- spec.add_dependency 'backports', '~> 3.5'
22
+ spec.add_development_dependency 'backports', '~> 3.5'
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,75 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: with_progress
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Marc-Andre Lafortune
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2014-02-04 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
15
14
  name: ruby-progressbar
16
- version_requirements: &id001 !ruby/object:Gem::Requirement
17
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
18
17
  - - ~>
19
- - !ruby/object:Gem::Version
20
- version: "1.4"
21
- prerelease: false
22
- requirement: *id001
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
23
20
  type: :runtime
24
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
25
28
  name: backports
26
- version_requirements: &id002 !ruby/object:Gem::Requirement
27
- requirements:
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
28
31
  - - ~>
29
- - !ruby/object:Gem::Version
30
- version: "3.5"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.5'
34
+ type: :development
31
35
  prerelease: false
32
- requirement: *id002
33
- type: :runtime
34
- - !ruby/object:Gem::Dependency
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.5'
41
+ - !ruby/object:Gem::Dependency
35
42
  name: bundler
36
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
- requirements:
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
38
45
  - - ~>
39
- - !ruby/object:Gem::Version
40
- version: "1.3"
41
- prerelease: false
42
- requirement: *id003
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
43
48
  type: :development
44
- - !ruby/object:Gem::Dependency
45
- name: rake
46
- version_requirements: &id004 !ruby/object:Gem::Requirement
47
- requirements:
48
- - &id005
49
- - ">="
50
- - !ruby/object:Gem::Version
51
- version: "0"
52
49
  prerelease: false
53
- requirement: *id004
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
54
62
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- version_requirements: &id006 !ruby/object:Gem::Requirement
58
- requirements:
59
- - *id005
60
63
  prerelease: false
61
- requirement: *id006
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
62
76
  type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
63
83
  description: progressbar for enumerables
64
- email:
84
+ email:
65
85
  - github@marc-andre.ca
66
86
  executables: []
67
-
68
87
  extensions: []
69
-
70
88
  extra_rdoc_files: []
71
-
72
- files:
89
+ files:
73
90
  - .gitignore
74
91
  - .travis.yml
75
92
  - CHANGELOG.rdoc
@@ -84,28 +101,29 @@ files:
84
101
  - spec/with_progress_spec.rb
85
102
  - with_progress.gemspec
86
103
  homepage: http://github.com/marcandre/with_progress
87
- licenses:
104
+ licenses:
88
105
  - MIT
89
106
  metadata: {}
90
-
91
107
  post_install_message:
92
108
  rdoc_options: []
93
-
94
- require_paths:
109
+ require_paths:
95
110
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
97
- requirements:
98
- - *id005
99
- required_rubygems_version: !ruby/object:Gem::Requirement
100
- requirements:
101
- - *id005
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
102
121
  requirements: []
103
-
104
122
  rubyforge_project:
105
- rubygems_version: 2.0.14
123
+ rubygems_version: 2.2.1
106
124
  signing_key:
107
125
  specification_version: 4
108
126
  summary: progressbar for enumerables
109
- test_files:
127
+ test_files:
110
128
  - spec/manual_spec.rb
111
129
  - spec/with_progress_spec.rb