lev 11.0.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lev/active_job/base.rb +4 -4
- data/lib/lev/active_job/configured_job.rb +2 -2
- data/lib/lev/null_status.rb +1 -1
- data/lib/lev/routine.rb +20 -12
- data/lib/lev/version.rb +1 -1
- data/lib/lev.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +47 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f2d078f5b053db33b4943cc4ea446fcb55144c75138f0b6218a86bb91a0173
|
4
|
+
data.tar.gz: 7cd0f512ca30c4d729ab21b4fb3a026acb4f7862c0ab1c91b0af6c9c47473ea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb1482577a5d79fdd4d6158dbd806be1d39a6e959d4f7fca8c99648ce7959348b21f229a42891dc7d1a9fabca7583a726fb7ab153387e8d2d30645163d271d3
|
7
|
+
data.tar.gz: 6bc07ed4006f3a315b72e37e3a9adf33918dbe98071222a5607f6bf4e0cfe09cb0499419bf4321e25c8f32a0001b729053a0b3bf83e206314703a4b656b43205
|
data/lib/lev/active_job/base.rb
CHANGED
@@ -3,7 +3,7 @@ module Lev
|
|
3
3
|
class Base < Lev.configuration.job_class
|
4
4
|
attr_accessor(:provider_job_id) unless respond_to?(:provider_job_id)
|
5
5
|
|
6
|
-
def perform_later(routine_class, options, *args, &block)
|
6
|
+
def perform_later(routine_class, options, *args, **kwargs, &block)
|
7
7
|
# Create a new status object
|
8
8
|
status = routine_class.create_status
|
9
9
|
|
@@ -25,7 +25,7 @@ module Lev
|
|
25
25
|
# Queue up the job and set the provider_job_id
|
26
26
|
# For delayed_job, requires either Rails 5 or
|
27
27
|
# http://stackoverflow.com/questions/29855768/rails-4-2-get-delayed-job-id-from-active-job
|
28
|
-
provider_job_id = self.class.send(:job_or_instantiate, *args, &block)
|
28
|
+
provider_job_id = self.class.send(:job_or_instantiate, *args, **kwargs, &block)
|
29
29
|
.enqueue(options)
|
30
30
|
.provider_job_id
|
31
31
|
status.set_provider_job_id(provider_job_id) \
|
@@ -35,14 +35,14 @@ module Lev
|
|
35
35
|
status.id
|
36
36
|
end
|
37
37
|
|
38
|
-
def perform(*args, &block)
|
38
|
+
def perform(*args, **kwargs, &block)
|
39
39
|
# Pop arguments added by perform_later
|
40
40
|
id = args.pop
|
41
41
|
routine_class = Kernel.const_get(args.pop)
|
42
42
|
|
43
43
|
routine_instance = routine_class.new(routine_class.find_status(id))
|
44
44
|
|
45
|
-
routine_instance.call(*args, &block)
|
45
|
+
routine_instance.call(*args, **kwargs, &block)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -12,8 +12,8 @@ module Lev
|
|
12
12
|
routine_class.active_job_enqueue_options.merge(@options)
|
13
13
|
end
|
14
14
|
|
15
|
-
def perform_later(*args, &block)
|
16
|
-
routine_class.job_class.new.perform_later(routine_class, options, *args, &block)
|
15
|
+
def perform_later(*args, **kwargs, &block)
|
16
|
+
routine_class.job_class.new.perform_later(routine_class, options, *args, **kwargs, &block)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/lev/null_status.rb
CHANGED
data/lib/lev/routine.rb
CHANGED
@@ -200,12 +200,12 @@ module Lev
|
|
200
200
|
end
|
201
201
|
|
202
202
|
module ClassMethods
|
203
|
-
def call(*args, &block)
|
204
|
-
new.call(*args, &block)
|
203
|
+
def call(*args, **kwargs, &block)
|
204
|
+
new.call(*args, **kwargs, &block)
|
205
205
|
end
|
206
206
|
|
207
|
-
def [](*args, &block)
|
208
|
-
result = call(*args, &block)
|
207
|
+
def [](*args, **kwargs, &block)
|
208
|
+
result = call(*args, **kwargs, &block)
|
209
209
|
result.errors.raise_exception_if_any!
|
210
210
|
result.outputs.send(@express_output)
|
211
211
|
end
|
@@ -222,9 +222,9 @@ module Lev
|
|
222
222
|
@active_job_enqueue_options || { queue: :default }
|
223
223
|
end
|
224
224
|
|
225
|
-
def perform_later(*args, &block)
|
225
|
+
def perform_later(*args, **kwargs, &block)
|
226
226
|
# Delegate to a subclass of Lev::Routine::ActiveJob::Base
|
227
|
-
job_class.new.perform_later(self, active_job_enqueue_options, *args, &block)
|
227
|
+
job_class.new.perform_later(self, active_job_enqueue_options, *args, **kwargs, &block)
|
228
228
|
end
|
229
229
|
|
230
230
|
# Called at a routine's class level to foretell which other routines will
|
@@ -279,7 +279,7 @@ module Lev
|
|
279
279
|
|
280
280
|
attr_reader :runner
|
281
281
|
|
282
|
-
def call(*args, &block)
|
282
|
+
def call(*args, **kwargs, &block)
|
283
283
|
@after_transaction_blocks = []
|
284
284
|
|
285
285
|
status.started!
|
@@ -290,9 +290,9 @@ module Lev
|
|
290
290
|
|
291
291
|
catch :fatal_errors_encountered do
|
292
292
|
if self.class.delegates_to
|
293
|
-
run(self.class.delegates_to, *args, &block)
|
293
|
+
run(self.class.delegates_to, *args, **kwargs, &block)
|
294
294
|
else
|
295
|
-
exec(*args, &block)
|
295
|
+
exec(*args, **kwargs, &block)
|
296
296
|
end
|
297
297
|
end
|
298
298
|
end
|
@@ -324,7 +324,7 @@ module Lev
|
|
324
324
|
who == topmost_runner && who.class.transaction_isolation != TransactionIsolation.no_transaction
|
325
325
|
end
|
326
326
|
|
327
|
-
def run(other_routine, *args, &block)
|
327
|
+
def run(other_routine, *args, **kwargs, &block)
|
328
328
|
options = {}
|
329
329
|
|
330
330
|
if other_routine.is_a? Array
|
@@ -395,7 +395,7 @@ module Lev
|
|
395
395
|
#
|
396
396
|
|
397
397
|
other_routine.runner = self
|
398
|
-
run_result = other_routine.call(*args, &block)
|
398
|
+
run_result = other_routine.call(*args, **kwargs, &block)
|
399
399
|
|
400
400
|
run_result.outputs.transfer_to(outputs) do |name|
|
401
401
|
output_mapper.map(name)
|
@@ -495,7 +495,15 @@ module Lev
|
|
495
495
|
def in_transaction(options={})
|
496
496
|
if transaction_run_by?(self)
|
497
497
|
isolation_symbol = self.class.transaction_isolation.symbol
|
498
|
-
if ActiveRecord::VERSION::MAJOR >=
|
498
|
+
if (ActiveRecord::VERSION::MAJOR >= 8 ||
|
499
|
+
(ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR >= 1)) &&
|
500
|
+
ActiveRecord::Base.connection.transaction_open?
|
501
|
+
# Don't even try to set transaction isolation if the transaction is already open
|
502
|
+
ActiveRecord::Base.transaction do
|
503
|
+
yield
|
504
|
+
raise ActiveRecord::Rollback if errors?
|
505
|
+
end
|
506
|
+
elsif ActiveRecord::VERSION::MAJOR >= 4
|
499
507
|
begin
|
500
508
|
ActiveRecord::Base.transaction(isolation: isolation_symbol) do
|
501
509
|
yield
|
data/lib/lev/version.rb
CHANGED
data/lib/lev.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -26,9 +26,9 @@ end
|
|
26
26
|
require 'lev'
|
27
27
|
require 'byebug'
|
28
28
|
|
29
|
-
require '
|
29
|
+
require 'open_stax_transaction_retry'
|
30
30
|
|
31
|
-
|
31
|
+
OpenStaxTransactionRetry.apply_activerecord_patch
|
32
32
|
|
33
33
|
Dir[(File.expand_path('../support', __FILE__)) + ("/**/*.rb")].each { |f| require f }
|
34
34
|
|
metadata
CHANGED
@@ -1,87 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actionpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
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: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: active_attr
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
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: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '6.1'
|
62
62
|
type: :runtime
|
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: '
|
68
|
+
version: '6.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: activerecord
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4.2'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: hashie
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: openstax_transaction_retry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: transaction_isolation
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -137,21 +137,21 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: jobba
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '2.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '2.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: rspec
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -179,19 +179,19 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: sqlite3
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: '
|
187
|
+
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
194
|
+
version: '0'
|
195
195
|
description: Ride the rails but don't touch them.
|
196
196
|
email:
|
197
197
|
- jps@kindlinglabs.com
|
@@ -249,7 +249,7 @@ homepage: http://github.com/lml/lev
|
|
249
249
|
licenses:
|
250
250
|
- MIT
|
251
251
|
metadata: {}
|
252
|
-
post_install_message:
|
252
|
+
post_install_message:
|
253
253
|
rdoc_options: []
|
254
254
|
require_paths:
|
255
255
|
- lib
|
@@ -264,28 +264,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0'
|
266
266
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
268
|
-
signing_key:
|
267
|
+
rubygems_version: 3.4.6
|
268
|
+
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Ride the rails but don't touch them.
|
271
271
|
test_files:
|
272
|
-
- spec/create_sprocket_spec.rb
|
273
|
-
- spec/paramify_handler_spec.rb
|
274
|
-
- spec/outputs_spec.rb
|
275
|
-
- spec/transaction_spec.rb
|
276
|
-
- spec/support/paramify_handler_a.rb
|
277
|
-
- spec/support/delegated_routine.rb
|
278
|
-
- spec/support/paramify_handler_b.rb
|
279
|
-
- spec/support/create_sprocket.rb
|
280
|
-
- spec/support/sprocket_handler.rb
|
281
|
-
- spec/support/delegating_routine.rb
|
282
|
-
- spec/support/sprocket.rb
|
283
|
-
- spec/statused_routines_spec.rb
|
284
|
-
- spec/active_model_errors_spec.rb
|
285
|
-
- spec/delegates_to_spec.rb
|
286
272
|
- spec/active_job_routines_spec.rb
|
273
|
+
- spec/active_model_errors_spec.rb
|
274
|
+
- spec/create_sprocket_spec.rb
|
287
275
|
- spec/deep_merge_spec.rb
|
276
|
+
- spec/delegates_to_spec.rb
|
277
|
+
- spec/outputs_spec.rb
|
278
|
+
- spec/paramify_handler_spec.rb
|
288
279
|
- spec/routine_spec.rb
|
289
|
-
- spec/sprocket_handler_spec.rb
|
290
280
|
- spec/spec_helper.rb
|
281
|
+
- spec/sprocket_handler_spec.rb
|
291
282
|
- spec/sprocket_spec.rb
|
283
|
+
- spec/statused_routines_spec.rb
|
284
|
+
- spec/support/create_sprocket.rb
|
285
|
+
- spec/support/delegated_routine.rb
|
286
|
+
- spec/support/delegating_routine.rb
|
287
|
+
- spec/support/paramify_handler_a.rb
|
288
|
+
- spec/support/paramify_handler_b.rb
|
289
|
+
- spec/support/sprocket.rb
|
290
|
+
- spec/support/sprocket_handler.rb
|
291
|
+
- spec/transaction_spec.rb
|