retry_it 0.1.1 → 0.1.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
  SHA256:
3
- metadata.gz: 88ec936f85cef03d85a215785f910e9af3e4db879647f8b4e6eeba55ea7fd1cf
4
- data.tar.gz: e70df0684d7088b952b6f316915cd39a5a45312eeffe7ec40bd29c203737e3e3
3
+ metadata.gz: 2aeaa2845e5b554886e4c3efa5ca1272ce027d86792ee88b2eba25b2e73c72e7
4
+ data.tar.gz: 6fa2b4ea9088f999c95ddcbaf888abac2c4f80da52f1dfbb5122fa3f9c85ae68
5
5
  SHA512:
6
- metadata.gz: c9d790a6c0607579a563f7b0a980e37eb67115d808b5d7085b6e5be3c862487b81128fe4a83ba512b61c7fafdf858cbeaad865fbc172d123b2db214d3e6f0137
7
- data.tar.gz: 6573f6019906d7095e6ddf8a823d6be5162d05ebc1f06b79516bf2996e680f59b661c441e004afc9070fd5cd069e6cff8e56b5263d68bacf6ddd9d173829bb60
6
+ metadata.gz: bb76612dfe19d442426820161726d6bd6deca0c36cc69260266ffed7cd663f30b0ec5228fa3c5cf6b0265889112ae1995882d11307b6ac70f4a636ce8b2bce93
7
+ data.tar.gz: 892bba7a756595292e936331bd9a07b85b7bcb1bee81b4a810d74c056306fa57eba248c627e8a1a574d771429b7c0012e76079b15154aecdf94a37dd1eb9c092
@@ -0,0 +1 @@
1
+ 2.5.5
@@ -1,7 +1,9 @@
1
- ---
2
- sudo: false
3
1
  language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.1
7
- before_install: gem install bundler -v 1.16.5
2
+
3
+ before_install:
4
+ - yes | gem update --system
5
+ - gem install bundler
6
+
7
+ notifications:
8
+ email:
9
+ - developers@daliaresearch.com
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- retry_it (0.1.0)
4
+ retry_it (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -13,10 +13,10 @@ PLATFORMS
13
13
  ruby
14
14
 
15
15
  DEPENDENCIES
16
- bundler (~> 1.16)
16
+ bundler
17
17
  minitest (~> 5.0)
18
18
  rake (~> 10.0)
19
19
  retry_it!
20
20
 
21
21
  BUNDLED WITH
22
- 1.16.5
22
+ 2.0.2
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
 
24
24
  Include RetryIt in your class:
25
25
 
26
- ```
26
+ ```ruby
27
27
  class APIClient
28
28
  include RetryIt
29
29
  end
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  You can then call `retry_it` when running code that fails intermittently:
33
33
 
34
- ```
34
+ ```ruby
35
35
  class APIClient
36
36
  include RetryIt
37
37
 
@@ -69,7 +69,7 @@ the last error it received.
69
69
 
70
70
  Examples:
71
71
 
72
- ```
72
+ ```ruby
73
73
  # Retry only on HTTPErrors with code 504. All other errors will not trigger a
74
74
  # retry.
75
75
  retry_it(timeout: 60, errors: [HTTPError], should_retry_proc: Proc.new { |e| e.code == 504 }) do
@@ -93,7 +93,7 @@ end
93
93
 
94
94
  Keep in mind that you can pass methods as parameters using `method`:
95
95
 
96
- ```
96
+ ```ruby
97
97
  class APIClient
98
98
  include RetryIt
99
99
 
@@ -16,16 +16,16 @@ module RetryIt
16
16
  yield
17
17
  rescue *errors => e
18
18
  retries += 1
19
- if retries < max_runs && (!should_retry_proc.is_a?(Proc) || should_retry_proc.call(e))
19
+ should_retry_proc_result = should_retry_proc.respond_to?(:call) ? should_retry_proc.call(e) : true
20
+
21
+ if retries < max_runs && should_retry_proc_result
20
22
  if logger
21
23
  logger.info "Error (#{e.class}), retrying ##{retries} of #{max_runs}. Sleeping for #{timeout}"
22
24
  end
23
- if on_error && on_error.is_a?(Proc)
24
- on_error.call e
25
- end
26
- if timeout > 0
27
- sleep timeout
28
- end
25
+
26
+ on_error.call(e) if on_error && on_error.respond_to?(:call)
27
+ sleep timeout if timeout > 0
28
+
29
29
  retry
30
30
  else
31
31
  raise
@@ -1,3 +1,3 @@
1
1
  module RetryIt
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.16"
26
+ spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "minitest", "~> 5.0"
29
29
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retry_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rgould
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '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
- version: '1.16'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".ruby-version"
64
65
  - ".travis.yml"
65
66
  - Gemfile
66
67
  - Gemfile.lock
@@ -75,7 +76,7 @@ homepage: https://github.com/DaliaResearch/retry_it
75
76
  licenses:
76
77
  - MIT
77
78
  metadata: {}
78
- post_install_message:
79
+ post_install_message:
79
80
  rdoc_options: []
80
81
  require_paths:
81
82
  - lib
@@ -90,9 +91,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  - !ruby/object:Gem::Version
91
92
  version: '0'
92
93
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.7.6
95
- signing_key:
94
+ rubyforge_project:
95
+ rubygems_version: 2.7.6.2
96
+ signing_key:
96
97
  specification_version: 4
97
98
  summary: Easily retry code that fails intermittently
98
99
  test_files: []