subroutine 4.10.0 → 5.0.0.alpha
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/lib/subroutine/association_fields/configuration.rb +1 -0
- data/lib/subroutine/association_fields.rb +2 -2
- data/lib/subroutine/fields.rb +7 -0
- data/lib/subroutine/op.rb +4 -4
- data/lib/subroutine/type_caster.rb +0 -1
- data/lib/subroutine/version.rb +3 -3
- data/subroutine.gemspec +13 -18
- metadata +15 -17
- data/LICENSE +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 303c840aa8c1160127aefad35c51f98b6f85d3b24231cb256b6dbebb1b7316a9
|
|
4
|
+
data.tar.gz: 45e2c676ef66e7fb3282c30c793edf20dcc748a7e263cf9c41d81e0f5e13ce75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21bea30ad507b474915b6b5dcfd5c901f189f35dd484b755e49608879cd259e43b70d7ca6d27121db1b80b89cb000454a16dba5b886eb1c651a2b866910185da
|
|
7
|
+
data.tar.gz: 570dcacb9c6c09a9879aa012faccea7d8dce18591a5c47b6415b708ca06a04ac6eef9ef8f88da449d439d4abf8702b509021c33e9bb1baf7769fe03304fdfdca
|
|
@@ -66,6 +66,8 @@ module Subroutine
|
|
|
66
66
|
if options[:type]&.to_sym == :association
|
|
67
67
|
config = ::Subroutine::AssociationFields::Configuration.new(field_name, options)
|
|
68
68
|
|
|
69
|
+
field_without_association(config.as, config)
|
|
70
|
+
|
|
69
71
|
if config.polymorphic?
|
|
70
72
|
field config.foreign_type_method, config.build_foreign_type_field
|
|
71
73
|
else
|
|
@@ -77,8 +79,6 @@ module Subroutine
|
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
field config.foreign_key_method, config.build_foreign_key_field
|
|
80
|
-
|
|
81
|
-
field_without_association(config.as, config)
|
|
82
82
|
else
|
|
83
83
|
field_without_association(field_name, options)
|
|
84
84
|
end
|
data/lib/subroutine/fields.rb
CHANGED
|
@@ -7,6 +7,8 @@ require "subroutine/fields/mass_assignment_error"
|
|
|
7
7
|
module Subroutine
|
|
8
8
|
module Fields
|
|
9
9
|
|
|
10
|
+
DuplicateFieldError = Class.new(StandardError)
|
|
11
|
+
|
|
10
12
|
extend ActiveSupport::Concern
|
|
11
13
|
|
|
12
14
|
def self.allowed_input_classes
|
|
@@ -30,6 +32,11 @@ module Subroutine
|
|
|
30
32
|
module ClassMethods
|
|
31
33
|
|
|
32
34
|
def field(field_name, options = {})
|
|
35
|
+
|
|
36
|
+
if field_configurations.key?(field_name.to_sym) && !options[:allow_override]
|
|
37
|
+
raise DuplicateFieldError, "#{field_name} is already defined on #{self}. Add `allow_override: true` to reconfigure the field."
|
|
38
|
+
end
|
|
39
|
+
|
|
33
40
|
config = ::Subroutine::Fields::Configuration.from(field_name, options)
|
|
34
41
|
config.validate!
|
|
35
42
|
|
data/lib/subroutine/op.rb
CHANGED
|
@@ -18,8 +18,8 @@ module Subroutine
|
|
|
18
18
|
self._failure_class = klass
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def submit!(*args
|
|
22
|
-
raise ArgumentError, "Blocks cannot be provided to `submit!`" if
|
|
21
|
+
def submit!(*args)
|
|
22
|
+
raise ArgumentError, "Blocks cannot be provided to `submit!`" if block_given?
|
|
23
23
|
|
|
24
24
|
op = new(*args)
|
|
25
25
|
op.submit!
|
|
@@ -27,8 +27,8 @@ module Subroutine
|
|
|
27
27
|
op
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def submit(*args
|
|
31
|
-
raise ArgumentError, "Blocks cannot be provided to `submit`." if
|
|
30
|
+
def submit(*args)
|
|
31
|
+
raise ArgumentError, "Blocks cannot be provided to `submit`." if block_given?
|
|
32
32
|
|
|
33
33
|
op = new(*args)
|
|
34
34
|
op.submit
|
data/lib/subroutine/version.rb
CHANGED
data/subroutine.gemspec
CHANGED
|
@@ -7,40 +7,35 @@ require "subroutine/version"
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "subroutine"
|
|
9
9
|
spec.version = Subroutine::VERSION
|
|
10
|
-
spec.authors = ["
|
|
11
|
-
spec.email = ["
|
|
10
|
+
spec.authors = ["Mike Nelson"]
|
|
11
|
+
spec.email = ["mike@mnelson.io"]
|
|
12
12
|
spec.summary = "Feature-driven operation objects."
|
|
13
13
|
spec.description = "An interface for creating feature-driven operations."
|
|
14
|
+
spec.homepage = "https://github.com/guideline-tech/subroutine"
|
|
14
15
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">= 3.3.0"
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
github_uri = "https://github.com/guideline-tech/subroutine"
|
|
20
|
-
|
|
21
|
-
spec.homepage = github_uri
|
|
22
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
23
|
-
spec.metadata["source_code_uri"] = github_uri
|
|
24
|
-
spec.metadata["changelog_uri"] = "#{github_uri}/blob/main/CHANGELOG.MD"
|
|
25
|
-
spec.metadata["github_repo"] = github_uri
|
|
26
|
-
spec.metadata["rubygems_mfa_required"] = "true"
|
|
27
|
-
|
|
28
|
-
spec.files = Dir["lib/**/*"] + Dir["*.gemspec"] + Dir["LICENSE"]
|
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
|
18
|
+
spec.files = Dir["lib/**/*"] + Dir["*.gemspec"]
|
|
29
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
30
20
|
spec.require_paths = ["lib"]
|
|
31
21
|
|
|
32
|
-
spec.
|
|
33
|
-
spec.
|
|
22
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
23
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
24
|
+
|
|
25
|
+
spec.add_dependency "activemodel", ">= 6.1"
|
|
26
|
+
spec.add_dependency "activesupport", ">= 6.1"
|
|
34
27
|
spec.add_dependency "base64"
|
|
35
28
|
spec.add_dependency "bigdecimal"
|
|
36
29
|
spec.add_dependency "logger"
|
|
37
30
|
spec.add_dependency "mutex_m"
|
|
38
31
|
|
|
39
|
-
spec.add_development_dependency "actionpack", ">=
|
|
32
|
+
spec.add_development_dependency "actionpack", ">= 6.1"
|
|
40
33
|
spec.add_development_dependency "byebug"
|
|
41
34
|
spec.add_development_dependency "m"
|
|
42
35
|
spec.add_development_dependency "minitest"
|
|
43
36
|
spec.add_development_dependency "minitest-reporters"
|
|
44
37
|
spec.add_development_dependency "mocha"
|
|
45
38
|
spec.add_development_dependency "rake"
|
|
39
|
+
|
|
40
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
46
41
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: subroutine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0.alpha
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Mike Nelson
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-06-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: activemodel
|
|
@@ -15,28 +16,28 @@ dependencies:
|
|
|
15
16
|
requirements:
|
|
16
17
|
- - ">="
|
|
17
18
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
19
|
+
version: '6.1'
|
|
19
20
|
type: :runtime
|
|
20
21
|
prerelease: false
|
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
23
|
requirements:
|
|
23
24
|
- - ">="
|
|
24
25
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
26
|
+
version: '6.1'
|
|
26
27
|
- !ruby/object:Gem::Dependency
|
|
27
28
|
name: activesupport
|
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
|
29
30
|
requirements:
|
|
30
31
|
- - ">="
|
|
31
32
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
+
version: '6.1'
|
|
33
34
|
type: :runtime
|
|
34
35
|
prerelease: false
|
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
37
|
requirements:
|
|
37
38
|
- - ">="
|
|
38
39
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
40
|
+
version: '6.1'
|
|
40
41
|
- !ruby/object:Gem::Dependency
|
|
41
42
|
name: base64
|
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,14 +100,14 @@ dependencies:
|
|
|
99
100
|
requirements:
|
|
100
101
|
- - ">="
|
|
101
102
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
103
|
+
version: '6.1'
|
|
103
104
|
type: :development
|
|
104
105
|
prerelease: false
|
|
105
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
107
|
requirements:
|
|
107
108
|
- - ">="
|
|
108
109
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
110
|
+
version: '6.1'
|
|
110
111
|
- !ruby/object:Gem::Dependency
|
|
111
112
|
name: byebug
|
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -193,12 +194,11 @@ dependencies:
|
|
|
193
194
|
version: '0'
|
|
194
195
|
description: An interface for creating feature-driven operations.
|
|
195
196
|
email:
|
|
196
|
-
-
|
|
197
|
+
- mike@mnelson.io
|
|
197
198
|
executables: []
|
|
198
199
|
extensions: []
|
|
199
200
|
extra_rdoc_files: []
|
|
200
201
|
files:
|
|
201
|
-
- LICENSE
|
|
202
202
|
- lib/subroutine.rb
|
|
203
203
|
- lib/subroutine/association_fields.rb
|
|
204
204
|
- lib/subroutine/association_fields/association_type_mismatch_error.rb
|
|
@@ -225,11 +225,8 @@ licenses:
|
|
|
225
225
|
- MIT
|
|
226
226
|
metadata:
|
|
227
227
|
allowed_push_host: https://rubygems.org
|
|
228
|
-
homepage_uri: https://github.com/guideline-tech/subroutine
|
|
229
|
-
source_code_uri: https://github.com/guideline-tech/subroutine
|
|
230
|
-
changelog_uri: https://github.com/guideline-tech/subroutine/blob/main/CHANGELOG.MD
|
|
231
|
-
github_repo: https://github.com/guideline-tech/subroutine
|
|
232
228
|
rubygems_mfa_required: 'true'
|
|
229
|
+
post_install_message:
|
|
233
230
|
rdoc_options: []
|
|
234
231
|
require_paths:
|
|
235
232
|
- lib
|
|
@@ -237,14 +234,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
237
234
|
requirements:
|
|
238
235
|
- - ">="
|
|
239
236
|
- !ruby/object:Gem::Version
|
|
240
|
-
version: 3.
|
|
237
|
+
version: 3.2.0
|
|
241
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
239
|
requirements:
|
|
243
240
|
- - ">="
|
|
244
241
|
- !ruby/object:Gem::Version
|
|
245
242
|
version: '0'
|
|
246
243
|
requirements: []
|
|
247
|
-
rubygems_version:
|
|
244
|
+
rubygems_version: 3.5.22
|
|
245
|
+
signing_key:
|
|
248
246
|
specification_version: 4
|
|
249
247
|
summary: Feature-driven operation objects.
|
|
250
248
|
test_files: []
|
data/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Gusto
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|