mandate-rails 0.2.0 → 0.3.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 +4 -4
- data/lib/mandate-rails/active_job_queuer.rb +46 -0
- data/lib/{mandate/rails → mandate-rails}/version.rb +1 -1
- data/lib/{mandate/rails.rb → mandate_rails.rb} +1 -2
- data/mandate-rails.gemspec +1 -3
- metadata +7 -8
- data/lib/mandate/rails/active_job_queuer.rb +0 -45
- data/sig/mandate/rails.rbs +0 -6
- /data/lib/{mandate/rails → mandate-rails}/mandate_job.rb +0 -0
- /data/lib/{mandate/rails → mandate-rails}/railtie.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c5944085c2064c68507785aa26a9e05576522a8b9795df76027af984c689255
|
4
|
+
data.tar.gz: f36146618848433239b9c32890a4618f532e9908f1b11446b7dec896920817aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e558be3adabd0ee0c2f5e286c1b9c149056d689d02bc4da80878730d294088a30471c5e25cce0650847e7c363497031e0a55152d4bb918ad5319a59b4a282f6
|
7
|
+
data.tar.gz: 64568ac4c34d30f141b381310b1db7ea2d96befd19761ce00bad1d0afe728db69724278994403092470af3055c5bfe086985b8f60a47206119bb7ac3da0ea387
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative "./mandate_job"
|
2
|
+
|
3
|
+
module Mandate
|
4
|
+
module ActiveJobQueuer
|
5
|
+
def self.extended(base)
|
6
|
+
class << base
|
7
|
+
def queue_as(queue)
|
8
|
+
@active_job_queue = queue
|
9
|
+
end
|
10
|
+
|
11
|
+
def active_job_queue
|
12
|
+
@active_job_queue || :default
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def defer(*args, wait: nil, **kwargs)
|
18
|
+
# We need to convert the jobs to a hash before we serialize as there's no serialization
|
19
|
+
# format for a job. We do this here to avoid cluttering the codebase with this logic.
|
20
|
+
if (prereqs = kwargs.delete(:prereq_jobs))
|
21
|
+
prereqs.map! do |job|
|
22
|
+
{
|
23
|
+
job_id: job.provider_job_id,
|
24
|
+
queue_name: job.queue_name
|
25
|
+
}
|
26
|
+
end
|
27
|
+
kwargs[:prereq_jobs] = prereqs if prereqs.present?
|
28
|
+
end
|
29
|
+
|
30
|
+
MandateJob.set(
|
31
|
+
queue: active_job_queue,
|
32
|
+
wait:
|
33
|
+
).perform_later(self.name, *args, **kwargs)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.included(base)
|
38
|
+
# Upstream
|
39
|
+
base.extend(Memoize)
|
40
|
+
base.extend(CallInjector)
|
41
|
+
base.extend(InitializerInjector)
|
42
|
+
|
43
|
+
# New
|
44
|
+
base.extend(ActiveJobQueuer)
|
45
|
+
end
|
46
|
+
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require "mandate"
|
2
|
-
require_relative "rails/version"
|
3
2
|
|
4
3
|
module MandateRails
|
5
4
|
class Error < StandardError; end
|
6
5
|
# Your code goes here...
|
7
6
|
end
|
8
7
|
|
9
|
-
require_relative "./rails/railtie" if defined?(Rails::Railtie)
|
8
|
+
require_relative "./mandate-rails/railtie" if defined?(Rails::Railtie)
|
data/mandate-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandate-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -21,13 +21,12 @@ files:
|
|
21
21
|
- LICENSE.txt
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
|
-
- lib/mandate/
|
25
|
-
- lib/mandate
|
26
|
-
- lib/mandate
|
27
|
-
- lib/mandate
|
28
|
-
- lib/
|
24
|
+
- lib/mandate-rails/active_job_queuer.rb
|
25
|
+
- lib/mandate-rails/mandate_job.rb
|
26
|
+
- lib/mandate-rails/railtie.rb
|
27
|
+
- lib/mandate-rails/version.rb
|
28
|
+
- lib/mandate_rails.rb
|
29
29
|
- mandate-rails.gemspec
|
30
|
-
- sig/mandate/rails.rbs
|
31
30
|
homepage:
|
32
31
|
licenses:
|
33
32
|
- MIT
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require_relative "./mandate_job"
|
2
|
-
module Mandate
|
3
|
-
module ActiveJobQueuer
|
4
|
-
def self.extended(base)
|
5
|
-
class << base
|
6
|
-
def queue_as(queue)
|
7
|
-
@active_job_queue = queue
|
8
|
-
end
|
9
|
-
|
10
|
-
def active_job_queue
|
11
|
-
@active_job_queue || :default
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def defer(*args, wait: nil, **kwargs)
|
17
|
-
# We need to convert the jobs to a hash before we serialize as there's no serialization
|
18
|
-
# format for a job. We do this here to avoid cluttering the codebase with this logic.
|
19
|
-
if (prereqs = kwargs.delete(:prereq_jobs))
|
20
|
-
prereqs.map! do |job|
|
21
|
-
{
|
22
|
-
job_id: job.provider_job_id,
|
23
|
-
queue_name: job.queue_name
|
24
|
-
}
|
25
|
-
end
|
26
|
-
kwargs[:prereq_jobs] = prereqs if prereqs.present?
|
27
|
-
end
|
28
|
-
|
29
|
-
MandateJob.set(
|
30
|
-
queue: active_job_queue,
|
31
|
-
wait:
|
32
|
-
).perform_later(self.name, *args, **kwargs)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.included(base)
|
37
|
-
# Upstream
|
38
|
-
base.extend(Memoize)
|
39
|
-
base.extend(CallInjector)
|
40
|
-
base.extend(InitializerInjector)
|
41
|
-
|
42
|
-
# New
|
43
|
-
base.extend(ActiveJobQueuer)
|
44
|
-
end
|
45
|
-
end
|
data/sig/mandate/rails.rbs
DELETED
File without changes
|
File without changes
|