resol 0.7.1 → 0.8.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/.github/workflows/test.yml +2 -2
- data/Gemfile.lock +47 -49
- data/lib/resol/service.rb +34 -10
- data/lib/resol/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4eb71da351b1379daa165b6223a0bb9fd2ff2ae5fd3436642b7cfdc782413917
|
|
4
|
+
data.tar.gz: 62712882caa637dfcfbf9a8f25e1026afeed72cea67c677acdf93c6802ac5cb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ae925f82e9deda9fa0c180976a446aff26822eb39e20371065d5e1c185e0473e0ae4e7811dd5f9c07cb09205bec9a3eec5b0458d0a807a81daaf1313133d09d
|
|
7
|
+
data.tar.gz: 5942e294f2a6e99386802e1d2848b6f754a6d8700268aa57079099058e161dd481d4aaec1000eb835dd80ab699f9e5ec2670a54038481dff4c42d324b1d803c5
|
data/.github/workflows/test.yml
CHANGED
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
- uses: actions/checkout@v2
|
|
17
17
|
- uses: ruby/setup-ruby@v1
|
|
18
18
|
with:
|
|
19
|
-
ruby-version: 3
|
|
19
|
+
ruby-version: "3.1"
|
|
20
20
|
bundler-cache: true
|
|
21
21
|
- name: Run Linter
|
|
22
22
|
run: bundle exec ci-helper RubocopLint
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
strategy:
|
|
44
44
|
fail-fast: false
|
|
45
45
|
matrix:
|
|
46
|
-
ruby: [2.7]
|
|
46
|
+
ruby: ["2.7", "3.0"]
|
|
47
47
|
experimental: [false]
|
|
48
48
|
include:
|
|
49
49
|
- ruby: head
|
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
resol (0.
|
|
4
|
+
resol (0.8.0)
|
|
5
5
|
smart_initializer (~> 0.7)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activesupport (
|
|
10
|
+
activesupport (7.0.2.2)
|
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
12
|
i18n (>= 1.6, < 2)
|
|
13
13
|
minitest (>= 5.1)
|
|
14
14
|
tzinfo (~> 2.0)
|
|
15
|
-
zeitwerk (~> 2.3)
|
|
16
15
|
ast (2.4.2)
|
|
17
16
|
bundler-audit (0.9.0.1)
|
|
18
17
|
bundler (>= 1.2.0, < 3)
|
|
@@ -24,97 +23,96 @@ GEM
|
|
|
24
23
|
coderay (1.1.3)
|
|
25
24
|
colorize (0.8.1)
|
|
26
25
|
concurrent-ruby (1.1.9)
|
|
27
|
-
diff-lcs (1.
|
|
26
|
+
diff-lcs (1.5.0)
|
|
28
27
|
docile (1.4.0)
|
|
29
28
|
dry-inflector (0.2.1)
|
|
30
|
-
i18n (1.
|
|
29
|
+
i18n (1.10.0)
|
|
31
30
|
concurrent-ruby (~> 1.0)
|
|
32
31
|
method_source (1.0.0)
|
|
33
|
-
minitest (5.
|
|
32
|
+
minitest (5.15.0)
|
|
34
33
|
parallel (1.21.0)
|
|
35
|
-
parser (3.
|
|
34
|
+
parser (3.1.1.0)
|
|
36
35
|
ast (~> 2.4.1)
|
|
37
36
|
pry (0.14.1)
|
|
38
37
|
coderay (~> 1.1)
|
|
39
38
|
method_source (~> 1.0)
|
|
40
|
-
qonfig (0.
|
|
39
|
+
qonfig (0.27.0)
|
|
41
40
|
rack (2.2.3)
|
|
42
|
-
rainbow (3.
|
|
41
|
+
rainbow (3.1.1)
|
|
43
42
|
rake (13.0.6)
|
|
44
|
-
regexp_parser (2.2.
|
|
43
|
+
regexp_parser (2.2.1)
|
|
45
44
|
rexml (3.2.5)
|
|
46
|
-
rspec (3.
|
|
47
|
-
rspec-core (~> 3.
|
|
48
|
-
rspec-expectations (~> 3.
|
|
49
|
-
rspec-mocks (~> 3.
|
|
50
|
-
rspec-core (3.
|
|
51
|
-
rspec-support (~> 3.
|
|
52
|
-
rspec-expectations (3.
|
|
45
|
+
rspec (3.11.0)
|
|
46
|
+
rspec-core (~> 3.11.0)
|
|
47
|
+
rspec-expectations (~> 3.11.0)
|
|
48
|
+
rspec-mocks (~> 3.11.0)
|
|
49
|
+
rspec-core (3.11.0)
|
|
50
|
+
rspec-support (~> 3.11.0)
|
|
51
|
+
rspec-expectations (3.11.0)
|
|
53
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
54
|
-
rspec-support (~> 3.
|
|
55
|
-
rspec-mocks (3.
|
|
53
|
+
rspec-support (~> 3.11.0)
|
|
54
|
+
rspec-mocks (3.11.0)
|
|
56
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
|
-
rspec-support (~> 3.
|
|
58
|
-
rspec-support (3.
|
|
59
|
-
rubocop (1.
|
|
56
|
+
rspec-support (~> 3.11.0)
|
|
57
|
+
rspec-support (3.11.0)
|
|
58
|
+
rubocop (1.25.1)
|
|
60
59
|
parallel (~> 1.10)
|
|
61
|
-
parser (>= 3.
|
|
60
|
+
parser (>= 3.1.0.0)
|
|
62
61
|
rainbow (>= 2.2.2, < 4.0)
|
|
63
62
|
regexp_parser (>= 1.8, < 3.0)
|
|
64
63
|
rexml
|
|
65
|
-
rubocop-ast (>= 1.
|
|
64
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
|
66
65
|
ruby-progressbar (~> 1.7)
|
|
67
66
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
68
|
-
rubocop-ast (1.
|
|
69
|
-
parser (>= 3.
|
|
70
|
-
rubocop-config-umbrellio (1.
|
|
71
|
-
rubocop (
|
|
72
|
-
rubocop-performance (
|
|
73
|
-
rubocop-rails (
|
|
74
|
-
rubocop-rake (
|
|
75
|
-
rubocop-rspec (
|
|
76
|
-
rubocop-sequel (
|
|
77
|
-
rubocop-performance (1.
|
|
78
|
-
rubocop (>=
|
|
67
|
+
rubocop-ast (1.16.0)
|
|
68
|
+
parser (>= 3.1.1.0)
|
|
69
|
+
rubocop-config-umbrellio (1.25.0.61)
|
|
70
|
+
rubocop (~> 1.25.0)
|
|
71
|
+
rubocop-performance (~> 1.13.0)
|
|
72
|
+
rubocop-rails (~> 2.13.0)
|
|
73
|
+
rubocop-rake (~> 0.6.0)
|
|
74
|
+
rubocop-rspec (~> 2.7.0)
|
|
75
|
+
rubocop-sequel (~> 0.3.3)
|
|
76
|
+
rubocop-performance (1.13.2)
|
|
77
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
79
78
|
rubocop-ast (>= 0.4.0)
|
|
80
|
-
rubocop-rails (2.
|
|
79
|
+
rubocop-rails (2.13.2)
|
|
81
80
|
activesupport (>= 4.2.0)
|
|
82
81
|
rack (>= 1.1)
|
|
83
|
-
rubocop (>=
|
|
84
|
-
rubocop-rake (0.
|
|
85
|
-
rubocop
|
|
86
|
-
rubocop-rspec (2.2.0)
|
|
82
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
83
|
+
rubocop-rake (0.6.0)
|
|
87
84
|
rubocop (~> 1.0)
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
rubocop-rspec (2.7.0)
|
|
86
|
+
rubocop (~> 1.19)
|
|
87
|
+
rubocop-sequel (0.3.3)
|
|
90
88
|
rubocop (~> 1.0)
|
|
91
89
|
ruby-progressbar (1.11.0)
|
|
92
|
-
sequel (5.
|
|
90
|
+
sequel (5.54.0)
|
|
93
91
|
simplecov (0.21.2)
|
|
94
92
|
docile (~> 1.1)
|
|
95
93
|
simplecov-html (~> 0.11)
|
|
96
94
|
simplecov_json_formatter (~> 0.1)
|
|
97
95
|
simplecov-html (0.12.3)
|
|
98
96
|
simplecov-lcov (0.8.0)
|
|
99
|
-
simplecov_json_formatter (0.1.
|
|
100
|
-
smart_engine (0.
|
|
101
|
-
smart_initializer (0.
|
|
97
|
+
simplecov_json_formatter (0.1.4)
|
|
98
|
+
smart_engine (0.12.0)
|
|
99
|
+
smart_initializer (0.9.0)
|
|
102
100
|
qonfig (~> 0.24)
|
|
103
101
|
smart_engine (~> 0.11)
|
|
104
102
|
smart_types (~> 0.4)
|
|
105
103
|
smart_types (0.7.0)
|
|
106
104
|
smart_engine (~> 0.11)
|
|
107
105
|
symbiont-ruby (0.7.0)
|
|
108
|
-
thor (1.1
|
|
106
|
+
thor (1.2.1)
|
|
109
107
|
tzinfo (2.0.4)
|
|
110
108
|
concurrent-ruby (~> 1.0)
|
|
111
109
|
umbrellio-sequel-plugins (0.5.1.27)
|
|
112
110
|
sequel
|
|
113
111
|
symbiont-ruby
|
|
114
112
|
unicode-display_width (2.1.0)
|
|
115
|
-
zeitwerk (2.5.1)
|
|
116
113
|
|
|
117
114
|
PLATFORMS
|
|
115
|
+
arm64-darwin-21
|
|
118
116
|
x86_64-darwin-19
|
|
119
117
|
x86_64-darwin-20
|
|
120
118
|
x86_64-darwin-21
|
|
@@ -132,4 +130,4 @@ DEPENDENCIES
|
|
|
132
130
|
simplecov-lcov
|
|
133
131
|
|
|
134
132
|
BUNDLED WITH
|
|
135
|
-
2.
|
|
133
|
+
2.3.8
|
data/lib/resol/service.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative "result"
|
|
|
7
7
|
module Resol
|
|
8
8
|
class Service
|
|
9
9
|
class InvalidCommandImplementation < StandardError; end
|
|
10
|
+
class InvalidCommandCall < StandardError; end
|
|
10
11
|
|
|
11
12
|
class Failure < StandardError
|
|
12
13
|
attr_accessor :data, :code
|
|
@@ -39,16 +40,21 @@ module Resol
|
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def call(*args, **kwargs, &block)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
service = build(*args, **kwargs)
|
|
44
|
+
|
|
45
|
+
result = catch(service) do
|
|
46
|
+
service.instance_variable_set(:@__performing__, true)
|
|
47
|
+
__run_callbacks__(service)
|
|
48
|
+
service.call(&block)
|
|
49
|
+
:uncaught
|
|
47
50
|
end
|
|
48
|
-
return Resol::Success(result.data) unless result.nil?
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
if result == :uncaught
|
|
53
|
+
error_message = "No `#success!` or `#fail!` called in `#call` method in #{service.class}."
|
|
54
|
+
raise InvalidCommandImplementation, error_message
|
|
55
|
+
else
|
|
56
|
+
Resol::Success(result.data)
|
|
57
|
+
end
|
|
52
58
|
rescue self::Failure => e
|
|
53
59
|
Resol::Failure(e)
|
|
54
60
|
end
|
|
@@ -62,12 +68,30 @@ module Resol
|
|
|
62
68
|
|
|
63
69
|
private
|
|
64
70
|
|
|
71
|
+
attr_reader :__performing__
|
|
72
|
+
|
|
65
73
|
def fail!(code, data = nil)
|
|
66
|
-
|
|
74
|
+
check_performing do
|
|
75
|
+
raise self.class::Failure.new(code, data)
|
|
76
|
+
end
|
|
67
77
|
end
|
|
68
78
|
|
|
69
79
|
def success!(data = nil)
|
|
70
|
-
|
|
80
|
+
check_performing do
|
|
81
|
+
throw(self, Result.new(data))
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def check_performing
|
|
86
|
+
if __performing__
|
|
87
|
+
yield
|
|
88
|
+
else
|
|
89
|
+
error_message =
|
|
90
|
+
"It looks like #call instance method was called directly in #{self.class}. " \
|
|
91
|
+
"You must always use class-level `.call` or `.call!` method."
|
|
92
|
+
|
|
93
|
+
raise InvalidCommandCall, error_message
|
|
94
|
+
end
|
|
71
95
|
end
|
|
72
96
|
end
|
|
73
97
|
end
|
data/lib/resol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: resol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aleksei Bespalov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: smart_initializer
|
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '0'
|
|
182
182
|
requirements: []
|
|
183
|
-
rubygems_version: 3.
|
|
183
|
+
rubygems_version: 3.3.5
|
|
184
184
|
signing_key:
|
|
185
185
|
specification_version: 4
|
|
186
186
|
summary: Gem for creating (any) object patterns
|