operationable 0.5.4 → 0.5.5
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/README.md +38 -0
- data/lib/operationable.rb +0 -3
- data/lib/operationable/version.rb +1 -1
- data/operationable.gemspec +1 -1
- metadata +1 -16
- data/lib/jobs/operation_job.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6edf66c7b75e60f58aa296b89200a5e19d19628c0b8d80b54369fb40cf5f232c
|
4
|
+
data.tar.gz: 60ac229144e1f919746746e86d7cdd373cb6aa619c81d650e13c64e8f3874a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f52d31a1f5e413efa3155071943b2eaf6a13c49bb3e12b5241969da6f90cec8434a14d32d4de3f693f4ef8c9f5343585e9450e1c9c78d62e12244072e5b0af5
|
7
|
+
data.tar.gz: 835fde7f0528eb95ec8bb3faf09844e2b8ae6134796676b40a89a643b103bdb01daa3c7b9e75a742e1b65c7470005d5ad2afab055472cb9cbd1cc14d79e141be
|
data/README.md
CHANGED
@@ -101,6 +101,44 @@ push_to_queue(callback_name, queue_name) if queue_name not passed, callback will
|
|
101
101
|
|
102
102
|
Operations work via ActiveJob, so you can use any adapter that you want.
|
103
103
|
|
104
|
+
### Job
|
105
|
+
|
106
|
+
I get rid of ActiveJob dependency. So, extend you exting job class with code below
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
class OpJob < ActiveJob::Base
|
110
|
+
queue_as do
|
111
|
+
arguments.first[:q_options][:queue]
|
112
|
+
end
|
113
|
+
|
114
|
+
def perform(q_options:, props:)
|
115
|
+
"Operationable::Runners::#{q_options[:type].capitalize}".constantize.call(q_options: q_options, props: props)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
```
|
120
|
+
|
121
|
+
Define job class name at your initializers (config/initializers/operationable.rb)
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
module Operationable
|
125
|
+
module Runners
|
126
|
+
class Base
|
127
|
+
def job_class
|
128
|
+
'OpJob'
|
129
|
+
end
|
130
|
+
|
131
|
+
# This is default behaviour, but you can redefine it, to use with other adapter
|
132
|
+
def perform(job_class_name, args)
|
133
|
+
job_class_name.to_s.constantize.method(perform_method).call(args)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
```
|
139
|
+
|
140
|
+
|
141
|
+
|
104
142
|
### Serializer
|
105
143
|
|
106
144
|
Serializer used to define what values should be passed to job(redis do not accept AR instances or other complex structures).
|
data/lib/operationable.rb
CHANGED
@@ -9,14 +9,11 @@ require 'operationable/callback'
|
|
9
9
|
require 'operationable/operation'
|
10
10
|
require 'operationable/serializer'
|
11
11
|
require 'operationable/specification'
|
12
|
-
require 'operationable/operationable_job'
|
13
12
|
|
14
13
|
require 'operationable/runners/base'
|
15
14
|
require 'operationable/runners/serial'
|
16
15
|
require 'operationable/runners/separate'
|
17
16
|
|
18
|
-
require 'jobs/operation_job'
|
19
|
-
|
20
17
|
require 'operations/create'
|
21
18
|
require 'operations/destroy'
|
22
19
|
require 'operations/update'
|
data/operationable.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.required_ruby_version = '>= 2.1.0'
|
24
24
|
|
25
|
-
spec.add_dependency 'activejob', '>= 4.2.0'
|
25
|
+
# spec.add_dependency 'activejob', '>= 4.2.0'
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.13"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: operationable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Suhodolov
|
@@ -11,20 +11,6 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2020-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: activejob
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 4.2.0
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 4.2.0
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: bundler
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +71,6 @@ files:
|
|
85
71
|
- Rakefile
|
86
72
|
- bin/console
|
87
73
|
- bin/setup
|
88
|
-
- lib/jobs/operation_job.rb
|
89
74
|
- lib/operationable.rb
|
90
75
|
- lib/operationable/builder.rb
|
91
76
|
- lib/operationable/callback.rb
|
data/lib/jobs/operation_job.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# TODO: use module instead
|
3
|
-
class OperationJob < ActiveJob::Base
|
4
|
-
queue_as do
|
5
|
-
arguments.first[:q_options][:queue]
|
6
|
-
end
|
7
|
-
|
8
|
-
def perform(q_options:, props:)
|
9
|
-
"Operationable::Runners::#{q_options[:type].capitalize}".constantize.call(q_options: q_options, props: props)
|
10
|
-
end
|
11
|
-
end
|