retriable 3.1.1 → 3.2.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
- SHA1:
3
- metadata.gz: ba6b290804243a8b08f6f4542f1516ca38f52205
4
- data.tar.gz: 618793b8cdb2566ff83fa037252a17874d490936
2
+ SHA256:
3
+ metadata.gz: 744d79bd8be89939c6d24deaf7430841d167f62a6eeb98259ea30c8af24c8018
4
+ data.tar.gz: 68a1900cef5b7d8455786a681660bbe3ab779c1ef9cafb274634c48b234131dc
5
5
  SHA512:
6
- metadata.gz: bb9a7cc6d5661743f636d8a2aa82d5cc12f03e41e2ffe93721af71081199f696d7cf6d4dcc830da3dc0cf3bd87b0fd9fd43f1f807b173fa4389f00358132cd48
7
- data.tar.gz: 6434a4c6910b02caf3f1a8d822ceb543c511168052eb6bcd0e3c496d99931951143946456d212fb0f13193e88724ce7ff3d9cac9f242a8b5910fb8a7a2d225a8
6
+ metadata.gz: 931cbd73e3d88e47384c1a34faf3deb71a2a87f4ab9dd21a967fb73f1a0a364e7c1b8cd0794dd71821d84a7968d739195561d71bf020bbc27af9af2e26599c1d
7
+ data.tar.gz: 55e596d2efb08d3cfc4aa2eb88f0db4b51589ae48b3d2ed9af6cc41e2f06ef91085b646f185818dd22474cd60c5ac91ea651fbfb9d08cf63a9e43a21867a3f91
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "10:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,49 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+ types: [opened, synchronize, reopened]
9
+
10
+ jobs:
11
+ ci:
12
+ # The type of runner that the job will run on
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-24.04]
17
+ ruby:
18
+ [
19
+ "2.3",
20
+ "2.4",
21
+ "2.5",
22
+ "2.6",
23
+ "2.7",
24
+ "3.0",
25
+ "3.1",
26
+ "3.2",
27
+ "3.3",
28
+ "3.4",
29
+ "4.0",
30
+ jruby,
31
+ ]
32
+ env:
33
+ CC_TEST_REPORTER_ID: 20a1139ef1830b4f813a10a03d90e8aa179b5226f75e75c5a949b25756ebf558
34
+
35
+ steps:
36
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
37
+ - uses: actions/checkout@v6
38
+
39
+ - name: Setup ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: ${{ matrix.ruby }}
43
+ bundler-cache: true
44
+
45
+ - name: ruby version
46
+ run: ruby -v
47
+
48
+ - name: Run rspec
49
+ run: bundle exec rspec
data/.hound.yml ADDED
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,22 +1,22 @@
1
1
  Style/StringLiterals:
2
2
  EnforcedStyle: double_quotes
3
3
 
4
+ Style/StringLiteralsInInterpolation:
5
+ EnforcedStyle: double_quotes
6
+
4
7
  Style/Documentation:
5
8
  Enabled: false
6
9
 
7
10
  Style/TrailingCommaInArguments:
8
11
  EnforcedStyleForMultiline: comma
9
12
 
10
- Style/TrailingCommaInLiteral:
11
- EnforcedStyleForMultiline: comma
12
-
13
- Style/InheritException:
13
+ Lint/InheritException:
14
14
  Enabled: false
15
15
 
16
- Style/IndentArray:
16
+ Layout/FirstArrayElementIndentation:
17
17
  Enabled: false
18
18
 
19
- Style/IndentHash:
19
+ Layout/FirstHashElementIndentation:
20
20
  Enabled: false
21
21
 
22
22
  Style/NegatedIf:
@@ -28,8 +28,8 @@ Metrics/ClassLength:
28
28
  Metrics/ModuleLength:
29
29
  Enabled: false
30
30
 
31
- Metrics/LineLength:
32
- Enabled: false
31
+ Layout/LineLength:
32
+ Max: 120
33
33
 
34
34
  Metrics/MethodLength:
35
35
  Enabled: false
@@ -39,3 +39,6 @@ Metrics/BlockLength:
39
39
 
40
40
  Metrics/AbcSize:
41
41
  Enabled: false
42
+
43
+ Style/TrailingCommaInArrayLiteral:
44
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,116 +1,141 @@
1
- ## HEAD
1
+ # HEAD
2
+
3
+ ## 3.2.0
4
+
5
+ - Require ruby 2.3+.
6
+ - Fix: Ensure `tries` value is overridden by `intervals` parameter if both are provided and add a test for this. This is always what the README stated but the code didn't actually do it.
7
+ - Fix: Some rubocop offenses.
8
+
9
+ ## 3.1.2
10
+
11
+ - Replace `minitest` gem with `rspec`
12
+ - Fancier README
13
+ - Remove unnecessary short circuit in `randomize` method
2
14
 
3
15
  ## 3.1.1
4
16
 
5
- * Fix typo in contexts exception message.
6
- * Fix updating the version in the library.
17
+ - Fix typo in contexts exception message.
18
+ - Fix updating the version in the library.
7
19
 
8
20
  ## 3.1.0
9
21
 
10
- * Added [contexts feature](https://github.com/kamui/retriable#contexts). Thanks to @apurvis.
22
+ - Added [contexts feature](https://github.com/kamui/retriable#contexts). Thanks to @apurvis.
11
23
 
12
24
  ## 3.0.2
13
25
 
14
- * Add configuration and options validation.
26
+ - Add configuration and options validation.
15
27
 
16
28
  ## 3.0.1
17
- * Add `rubocop` linter to enforce coding styles for this library. Also, fix rule violations.
18
- * Removed `attr_reader :config` that caused a warning. @bruno-
19
- * Clean up Rakefile testing cruft. @bruno-
20
- * Use `.any?` in the `:on` hash processing. @apurvis
29
+
30
+ - Add `rubocop` linter to enforce coding styles for this library. Also, fix rule violations.
31
+ - Removed `attr_reader :config` that caused a warning. @bruno-
32
+ - Clean up Rakefile testing cruft. @bruno-
33
+ - Use `.any?` in the `:on` hash processing. @apurvis
21
34
 
22
35
  ## 3.0.0
23
- * Require ruby 2.0+.
24
- * Breaking Change: `on` with a `Hash` value now matches subclassed exceptions. Thanks @apurvis!
25
- * Remove `awesome_print` from development environment.
36
+
37
+ - Require ruby 2.0+.
38
+ - Breaking Change: `on` with a `Hash` value now matches subclassed exceptions. Thanks @apurvis!
39
+ - Remove `awesome_print` from development environment.
26
40
 
27
41
  ## 2.1.0
28
42
 
29
- * Fix bug #17 due to confusing the initial try as a retry.
30
- * Switch to `Minitest` 5.6 expect syntax.
43
+ - Fix bug #17 due to confusing the initial try as a retry.
44
+ - Switch to `Minitest` 5.6 expect syntax.
31
45
 
32
46
  ## 2.0.2
33
47
 
34
- * Change required_ruby_version in gemspec to >= 1.9.3.
48
+ - Change required_ruby_version in gemspec to >= 1.9.3.
35
49
 
36
50
  ## 2.0.1
37
51
 
38
- * Add support for ruby 1.9.3.
52
+ - Add support for ruby 1.9.3.
39
53
 
40
54
  ## 2.0.0
41
55
 
42
- * Require ruby 2.0+.
43
- * Time intervals default to randomized exponential backoff instead of fixed time intervals. The delay between retries grows with every attempt and there's a randomization factor added to each attempt.
44
- * `base_interval`, `max_interval`, `rand_factor`, and `multiplier` are new arguments that are used to generate randomized exponential back off time intervals.
45
- * `interval` argument removed.
46
- * Accept `intervals` array argument to provide your own custom intervals.
47
- * Allow configurable defaults via `Retriable#configure` block.
48
- * Add ability for `:on` argument to accept a `Hash` where the keys are exception types and the values are a single or array of `Regexp` pattern(s) to match against exception messages for retrial.
49
- * Raise, not return, on max elapsed time.
50
- * Check for elapsed time after next interval is calculated and it goes over the max elapsed time.
51
- * Support early termination via `max_elapsed_time` argument.
56
+ - Require ruby 2.0+.
57
+ - Time intervals default to randomized exponential backoff instead of fixed time intervals. The delay between retries grows with every attempt and there's a randomization factor added to each attempt.
58
+ - `base_interval`, `max_interval`, `rand_factor`, and `multiplier` are new arguments that are used to generate randomized exponential back off time intervals.
59
+ - `interval` argument removed.
60
+ - Accept `intervals` array argument to provide your own custom intervals.
61
+ - Allow configurable defaults via `Retriable#configure` block.
62
+ - Add ability for `:on` argument to accept a `Hash` where the keys are exception types and the values are a single or array of `Regexp` pattern(s) to match against exception messages for retrial.
63
+ - Raise, not return, on max elapsed time.
64
+ - Check for elapsed time after next interval is calculated and it goes over the max elapsed time.
65
+ - Support early termination via `max_elapsed_time` argument.
52
66
 
53
67
  ## 2.0.0.beta5
54
- * Change `:max_tries` back to `:tries`.
68
+
69
+ - Change `:max_tries` back to `:tries`.
55
70
 
56
71
  ## 2.0.0.beta4
57
- * Change #retry back to #retriable. Didn't like the idea of defining a method that is also a reserved word.
58
- * Add ability for `:on` argument to accept a `Hash` where the keys are exception types and the values are a single or array of `Regexp` pattern(s) to match against exception messages for retrial.
72
+
73
+ - Change #retry back to #retriable. Didn't like the idea of defining a method that is also a reserved word.
74
+ - Add ability for `:on` argument to accept a `Hash` where the keys are exception types and the values are a single or array of `Regexp` pattern(s) to match against exception messages for retrial.
59
75
 
60
76
  ## 2.0.0.beta3
61
- * Accept `intervals` array argument to provide your own custom intervals.
62
- * Refactor the exponential backoff code into it's own class.
63
- * Add specs for exponential backoff, randomization, and config.
77
+
78
+ - Accept `intervals` array argument to provide your own custom intervals.
79
+ - Refactor the exponential backoff code into it's own class.
80
+ - Add specs for exponential backoff, randomization, and config.
64
81
 
65
82
  ## 2.0.0.beta2
66
- * Raise, not return, on max elapsed time.
67
- * Check for elapsed time after next interval is calculated and it goes over the max elapsed time.
68
- * Add specs for `max_elapsed_time` and `max_interval`.
83
+
84
+ - Raise, not return, on max elapsed time.
85
+ - Check for elapsed time after next interval is calculated and it goes over the max elapsed time.
86
+ - Add specs for `max_elapsed_time` and `max_interval`.
69
87
 
70
88
  ## 2.0.0.beta1
71
- * Require ruby 2.0+.
72
- * Default to random exponential backoff, removes the `interval` option. Exponential backoff is configurable via arguments.
73
- * Allow configurable defaults via `Retriable#configure` block.
74
- * Change `Retriable.retriable` to `Retriable.retry`.
75
- * Support early termination via `max_elapsed_time` argument.
89
+
90
+ - Require ruby 2.0+.
91
+ - Default to random exponential backoff, removes the `interval` option. Exponential backoff is configurable via arguments.
92
+ - Allow configurable defaults via `Retriable#configure` block.
93
+ - Change `Retriable.retriable` to `Retriable.retry`.
94
+ - Support early termination via `max_elapsed_time` argument.
76
95
 
77
96
  ## 1.4.1
78
- * Fixes non kernel mode bug. Remove DSL class, move `#retriable` into Retriable module. Thanks @mkrogemann.
97
+
98
+ - Fixes non kernel mode bug. Remove DSL class, move `#retriable` into Retriable module. Thanks @mkrogemann.
79
99
 
80
100
  ## 1.4.0
81
- * By default, retriable doesn't monkey patch `Kernel`. If you want this functionality,
82
- you can `require 'retriable/core_ext/kernel'.
83
- * Upgrade minitest to 5.x.
84
- * Refactor the DSL into it's own class.
101
+
102
+ - By default, retriable doesn't monkey patch `Kernel`. If you want this functionality,
103
+ you can `require 'retriable/core_ext/kernel'.
104
+ - Upgrade minitest to 5.x.
105
+ - Refactor the DSL into it's own class.
85
106
 
86
107
  ## 1.3.3.1
87
- * Allow sleep parameter to be a proc/lambda to allow for exponential backoff.
108
+
109
+ - Allow sleep parameter to be a proc/lambda to allow for exponential backoff.
88
110
 
89
111
  ## 1.3.3
90
- * sleep after executing the retry block, so there's no wait on the first call (molfar)
112
+
113
+ - sleep after executing the retry block, so there's no wait on the first call (molfar)
91
114
 
92
115
  ## 1.3.2
93
- * Clean up option defaults.
94
- * By default, rescue StandardError and Timeout::Error instead of [Exception](http://www.mikeperham.com/2012/03/03/the-perils-of-rescue-exception).
116
+
117
+ - Clean up option defaults.
118
+ - By default, rescue StandardError and Timeout::Error instead of [Exception](http://www.mikeperham.com/2012/03/03/the-perils-of-rescue-exception).
95
119
 
96
120
  ## 1.3.1
97
- * Add `rake` dependency for travis-ci.
98
- * Update gemspec summary and description.
121
+
122
+ - Add `rake` dependency for travis-ci.
123
+ - Update gemspec summary and description.
99
124
 
100
125
  ## 1.3.0
101
126
 
102
- * Rewrote a lot of the code with inspiration from [attempt](https://rubygems.org/gems/attempt).
103
- * Add timeout option to the code block.
104
- * Include in Kernel by default, but allow require 'retriable/no_kernel' to load a non kernel version.
105
- * Renamed `:times` option to `:tries`.
106
- * Renamed `:sleep` option to `:interval`.
107
- * Renamed `:then` option to `:on_retry`.
108
- * Removed other callbacks, you can wrap retriable in a begin/rescue/else/ensure block if you need that functionality. It avoids the need to define multiple Procs and makes the code more readable.
109
- * Rewrote most of the README
127
+ - Rewrote a lot of the code with inspiration from [attempt](https://rubygems.org/gems/attempt).
128
+ - Add timeout option to the code block.
129
+ - Include in Kernel by default, but allow require 'retriable/no_kernel' to load a non kernel version.
130
+ - Renamed `:times` option to `:tries`.
131
+ - Renamed `:sleep` option to `:interval`.
132
+ - Renamed `:then` option to `:on_retry`.
133
+ - Removed other callbacks, you can wrap retriable in a begin/rescue/else/ensure block if you need that functionality. It avoids the need to define multiple Procs and makes the code more readable.
134
+ - Rewrote most of the README
110
135
 
111
136
  ## 1.2.0
112
137
 
113
- * Forked the retryable-rb repo.
114
- * Extend the Kernel module with the retriable method so you can use it anywhere without having to include it in every class.
115
- * Update gemspec, Gemfile, and Raketask.
116
- * Remove echoe dependency.
138
+ - Forked the retryable-rb repo.
139
+ - Extend the Kernel module with the retriable method so you can use it anywhere without having to include it in every class.
140
+ - Update gemspec, Gemfile, and Raketask.
141
+ - Remove echoe dependency.
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "retriable" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["jack@jackchu.com"](mailto:"jack@jackchu.com").
data/Gemfile CHANGED
@@ -1,12 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- # Specify your gem's dependencies in retriable.gemspec
4
5
  gemspec
5
6
 
6
7
  group :test do
7
- # gem "ruby_gntp"
8
- gem "codeclimate-test-reporter", require: false
9
- gem "minitest-focus"
8
+ gem "rspec", "~> 3.0"
10
9
  gem "simplecov", require: false
11
10
  end
12
11
 
@@ -16,4 +15,5 @@ end
16
15
 
17
16
  group :development, :test do
18
17
  gem "pry"
18
+ gem "rake", "~> 13.0"
19
19
  end