operations 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +3 -9
- data/CHANGELOG.md +8 -2
- data/lib/operations/command.rb +4 -3
- data/lib/operations/convenience.rb +2 -2
- data/lib/operations/form/builder.rb +1 -1
- data/lib/operations/form.rb +1 -1
- data/lib/operations/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: dc7557987e49805062efa789a9ecc5b0344839b5f8217b9a59fbd6904246ec8f
|
4
|
+
data.tar.gz: 801b5edbde46dba2c005ef8bad826691ca00ce7adda5654d04f602406d15847f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcec088edb29345af8934525274ddf100a5d0276545c2153ef1eeef4e6a255040dd0eabfd287afc5d68c3b041a4ac335ef8a258d653598cbb449eb2a78b94c63
|
7
|
+
data.tar.gz: b660a95428e98a9e6839f2b154623dd5226532c646a486f606f4c318c71bef8dd7861859a5775a28be47098ffeecd7c54974baaf31195246084d2ace7daeac08
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-12-20 10:30:23 UTC using RuboCop version 1.57.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -9,26 +9,20 @@
|
|
9
9
|
# Offense count: 3
|
10
10
|
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
11
11
|
# SupportedStyles: Gemfile, gems.rb, gemspec
|
12
|
-
# AllowedGems: bundler
|
13
12
|
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
14
13
|
Gemspec/DevelopmentDependencies:
|
15
14
|
Exclude:
|
16
15
|
- 'operations.gemspec'
|
17
16
|
|
18
17
|
# Offense count: 5
|
19
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns,
|
18
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
20
19
|
Metrics/AbcSize:
|
21
20
|
Max: 28
|
22
21
|
|
23
22
|
# Offense count: 2
|
24
23
|
# Configuration parameters: CountComments, CountAsOne.
|
25
24
|
Metrics/ClassLength:
|
26
|
-
Max:
|
27
|
-
|
28
|
-
# Offense count: 7
|
29
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
30
|
-
Metrics/MethodLength:
|
31
|
-
Max: 17
|
25
|
+
Max: 161
|
32
26
|
|
33
27
|
# Offense count: 1
|
34
28
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [0.6.
|
3
|
+
## [0.6.3](https://github.com/BookingSync/operations/tree/main)
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- In some cases, `Operation::Command#form_class` was evaluated before `form_base` was evaluated [\#41](https://github.com/BookingSync/operations/pull/41) ([pyromaniac](https://github.com/pyromaniac))
|
8
|
+
|
9
|
+
## [0.6.2]
|
4
10
|
|
5
11
|
### Added
|
6
12
|
|
7
|
-
- Support Rails 7.1 [\#40](https://github.com/BookingSync/operations/pull/40) ([
|
13
|
+
- Support Rails 7.1 [\#40](https://github.com/BookingSync/operations/pull/40) ([pyromaniac](https://github.com/pyromaniac))
|
8
14
|
- Include `Dry::Monads[:result]` in Policies, Preconditions and Callbacks [\#39](https://github.com/BookingSync/operations/pull/39) ([ston1x](https://github.com/ston1x))
|
9
15
|
- Add `callback` method to `Operations::Convenience` [\#37](https://github.com/BookingSync/operations/pull/37) ([pyromaniac](https://github.com/pyromaniac))
|
10
16
|
- Ability to access operation result in callbacks [\#36](https://github.com/BookingSync/operations/pull/36) ([pyromaniac](https://github.com/pyromaniac))
|
data/lib/operations/command.rb
CHANGED
@@ -165,7 +165,7 @@ class Operations::Command
|
|
165
165
|
Operations::Types::String
|
166
166
|
), default: proc { {} }
|
167
167
|
option :form_base, Operations::Types::Class, default: proc { ::Operations::Form }
|
168
|
-
option :form_class, Operations::Types::Class, default: proc {
|
168
|
+
option :form_class, Operations::Types::Class.optional, default: proc {}
|
169
169
|
option :form_hydrator, Operations::Types.Interface(:call), default: proc { FORM_HYDRATOR }
|
170
170
|
option :configuration, Operations::Configuration, default: proc { Operations.default_config }
|
171
171
|
|
@@ -203,6 +203,7 @@ class Operations::Command
|
|
203
203
|
|
204
204
|
preconditions.push(precondition) if precondition.present?
|
205
205
|
super(operation, preconditions: preconditions, on_success: after, **options)
|
206
|
+
@form_class ||= build_form_class
|
206
207
|
end
|
207
208
|
|
208
209
|
# Instantiates a new command with the given fields updated.
|
@@ -264,7 +265,7 @@ class Operations::Command
|
|
264
265
|
# These 3 methods added for convenience. They return boolean result
|
265
266
|
# instead of Operations::Result. True on success and false on failure.
|
266
267
|
%i[callable allowed possible].each do |method|
|
267
|
-
define_method "#{method}?" do |**kwargs|
|
268
|
+
define_method :"#{method}?" do |**kwargs|
|
268
269
|
public_send(method, **kwargs).success?
|
269
270
|
end
|
270
271
|
end
|
@@ -395,7 +396,7 @@ class Operations::Command
|
|
395
396
|
end
|
396
397
|
end
|
397
398
|
|
398
|
-
def
|
399
|
+
def build_form_class
|
399
400
|
::Operations::Form::Builder
|
400
401
|
.new(base_class: form_base)
|
401
402
|
.build(
|
@@ -80,7 +80,7 @@ module Operations::Convenience
|
|
80
80
|
contract = Class.new(from)
|
81
81
|
contract.config.messages.namespace = name.underscore
|
82
82
|
contract.class_eval(&block)
|
83
|
-
const_set("#{prefix.to_s.camelize}Contract", contract)
|
83
|
+
const_set(:"#{prefix.to_s.camelize}Contract", contract)
|
84
84
|
end
|
85
85
|
|
86
86
|
%w[policy precondition callback].each do |kind|
|
@@ -96,7 +96,7 @@ module Operations::Convenience
|
|
96
96
|
|
97
97
|
klass.define_method(:call, &block) if block
|
98
98
|
|
99
|
-
const_set("#{prefix.to_s.camelize}#{kind.camelize}", klass)
|
99
|
+
const_set(:"#{prefix.to_s.camelize}#{kind.camelize}", klass)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
@@ -52,7 +52,7 @@ class Operations::Form::Builder
|
|
52
52
|
nested_attributes_suffix,
|
53
53
|
nested_attributes_collection
|
54
54
|
)
|
55
|
-
form.define_method "#{hash_key.name}=", proc { |attributes| attributes } if nested_attributes_suffix
|
55
|
+
form.define_method :"#{hash_key.name}=", proc { |attributes| attributes } if nested_attributes_suffix
|
56
56
|
|
57
57
|
key_path = path + [name]
|
58
58
|
nested_form = traverse(members, form, name.underscore.camelize, model_map, key_path)
|
data/lib/operations/form.rb
CHANGED
@@ -157,7 +157,7 @@ class Operations::Form
|
|
157
157
|
name = name.to_sym
|
158
158
|
return unless self.class.attributes.key?(name)
|
159
159
|
|
160
|
-
nested_name = "#{name}_attributes"
|
160
|
+
nested_name = :"#{name}_attributes"
|
161
161
|
value = data.key?(nested_name) ? data[nested_name] : data[name]
|
162
162
|
|
163
163
|
(@attributes_cache ||= {})[name] ||= yield(value, self.class.attributes[name])
|
data/lib/operations/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: operations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkadiy Zabazhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
209
|
+
rubygems_version: 3.4.7
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Operations framework
|