flow 0.10.6 → 0.10.7.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +108 -1249
- data/lib/flow.rb +3 -0
- data/lib/flow/flow/trigger.rb +4 -4
- data/lib/flow/malfunction/base.rb +10 -0
- data/lib/flow/operation/core.rb +1 -1
- data/lib/flow/operation/error_handler.rb +1 -1
- data/lib/flow/rspec/custom_matchers/have_on_state.rb +6 -1
- data/lib/flow/state_proxy.rb +6 -6
- data/lib/flow/version.rb +1 -1
- metadata +36 -16
data/lib/flow.rb
CHANGED
@@ -5,11 +5,14 @@ require "active_record"
|
|
5
5
|
require "active_support"
|
6
6
|
|
7
7
|
require "spicery"
|
8
|
+
require "malfunction"
|
8
9
|
|
9
10
|
require "flow/version"
|
10
11
|
|
11
12
|
require "flow/concerns/transaction_wrapper"
|
12
13
|
|
14
|
+
require "flow/malfunction/base"
|
15
|
+
|
13
16
|
require "flow/flow_base"
|
14
17
|
require "flow/operation_base"
|
15
18
|
require "flow/state_base"
|
data/lib/flow/flow/trigger.rb
CHANGED
@@ -7,12 +7,12 @@ module Flow
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
class_methods do
|
10
|
-
def trigger!(*arguments)
|
11
|
-
new(*arguments).trigger!
|
10
|
+
def trigger!(*arguments, **options)
|
11
|
+
new(*arguments, **options).trigger!
|
12
12
|
end
|
13
13
|
|
14
|
-
def trigger(*arguments)
|
15
|
-
new(*arguments).trigger
|
14
|
+
def trigger(*arguments, **options)
|
15
|
+
new(*arguments, **options).trigger
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/flow/operation/core.rb
CHANGED
@@ -16,7 +16,7 @@ module Flow
|
|
16
16
|
def state_proxy_class
|
17
17
|
@state_proxy_class ||= Class.new(StateProxy).tap do |proxy_class|
|
18
18
|
delegate_method_names = _state_writers.map { |method_name| "#{method_name}=" } + _state_readers
|
19
|
-
proxy_class.delegate(*delegate_method_names, to: :
|
19
|
+
proxy_class.delegate(*delegate_method_names, to: :_state) if delegate_method_names.any?
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# When an exception is raised during
|
3
|
+
# When an exception is raised during execution, but a handler can rescue, it causes a failure instead.
|
4
4
|
module Flow
|
5
5
|
module Operation
|
6
6
|
module ErrorHandler
|
@@ -44,7 +44,12 @@ module Flow
|
|
44
44
|
|
45
45
|
def matches?(object)
|
46
46
|
@state_expectations.all? do |key, value|
|
47
|
-
|
47
|
+
# If state is actually a StateProxy, we to access the state directly with _state
|
48
|
+
if object.state.respond_to?(:_state)
|
49
|
+
expect(object.state.__send__(:_state).public_send(key)).to match value
|
50
|
+
else
|
51
|
+
expect(object.state.public_send(key)).to match value
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
data/lib/flow/state_proxy.rb
CHANGED
@@ -4,27 +4,27 @@
|
|
4
4
|
module Flow
|
5
5
|
class StateProxy
|
6
6
|
def initialize(state)
|
7
|
-
@
|
7
|
+
@_state = state
|
8
8
|
end
|
9
9
|
|
10
10
|
# @deprecated
|
11
11
|
def method_missing(method_name, *arguments, &block)
|
12
|
-
return super unless
|
12
|
+
return super unless _state.respond_to?(method_name)
|
13
13
|
|
14
14
|
ActiveSupport::Deprecation.warn(
|
15
|
-
"Direct state access of `#{method_name}' on #{
|
15
|
+
"Direct state access of `#{method_name}' on #{_state.inspect} will be removed in a future version of flow. "\
|
16
16
|
"Use a state accessor instead - for more information see github/freshly/flow/deprecation_notice"
|
17
17
|
)
|
18
|
-
|
18
|
+
_state.public_send(method_name, *arguments, &block)
|
19
19
|
end
|
20
20
|
|
21
21
|
# @deprecated
|
22
22
|
def respond_to_missing?(method_name, include_private = false)
|
23
|
-
|
23
|
+
_state.respond_to?(method_name) || super
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
attr_reader :
|
28
|
+
attr_reader :_state
|
29
29
|
end
|
30
30
|
end
|
data/lib/flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.7.1.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activemodel
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
requirements:
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
65
|
+
version: 0.21.0
|
66
66
|
- - "<"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
@@ -72,7 +72,27 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.21.0
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '1.0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: malfunction
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.2.0
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.0'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.2.0
|
76
96
|
- - "<"
|
77
97
|
- !ruby/object:Gem::Version
|
78
98
|
version: '1.0'
|
@@ -80,14 +100,14 @@ dependencies:
|
|
80
100
|
name: bundler
|
81
101
|
requirement: !ruby/object:Gem::Requirement
|
82
102
|
requirements:
|
83
|
-
- - "
|
103
|
+
- - ">="
|
84
104
|
- !ruby/object:Gem::Version
|
85
105
|
version: 2.0.1
|
86
106
|
type: :development
|
87
107
|
prerelease: false
|
88
108
|
version_requirements: !ruby/object:Gem::Requirement
|
89
109
|
requirements:
|
90
|
-
- - "
|
110
|
+
- - ">="
|
91
111
|
- !ruby/object:Gem::Version
|
92
112
|
version: 2.0.1
|
93
113
|
- !ruby/object:Gem::Dependency
|
@@ -96,14 +116,14 @@ dependencies:
|
|
96
116
|
requirements:
|
97
117
|
- - "~>"
|
98
118
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
119
|
+
version: '13.0'
|
100
120
|
type: :development
|
101
121
|
prerelease: false
|
102
122
|
version_requirements: !ruby/object:Gem::Requirement
|
103
123
|
requirements:
|
104
124
|
- - "~>"
|
105
125
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
126
|
+
version: '13.0'
|
107
127
|
- !ruby/object:Gem::Dependency
|
108
128
|
name: simplecov
|
109
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +200,7 @@ dependencies:
|
|
180
200
|
requirements:
|
181
201
|
- - ">="
|
182
202
|
- !ruby/object:Gem::Version
|
183
|
-
version: 0.
|
203
|
+
version: 0.25.7
|
184
204
|
- - "<"
|
185
205
|
- !ruby/object:Gem::Version
|
186
206
|
version: '1.0'
|
@@ -190,7 +210,7 @@ dependencies:
|
|
190
210
|
requirements:
|
191
211
|
- - ">="
|
192
212
|
- !ruby/object:Gem::Version
|
193
|
-
version: 0.
|
213
|
+
version: 0.25.7
|
194
214
|
- - "<"
|
195
215
|
- !ruby/object:Gem::Version
|
196
216
|
version: '1.0'
|
@@ -200,7 +220,7 @@ dependencies:
|
|
200
220
|
requirements:
|
201
221
|
- - ">="
|
202
222
|
- !ruby/object:Gem::Version
|
203
|
-
version: 0.
|
223
|
+
version: 0.21.0
|
204
224
|
- - "<"
|
205
225
|
- !ruby/object:Gem::Version
|
206
226
|
version: '1.0'
|
@@ -210,7 +230,7 @@ dependencies:
|
|
210
230
|
requirements:
|
211
231
|
- - ">="
|
212
232
|
- !ruby/object:Gem::Version
|
213
|
-
version: 0.
|
233
|
+
version: 0.21.0
|
214
234
|
- - "<"
|
215
235
|
- !ruby/object:Gem::Version
|
216
236
|
version: '1.0'
|
@@ -234,6 +254,7 @@ files:
|
|
234
254
|
- lib/flow/flow/transactions.rb
|
235
255
|
- lib/flow/flow/trigger.rb
|
236
256
|
- lib/flow/flow_base.rb
|
257
|
+
- lib/flow/malfunction/base.rb
|
237
258
|
- lib/flow/operation/accessors.rb
|
238
259
|
- lib/flow/operation/callbacks.rb
|
239
260
|
- lib/flow/operation/core.rb
|
@@ -316,12 +337,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
316
337
|
version: '0'
|
317
338
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
318
339
|
requirements:
|
319
|
-
- - "
|
340
|
+
- - ">"
|
320
341
|
- !ruby/object:Gem::Version
|
321
|
-
version:
|
342
|
+
version: 1.3.1
|
322
343
|
requirements: []
|
323
|
-
|
324
|
-
rubygems_version: 2.7.6
|
344
|
+
rubygems_version: 3.1.4
|
325
345
|
signing_key:
|
326
346
|
specification_version: 4
|
327
347
|
summary: Write modular and reusable business logic that's understandable and maintainable.
|