duration_estimate 0.0.1 → 0.0.2

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: aa1e5e72f8be0aeda87a2fca48d6bd5a7017bf53
4
- data.tar.gz: 8030719f419e5d5287bac608cd5e21eb3a089c98
3
+ metadata.gz: 1be63dbda523533ef9e8d8878ae0aced8bbafaaa
4
+ data.tar.gz: ca9ed0a08762ba6b8ef79c23f690583178941da1
5
5
  SHA512:
6
- metadata.gz: f6a65ccdc2835b58eabf6708e5319e20565b1f673fec740383594d61aad4fed6c5e3252d30a5155ecd5169bdc381a44ea1c2368d08c5f7f47cb31505fd69b51a
7
- data.tar.gz: 889189139a5e5d690b508e4af4df06dcfb965861aad1c75f484febf46331b76e3a949184cc5a084d82e8ee677da62eaabf883aca69ddd06c05f512eddff6190a
6
+ metadata.gz: 7bd11f65886bc693bbbdf856a7fe8a6741fa533f62ba8b4732608e652b0a79c82d84372f634c216a40f57b5f7fd8391593d8a69381443841e7adbf2ca31f7417
7
+ data.tar.gz: 5412ecb8540c90b41ac28f10cfc9bf73a9ab099f6ad7ddee159d2f8a3523b33061de92908356d626251e1b995323b790ef42e6207ef92913c7c76dec7375bfd3
data/.travis.yml CHANGED
@@ -2,6 +2,8 @@ language: ruby
2
2
 
3
3
  rvm:
4
4
  - 2.2.2
5
+ - 2.1.6
6
+ - 2.0.0
5
7
  - 1.9.3
6
8
  - jruby-19mode
7
9
 
@@ -14,5 +16,6 @@ notifications:
14
16
  on_success: change
15
17
  on_failure: always
16
18
 
19
+ before_install: "gem install bundler -v 1.10.5"
17
20
  install: "bundle --jobs 4"
18
21
  script: "bundle exec rspec"
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DurationEstimate
1
+ # Duration Estimate [![Build Status](https://img.shields.io/travis/ollie/duration_estimate/master.svg)](https://travis-ci.org/ollie/duration_estimate) [![Code Climate](https://img.shields.io/codeclimate/github/ollie/duration_estimate.svg)](https://codeclimate.com/github/ollie/duration_estimate) [![Gem Version](https://img.shields.io/gem/v/duration_estimate.svg)](https://rubygems.org/gems/duration_estimate)
2
2
 
3
3
  Do something to a collection of items and see how long it is going to take.
4
4
  Useful for long-running Rake tasks.
@@ -9,7 +9,7 @@ Useful for long-running Rake tasks.
9
9
  items = 0..10000 # Some data set.
10
10
 
11
11
  DurationEstimate.each(items) do |item, e|
12
- print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
12
+ print "\r#{DurationEstimate::TerminalFormatter.format(e)}"
13
13
 
14
14
  # Do something time consuming with item.
15
15
  sleep 0.001
@@ -28,7 +28,7 @@ media = Media
28
28
 
29
29
  File.open('missing-media.log', 'w') do |log|
30
30
  DurationEstimate.each(media, size: media.count) do |medium, e|
31
- print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
31
+ print "\r#{DurationEstimate::TerminalFormatter.format(e)}"
32
32
 
33
33
  unless medium.on_s3?
34
34
  log.puts medium.id
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+
1
3
  task default: :combo
2
4
 
3
5
  desc 'Run tests, rubocop and generate documentation'
@@ -22,14 +22,14 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ['lib']
23
23
 
24
24
  # System
25
- spec.add_development_dependency 'bundler', '~> 1.9'
25
+ spec.add_development_dependency 'bundler', '~> 1.10'
26
26
 
27
27
  # Test
28
- spec.add_development_dependency 'rspec', '~> 3.2'
28
+ spec.add_development_dependency 'rspec', '~> 3.3'
29
29
  spec.add_development_dependency 'simplecov', '~> 0.10'
30
30
 
31
31
  # Code style, debugging, docs
32
- spec.add_development_dependency 'rubocop', '~> 0.31'
32
+ spec.add_development_dependency 'rubocop', '~> 0.32'
33
33
  spec.add_development_dependency 'pry', '~> 0.10'
34
34
  spec.add_development_dependency 'yard', '~> 0.8'
35
35
  spec.add_development_dependency 'rake', '~> 10.4'
@@ -26,10 +26,10 @@ class DurationEstimate
26
26
  # @return [String]
27
27
  def format
28
28
  [
29
- "#{ items_done }/#{ estimate.items_size }",
30
- "(#{ percentage } %)",
31
- "#{ estimate.ends_at.strftime('%H:%M:%S') },",
32
- "#{ estimate.time_remaining }"
29
+ "#{items_done}/#{estimate.items_size}",
30
+ "(#{percentage} %)",
31
+ "#{estimate.ends_at.strftime('%H:%M:%S')},",
32
+ "#{estimate.time_remaining}"
33
33
  ].join(' ')
34
34
  end
35
35
 
@@ -1,53 +1,4 @@
1
- # Do something to a collection of items and see how long it is going to take.
2
- # Useful for long-running Rake tasks.
3
- #
4
- # items = 0..10000 # Some data set.
5
- #
6
- # DurationEstimate.each(items) do |item, e|
7
- # print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
8
- #
9
- # # Do something time consuming with item.
10
- # sleep 0.001
11
- # end
12
- #
13
- # puts
14
- #
15
- # You can specify the collection size if you are using some kind of ORM that
16
- # does not respond to `:size` method.
17
- #
18
- # media = Media
19
- # .where { created_at > Time.parse('some time') }
20
- # .order(:created_at)
21
- #
22
- # File.open('missing-media.log', 'w') do |log|
23
- # DurationEstimate.each(media, size: media.count) do |medium, e|
24
- # print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
25
- #
26
- # unless medium.on_s3?
27
- # log.puts medium.id
28
- # log.fsync # Write changes now, be able tail the file.
29
- # end
30
- #
31
- # sleep 2 # Don't overload AWS S3
32
- # end
33
- # end
34
- #
35
- # puts
36
- #
37
- # This is going to re-print a line with something like this:
38
- #
39
- # 1/11 ( 9.09 %) -, -
40
- # 2/11 ( 18.18 %) 11:47:29, 00:00:34
41
- # 3/11 ( 27.27 %) 11:47:30, 00:00:31
42
- # 4/11 ( 36.36 %) 11:47:31, 00:00:27
43
- # 5/11 ( 45.45 %) 11:47:31, 00:00:23
44
- # 6/11 ( 54.55 %) 11:47:30, 00:00:19
45
- # 7/11 ( 63.64 %) 11:47:30, 00:00:15
46
- # 8/11 ( 72.73 %) 11:47:30, 00:00:11
47
- # 9/11 ( 81.82 %) 11:47:30, 00:00:07
48
- # 10/11 ( 90.91 %) 11:47:30, 00:00:03
49
- # 11/11 (100.00 %) 11:47:30, 00:00:00
50
1
  class DurationEstimate
51
2
  # Version, man!
52
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
53
4
  end
@@ -11,7 +11,7 @@ require 'duration_estimate/terminal_formatter'
11
11
  # items = 0..10000 # Some data set.
12
12
  #
13
13
  # DurationEstimate.each(items) do |item, e|
14
- # print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
14
+ # print "\r#{DurationEstimate::TerminalFormatter.format(e)}"
15
15
  #
16
16
  # # Do something time consuming with item.
17
17
  # sleep 0.001
@@ -28,7 +28,7 @@ require 'duration_estimate/terminal_formatter'
28
28
  #
29
29
  # File.open('missing-media.log', 'w') do |log|
30
30
  # DurationEstimate.each(media, size: media.count) do |medium, e|
31
- # print "\r#{ DurationEstimate::TerminalFormatter.format(e) }"
31
+ # print "\r#{DurationEstimate::TerminalFormatter.format(e)}"
32
32
  #
33
33
  # unless medium.on_s3?
34
34
  # log.puts medium.id
@@ -138,9 +138,9 @@ class DurationEstimate
138
138
  hours, minutes = minutes.divmod(60)
139
139
 
140
140
  [
141
- "#{ format('%02d', hours) }",
142
- "#{ format('%02d', minutes) }",
143
- "#{ format('%02d', seconds) }"
141
+ "#{format('%02d', hours)}",
142
+ "#{format('%02d', minutes)}",
143
+ "#{format('%02d', seconds)}"
144
144
  ].compact.join(':')
145
145
  end
146
146
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duration_estimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oldrich Vetesnik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
19
+ version: '1.10'
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
- version: '1.9'
26
+ version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.2'
33
+ version: '3.3'
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
- version: '3.2'
40
+ version: '3.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.31'
61
+ version: '0.32'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.31'
68
+ version: '0.32'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -117,8 +117,6 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
- - ".rubocop-my.yml"
121
- - ".rubocop.yml"
122
120
  - ".travis.yml"
123
121
  - ".yardopts"
124
122
  - Gemfile
@@ -153,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  version: '0'
154
152
  requirements: []
155
153
  rubyforge_project:
156
- rubygems_version: 2.4.6
154
+ rubygems_version: 2.4.8
157
155
  signing_key:
158
156
  specification_version: 4
159
157
  summary: Do something to a collection of items and see how long it is going to take.
data/.rubocop-my.yml DELETED
@@ -1,2 +0,0 @@
1
- Metrics/MethodLength:
2
- Max: 12
data/.rubocop.yml DELETED
@@ -1 +0,0 @@
1
- inherit_from: .rubocop-my.yml