services 7.3.1 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +43 -0
- data/Appraisals +4 -8
- data/CHANGELOG.md +150 -16
- data/Guardfile +1 -3
- data/README.md +4 -5
- data/gemfiles/{rails_4.2.gemfile → rails_6.0.gemfile} +1 -1
- data/gemfiles/{rails_5.0.gemfile → rails_6.1.gemfile} +1 -1
- data/lib/services/asyncable.rb +12 -13
- data/lib/services/base.rb +1 -1
- data/lib/services/modules/call_logger.rb +2 -2
- data/lib/services/modules/exception_wrapper.rb +1 -1
- data/lib/services/modules/uniqueness_checker.rb +4 -4
- data/lib/services/version.rb +1 -1
- data/lib/services.rb +30 -5
- data/services.gemspec +13 -7
- data/spec/services/modules/call_logger_spec.rb +1 -1
- data/spec/services/query_spec.rb +1 -1
- data/spec/support/helpers.rb +4 -4
- data/spec/support/test_services.rb +2 -2
- metadata +14 -14
- data/.travis.yml +0 -15
- data/gemfiles/rails_5.1.gemfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f65a0f459ea156e6523031658753b0128be29712385cfe4d2fc32f1c39e6b5
|
4
|
+
data.tar.gz: 5d0532802156ea0d3e4cbdc3c2a5189a7a16e580efeb989b7b6dec265d566cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52cf70d2876bcf2714dceebe3dba990e58fce96d2196e290667eb95513c470895a8819addaf6d7b37dd3b9973877a2251b887696aa6fbdcddda3c41eb046b6aa
|
7
|
+
data.tar.gz: 0523c7bb4b44635870a14caa242900ed93605ad5607bd21c93206bf06bfa6e1c911490e319c769425f1ab6d8d928d6477ef6f2dfebadb7f0ed7fa46a28a008e1
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
|
6
|
+
tests:
|
7
|
+
name: Tests
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
env:
|
11
|
+
RAILS_ENV: test
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby_version:
|
17
|
+
- 3.0
|
18
|
+
- 2.7
|
19
|
+
|
20
|
+
services:
|
21
|
+
|
22
|
+
redis:
|
23
|
+
image: redis
|
24
|
+
options: --entrypoint redis-server
|
25
|
+
ports:
|
26
|
+
- 6379:6379
|
27
|
+
|
28
|
+
steps:
|
29
|
+
|
30
|
+
- name: Check out code
|
31
|
+
uses: actions/checkout@v2
|
32
|
+
|
33
|
+
- name: Set up Ruby
|
34
|
+
uses: ruby/setup-ruby@v1
|
35
|
+
with:
|
36
|
+
ruby-version: ${{ matrix.ruby_version }}
|
37
|
+
bundler-cache: true
|
38
|
+
|
39
|
+
- name: Install gems
|
40
|
+
run: bundle exec appraisal install
|
41
|
+
|
42
|
+
- name: Run tests
|
43
|
+
run: bundle exec appraisal rspec
|
data/Appraisals
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
appraise '
|
2
|
-
gem 'rails', '~>
|
1
|
+
appraise 'rails_6.0' do
|
2
|
+
gem 'rails', '~> 6.0.0'
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise '
|
6
|
-
gem 'rails', '~>
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise 'rails_5.1' do
|
10
|
-
gem 'rails', '~> 5.1.0'
|
5
|
+
appraise 'rails_6.1' do
|
6
|
+
gem 'rails', '~> 6.1.0'
|
11
7
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,152 @@
|
|
1
|
+
## 9.0.0
|
2
|
+
|
3
|
+
* Drop support for Rails 5.2 and Ruby 2.6
|
4
|
+
* Exclude test files from release
|
5
|
+
* Add CI via GitHub Actions
|
6
|
+
* Make replacing ActiveRecord records in asyncable params more robust
|
7
|
+
* When calling a service async, make args and kwargs available as ivars
|
8
|
+
|
9
|
+
## 8.0.1
|
10
|
+
|
11
|
+
* add missing `to_s`
|
12
|
+
|
13
|
+
## 8.0.0
|
14
|
+
|
15
|
+
* handle kwargs correctly
|
16
|
+
* test with current rails versions
|
17
|
+
|
18
|
+
## 7.3.3
|
19
|
+
|
20
|
+
* fix typo
|
21
|
+
* increase cache time to 30 days
|
22
|
+
|
23
|
+
## 7.3.1
|
24
|
+
|
25
|
+
* fix loading background processor
|
26
|
+
|
27
|
+
## 7.3.0
|
28
|
+
|
29
|
+
* allow using sucker_punch instead of sidekiq
|
30
|
+
* allow setting the method arity when allowing class method to be used in queries, since scopes shadow the arity of their procs
|
31
|
+
|
32
|
+
## 7.2.0
|
33
|
+
|
34
|
+
* enable using class methods in queries
|
35
|
+
|
36
|
+
## 7.1.2
|
37
|
+
|
38
|
+
* use select instead of pluck
|
39
|
+
|
40
|
+
## 7.1.1
|
41
|
+
|
42
|
+
* fix typos
|
43
|
+
|
44
|
+
## 7.1.0
|
45
|
+
|
46
|
+
* fix joining order classes
|
47
|
+
* refactor, formatting
|
48
|
+
|
49
|
+
## 7.0.3
|
50
|
+
|
51
|
+
* fix identifying call method when calling service async
|
52
|
+
* remove gemnasium badge
|
53
|
+
* fix "buy me a coffee" link
|
54
|
+
* add "buy me a coffee" link to readme
|
55
|
+
|
56
|
+
## 7.0.2
|
57
|
+
|
58
|
+
* symbolize hash keys for arguments to call method when kwargs are used
|
59
|
+
* dont modify args
|
60
|
+
* fix spec
|
61
|
+
* fix specs and readme
|
62
|
+
|
63
|
+
## 7.0.1
|
64
|
+
|
65
|
+
* add table name to condition
|
66
|
+
|
67
|
+
## 7.0.0
|
68
|
+
|
69
|
+
* add created_after and created_before as default conditions, allow overriding default conditions in query object
|
70
|
+
|
71
|
+
## 6.0.5
|
72
|
+
|
73
|
+
* Revert "set default order for query if it was set to nil"
|
74
|
+
|
75
|
+
## 6.0.4
|
76
|
+
|
77
|
+
* automatically add LEFT OUTER JOIN when trying to sort by a field on an association table
|
78
|
+
* set default order for query if it was set to nil
|
79
|
+
|
80
|
+
## 6.0.3
|
81
|
+
|
82
|
+
* allow calling query service without params
|
83
|
+
|
84
|
+
## 6.0.2
|
85
|
+
|
86
|
+
* add id_not as special query condition
|
87
|
+
|
88
|
+
## 6.0.1
|
89
|
+
|
90
|
+
* allow calling query object with only arguments
|
91
|
+
* update sidekiq dev dependency to 5.x
|
92
|
+
* remove encoding comment
|
93
|
+
* add missing require
|
94
|
+
* syntax
|
95
|
+
|
96
|
+
## 6.0.0
|
97
|
+
|
98
|
+
* dont specify ruby patchlevels in travis config
|
99
|
+
* use globalid to make args serializable
|
100
|
+
* remove bulk call async method
|
101
|
+
* remove async instance methods from services
|
102
|
+
|
103
|
+
## 5.1.2
|
104
|
+
|
105
|
+
* dup passed in scope in query class before using it
|
106
|
+
* fix specs for ruby < 2.4
|
107
|
+
* update rails 5.1 to released version
|
108
|
+
* update travis config
|
109
|
+
* stop supporting rails 4.0 and 4.1, add 5.1.rc1
|
110
|
+
|
111
|
+
## 5.1.1
|
112
|
+
|
113
|
+
* replace Fixnum with Integer to silence Ruby 2.4 warnings
|
114
|
+
* update ruby versions in travis config
|
115
|
+
* update travis config
|
116
|
+
* update ruby versions in travis config
|
117
|
+
* update travis build matrix, dont test ruby 2.4.0 with rails 4.0 or 4.1, allow ruby 2.4.0 with rails 4.2 to fail for now (until rails 4.2.8 is released with
|
118
|
+
out json 1.x dependency)
|
119
|
+
* increase sleep and waiting time in specs
|
120
|
+
* require active_record explicitly
|
121
|
+
* fix specs
|
122
|
+
|
123
|
+
## 5.1.0
|
124
|
+
|
125
|
+
* test with ruby 2.4.0, clarify version requirements for ruby and redis
|
126
|
+
* update sidekiq dev dependency to ~> 4.0
|
127
|
+
* allow passing scope to query call
|
128
|
+
|
129
|
+
## 5.0.0
|
130
|
+
|
131
|
+
* freeze constants
|
132
|
+
* use #public_send instead of #send where possible
|
133
|
+
* rename perform_* methods to call_*, closes #6
|
134
|
+
|
135
|
+
## 4.3.0
|
136
|
+
|
137
|
+
* update travis config
|
138
|
+
* use pluck only on activerecord relations, from activesupport 5 on all enumerables respond to #pluck, which will call #[] on the contained objects [Manuel M
|
139
|
+
eurer]
|
140
|
+
* drop support for rails 3.2, add appraisal for testing
|
141
|
+
* update readme
|
142
|
+
* update ruby dependency in readme
|
143
|
+
* update travis config
|
144
|
+
|
145
|
+
## 4.1.4
|
146
|
+
|
147
|
+
* update changelog
|
148
|
+
* fix finding find service class
|
149
|
+
|
1
150
|
## 4.1.3
|
2
151
|
|
3
152
|
* Fix finding the find service class
|
@@ -29,9 +178,6 @@
|
|
29
178
|
## 3.1.1
|
30
179
|
|
31
180
|
* Query does not have its own error, raise ArgumentError instead
|
32
|
-
|
33
|
-
## 3.1.0
|
34
|
-
|
35
181
|
* Verify that query ids parameter is not nil
|
36
182
|
|
37
183
|
## 3.0.1
|
@@ -91,16 +237,4 @@
|
|
91
237
|
|
92
238
|
## 1.0.0
|
93
239
|
|
94
|
-
*
|
95
|
-
* Moved file logger to separate class
|
96
|
-
* Don't initialize file logger automatically for Rails apps anymore
|
97
|
-
* Changed argument order for Redis and file logger, made `tags` parameter optional
|
98
|
-
|
99
|
-
## 0.4.0
|
100
|
-
|
101
|
-
* Renamed `service_class` helper to `object_class`
|
102
|
-
|
103
|
-
## 0.3.4
|
104
|
-
|
105
|
-
* Added `BaseFinder`
|
106
|
-
* Updated uniqueness key
|
240
|
+
* First stable version
|
data/Guardfile
CHANGED
@@ -68,9 +68,7 @@ guard 'rspec', cmd: 'bundle exec appraisal rspec' do
|
|
68
68
|
|
69
69
|
# Specs
|
70
70
|
watch(%r(^spec/.+_spec\.rb$))
|
71
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
72
|
-
watch(%r(^spec/support/(.+)\.rb$)) { 'spec' }
|
73
71
|
|
74
72
|
# Files
|
75
|
-
watch(%r(^lib/(.+)\.rb$))
|
73
|
+
watch(%r(^lib/(.+)\.rb$)) { "spec/#{_1[1]}_spec.rb" }
|
76
74
|
end
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Services
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/services.png)](http://badge.fury.io/rb/services)
|
4
|
-
[![
|
5
|
-
[![Code Climate](https://codeclimate.com/github/krautcomputing/services.png)](https://codeclimate.com/github/krautcomputing/services)
|
4
|
+
[![CI](https://github.com/manuelmeurer/services/actions/workflows/ci.yml/badge.svg)](https://github.com/manuelmeurer/services/actions/workflows/ci.yml)
|
6
5
|
|
7
6
|
Services is a collection of modules and base classes that let you simply add a service layer to your Rails app.
|
8
7
|
|
@@ -18,9 +17,9 @@ For disambiguation: in this README, when you read "Services" with a uppercase "S
|
|
18
17
|
|
19
18
|
### Requirements
|
20
19
|
|
21
|
-
#### Ruby >= 2.
|
20
|
+
#### Ruby >= 2.7
|
22
21
|
|
23
|
-
#### Rails >=
|
22
|
+
#### Rails >= 6.0
|
24
23
|
|
25
24
|
#### Redis >= 3.0
|
26
25
|
|
@@ -28,7 +27,7 @@ Redis is used at several points, e.g. to store information about the currently r
|
|
28
27
|
|
29
28
|
#### Postgres (optional)
|
30
29
|
|
31
|
-
The SQL that `Services::Query` (discussed further down) generates is optimized for Postgres. It might work with other databases but it's not guaranteed. If you're not using Postgres, you can still use all other parts of Services, just don't use `Services::Query` or, even better, submit a [pull request](https://github.com/
|
30
|
+
The SQL that `Services::Query` (discussed further down) generates is optimized for Postgres. It might work with other databases but it's not guaranteed. If you're not using Postgres, you can still use all other parts of Services, just don't use `Services::Query` or, even better, submit a [pull request](https://github.com/manuelmeurer/services/issues) that fixes it to work with your database!
|
32
31
|
|
33
32
|
#### Sidekiq (optional)
|
34
33
|
|
data/lib/services/asyncable.rb
CHANGED
@@ -33,23 +33,15 @@ module Services
|
|
33
33
|
module ClassMethods
|
34
34
|
ASYNC_METHOD_SUFFIXES.each do |async_method_suffix|
|
35
35
|
define_method "call_#{async_method_suffix}" do |*args|
|
36
|
-
args = args.map
|
37
|
-
arg.respond_to?(:to_global_id) ? arg.to_global_id : arg
|
38
|
-
end
|
36
|
+
args = args.map(&Services.method(:replace_records_with_global_ids))
|
39
37
|
self.public_send "perform_#{async_method_suffix}", *args
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
42
|
def perform(*args)
|
45
|
-
args = args.map
|
46
|
-
GlobalID::Locator.locate(arg) || arg
|
47
|
-
end
|
43
|
+
args = args.map(&Services.method(:replace_global_ids_with_records))
|
48
44
|
|
49
|
-
# If the `call` method takes any kwargs and the last argument is a hash, symbolize the hash keys,
|
50
|
-
# otherwise they won't be recognized as kwards when splatted.
|
51
|
-
# Since the arguments to `perform` are serialized to the database before Sidekiq picks them up,
|
52
|
-
# symbol keys are converted to strings.
|
53
45
|
call_method = method(:call)
|
54
46
|
|
55
47
|
# Find the first class that inherits from `Services::Base`.
|
@@ -57,11 +49,18 @@ module Services
|
|
57
49
|
call_method = call_method.super_method
|
58
50
|
end
|
59
51
|
|
60
|
-
|
61
|
-
|
52
|
+
# If the `call` method takes any kwargs and the last argument is a hash, pass them to the method as kwargs.
|
53
|
+
kwargs = if call_method.parameters.map(&:first).grep(/\Akey/).any? && args.last.is_a?(Hash)
|
54
|
+
args.pop.symbolize_keys
|
55
|
+
else
|
56
|
+
{}
|
62
57
|
end
|
63
58
|
|
64
|
-
|
59
|
+
# Save args and kwargs in ivars so they can be used
|
60
|
+
# in the service, i.e. for rescheduling.
|
61
|
+
@_call_args, @_call_kwargs = args, kwargs
|
62
|
+
|
63
|
+
call *args, **kwargs
|
65
64
|
end
|
66
65
|
end
|
67
66
|
end
|
data/lib/services/base.rb
CHANGED
@@ -27,9 +27,9 @@ module Services
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def call(*args)
|
30
|
+
def call(*args, **kwargs)
|
31
31
|
unless self.class.call_logging_disabled
|
32
|
-
log "START with args: #{args}", caller: caller
|
32
|
+
log "START with args: #{args}, kwargs: #{kwargs}", caller: caller
|
33
33
|
start = Time.now
|
34
34
|
end
|
35
35
|
begin
|
@@ -14,7 +14,7 @@ module Services
|
|
14
14
|
).freeze
|
15
15
|
|
16
16
|
MAX_RETRIES = 10.freeze
|
17
|
-
|
17
|
+
THIRTY_DAYS = (60 * 60 * 24 * 30).freeze
|
18
18
|
|
19
19
|
def self.prepended(mod)
|
20
20
|
mod.const_set :NotUniqueError, Class.new(mod::Error)
|
@@ -37,12 +37,12 @@ module Services
|
|
37
37
|
else
|
38
38
|
@_uniqueness_keys ||= []
|
39
39
|
@_uniqueness_keys << new_uniqueness_key
|
40
|
-
Services.redis.setex new_uniqueness_key,
|
40
|
+
Services.redis.setex new_uniqueness_key, THIRTY_DAYS, @id
|
41
41
|
true
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def call(*args)
|
45
|
+
def call(*args, **kwargs)
|
46
46
|
@_service_args = args
|
47
47
|
super
|
48
48
|
rescue self.class::NotUniqueError => e
|
@@ -103,7 +103,7 @@ module Services
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def increase_error_count
|
106
|
-
Services.redis.setex error_count_key, retry_delay +
|
106
|
+
Services.redis.setex error_count_key, retry_delay + THIRTY_DAYS, error_count + 1
|
107
107
|
end
|
108
108
|
|
109
109
|
def uniqueness_key(args)
|
data/lib/services/version.rb
CHANGED
data/lib/services.rb
CHANGED
@@ -14,12 +14,37 @@ module Services
|
|
14
14
|
has :allowed_class_methods_in_queries, default: {}
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
class << self
|
18
|
+
def redis
|
19
|
+
@redis ||= configuration.redis || (defined?(Redis.current) && Redis.current) or fail RedisNotFound, 'Redis not configured.'
|
20
|
+
end
|
21
|
+
|
22
|
+
def allow_class_method_in_queries(klass, method, arity = nil)
|
23
|
+
(configuration.allowed_class_methods_in_queries[klass.to_s] ||= {})[method.to_sym] = arity
|
24
|
+
end
|
25
|
+
|
26
|
+
def replace_records_with_global_ids(arg)
|
27
|
+
method = method(__method__)
|
28
|
+
|
29
|
+
case arg
|
30
|
+
when Array then arg.map(&method)
|
31
|
+
when Hash then arg.transform_keys(&method)
|
32
|
+
.transform_values(&method)
|
33
|
+
else arg.respond_to?(:to_global_id) ? "_#{arg.to_global_id.to_s}" : arg
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def replace_global_ids_with_records(arg)
|
38
|
+
method = method(__method__)
|
20
39
|
|
21
|
-
|
22
|
-
|
40
|
+
case arg
|
41
|
+
when Array then arg.map(&method)
|
42
|
+
when Hash then arg.transform_keys(&method)
|
43
|
+
.transform_values(&method)
|
44
|
+
when String then (arg.starts_with?("_") && GlobalID::Locator.locate(arg[1..-1])) || arg
|
45
|
+
else arg
|
46
|
+
end
|
47
|
+
end
|
23
48
|
end
|
24
49
|
end
|
25
50
|
|
data/services.gemspec
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
lib = File.expand_path('../lib', __FILE__)
|
2
|
-
|
2
|
+
|
3
|
+
unless $LOAD_PATH.include?(lib)
|
4
|
+
$LOAD_PATH.unshift(lib)
|
5
|
+
end
|
3
6
|
|
4
7
|
require 'services/version'
|
5
8
|
|
6
9
|
Gem::Specification.new do |gem|
|
10
|
+
files = `git ls-files`.split($/)
|
11
|
+
test_files = files.grep(%r(^spec/))
|
12
|
+
|
7
13
|
gem.name = 'services'
|
8
14
|
gem.version = Services::VERSION
|
9
15
|
gem.platform = Gem::Platform::RUBY
|
@@ -11,12 +17,12 @@ Gem::Specification.new do |gem|
|
|
11
17
|
gem.email = 'manuel@krautcomputing.com'
|
12
18
|
gem.summary = 'A nifty service layer for your Rails app'
|
13
19
|
gem.description = 'A nifty service layer for your Rails app'
|
14
|
-
gem.homepage = '
|
20
|
+
gem.homepage = 'https://manuelmeurer.com/services/'
|
15
21
|
gem.license = 'MIT'
|
16
|
-
gem.required_ruby_version = '>= 2.
|
17
|
-
gem.files =
|
18
|
-
gem.executables = gem.files.grep(%r(
|
19
|
-
gem.test_files =
|
22
|
+
gem.required_ruby_version = '>= 2.7'
|
23
|
+
gem.files = files - test_files
|
24
|
+
gem.executables = gem.files.grep(%r(\Abin/)).map(&File.method(:basename))
|
25
|
+
gem.test_files = test_files
|
20
26
|
gem.require_paths = ['lib']
|
21
27
|
|
22
28
|
gem.add_development_dependency 'rake', '>= 0.9.0'
|
@@ -29,6 +35,6 @@ Gem::Specification.new do |gem|
|
|
29
35
|
gem.add_development_dependency 'timecop', '~> 0.7'
|
30
36
|
gem.add_development_dependency 'sqlite3', '~> 1.3'
|
31
37
|
gem.add_development_dependency 'appraisal', '~> 2.1'
|
32
|
-
gem.add_runtime_dependency 'rails', '>=
|
38
|
+
gem.add_runtime_dependency 'rails', '>= 6.0'
|
33
39
|
gem.add_runtime_dependency 'gem_config', '~> 0.3'
|
34
40
|
end
|
@@ -9,7 +9,7 @@ describe Services::Base::CallLogger do
|
|
9
9
|
service.call *args
|
10
10
|
caller_regex = /\A#{Regexp.escape __FILE__}:\d+\z/
|
11
11
|
expect(logs.first).to match(
|
12
|
-
message: "START with args: #{args}",
|
12
|
+
message: "START with args: #{args}, kwargs: {}",
|
13
13
|
meta: {
|
14
14
|
caller: a_string_matching(caller_regex),
|
15
15
|
service: service.class.to_s,
|
data/spec/services/query_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Services::Query do
|
|
16
16
|
{
|
17
17
|
comment => comment.id,
|
18
18
|
comments => comments.map(&:id),
|
19
|
-
Comment.all => Comment.all.
|
19
|
+
Comment.all => Comment.all.map { |comment| { id: comment.id } }
|
20
20
|
}.each do |condition_before, condition_after|
|
21
21
|
expect { Services::Posts::FindRaiseConditions.call [], comment: condition_before }.to raise_error({ comment_id: condition_after }.to_json)
|
22
22
|
end
|
data/spec/support/helpers.rb
CHANGED
@@ -20,15 +20,15 @@ def wait_for_all_jobs_to_finish
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def wait_for_job_to_run(job_class, *args, &block)
|
24
|
-
job_class.call_async(*args).tap do |jid|
|
23
|
+
def wait_for_job_to_run(job_class, *args, **kwargs, &block)
|
24
|
+
job_class.call_async(*args, **kwargs).tap do |jid|
|
25
25
|
wait_for { worker_with_jid(jid) }
|
26
26
|
block.call if block_given?
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def wait_for_job_to_run_and_finish(job_class, *args, &block)
|
31
|
-
wait_for_job_to_run(job_class, *args, &block).tap do |jid|
|
30
|
+
def wait_for_job_to_run_and_finish(job_class, *args, **kwargs, &block)
|
31
|
+
wait_for_job_to_run(job_class, *args, **kwargs, &block).tap do |jid|
|
32
32
|
wait_for { worker_with_jid(jid).nil? }
|
33
33
|
end
|
34
34
|
end
|
@@ -81,14 +81,14 @@ module Services
|
|
81
81
|
end
|
82
82
|
|
83
83
|
class EmptyService < Services::Base
|
84
|
-
def call(*args)
|
84
|
+
def call(*args, **kwargs)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
88
|
class EmptyServiceWithoutCallLogging < Services::Base
|
89
89
|
disable_call_logging
|
90
90
|
|
91
|
-
def call(*args)
|
91
|
+
def call(*args, **kwargs)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '6.0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '6.0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: gem_config
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,8 +184,9 @@ executables: []
|
|
184
184
|
extensions: []
|
185
185
|
extra_rdoc_files: []
|
186
186
|
files:
|
187
|
+
- ".github/dependabot.yml"
|
188
|
+
- ".github/workflows/ci.yml"
|
187
189
|
- ".gitignore"
|
188
|
-
- ".travis.yml"
|
189
190
|
- Appraisals
|
190
191
|
- CHANGELOG.md
|
191
192
|
- Gemfile
|
@@ -193,9 +194,8 @@ files:
|
|
193
194
|
- LICENSE.txt
|
194
195
|
- README.md
|
195
196
|
- Rakefile
|
196
|
-
- gemfiles/
|
197
|
-
- gemfiles/
|
198
|
-
- gemfiles/rails_5.1.gemfile
|
197
|
+
- gemfiles/rails_6.0.gemfile
|
198
|
+
- gemfiles/rails_6.1.gemfile
|
199
199
|
- lib/services.rb
|
200
200
|
- lib/services/asyncable.rb
|
201
201
|
- lib/services/base.rb
|
@@ -227,11 +227,11 @@ files:
|
|
227
227
|
- spec/support/redis-server
|
228
228
|
- spec/support/shared.rb
|
229
229
|
- spec/support/test_services.rb
|
230
|
-
homepage:
|
230
|
+
homepage: https://manuelmeurer.com/services/
|
231
231
|
licenses:
|
232
232
|
- MIT
|
233
233
|
metadata: {}
|
234
|
-
post_install_message:
|
234
|
+
post_install_message:
|
235
235
|
rdoc_options: []
|
236
236
|
require_paths:
|
237
237
|
- lib
|
@@ -239,15 +239,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
requirements:
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version: 2.
|
242
|
+
version: '2.7'
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
requirements:
|
245
245
|
- - ">="
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
|
-
rubygems_version: 3.
|
250
|
-
signing_key:
|
249
|
+
rubygems_version: 3.2.23
|
250
|
+
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: A nifty service layer for your Rails app
|
253
253
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
rvm:
|
4
|
-
- 2.2
|
5
|
-
- 2.3
|
6
|
-
- 2.4
|
7
|
-
services:
|
8
|
-
- redis-server
|
9
|
-
before_install:
|
10
|
-
- gem update --system
|
11
|
-
- gem update bundler
|
12
|
-
gemfile:
|
13
|
-
- gemfiles/rails_4.2.gemfile
|
14
|
-
- gemfiles/rails_5.0.gemfile
|
15
|
-
- gemfiles/rails_5.1.gemfile
|