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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16fcc8b010a87aa5a78cc089d181f03b8e6cb9f5c32938355825b44ed2d5f5c4
4
- data.tar.gz: 9d1acab848a51a2ca9f072ac0c0208e28339c3ac2e182bd0904c137a7ca18bed
3
+ metadata.gz: 303c840aa8c1160127aefad35c51f98b6f85d3b24231cb256b6dbebb1b7316a9
4
+ data.tar.gz: 45e2c676ef66e7fb3282c30c793edf20dcc748a7e263cf9c41d81e0f5e13ce75
5
5
  SHA512:
6
- metadata.gz: c7d7040236bbb7c61d8d01d5cbeb135f4788c3a0a4f33096376156c22fbe37187cccc82e8f537826a781f1638bcbe1c51b67a76a1cb7f48a1baf8bb82ddd5fd6
7
- data.tar.gz: 9441ce6aaddd76f6b379b60c2850c1a98f84eac70a1ab5149f370cb81e097030bfe88386cd393c8b77da701c3220697dadf39d9fc6bd9354f4c2b50fc3877e30
6
+ metadata.gz: 21bea30ad507b474915b6b5dcfd5c901f189f35dd484b755e49608879cd259e43b70d7ca6d27121db1b80b89cb000454a16dba5b886eb1c651a2b866910185da
7
+ data.tar.gz: 570dcacb9c6c09a9879aa012faccea7d8dce18591a5c47b6415b708ca06a04ac6eef9ef8f88da449d439d4abf8702b509021c33e9bb1baf7769fe03304fdfdca
@@ -85,6 +85,7 @@ module Subroutine
85
85
  child_opts = inheritable_options
86
86
  child_opts.merge!(opts)
87
87
  child_opts[:association_name] = as
88
+ child_opts[:allow_override] = true
88
89
  ComponentConfiguration.new(name, child_opts)
89
90
  end
90
91
 
@@ -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
@@ -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, &block)
22
- raise ArgumentError, "Blocks cannot be provided to `submit!`" if block
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, &block)
31
- raise ArgumentError, "Blocks cannot be provided to `submit`." if block
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
@@ -4,7 +4,6 @@ require 'date'
4
4
  require 'time'
5
5
  require 'bigdecimal'
6
6
  require 'securerandom'
7
- require 'tempfile'
8
7
  require 'active_support/json'
9
8
  require 'active_support/core_ext/date_time/acts_like'
10
9
  require 'active_support/core_ext/date_time/calculations'
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Subroutine
4
4
 
5
- MAJOR = 4
6
- MINOR = 10
5
+ MAJOR = 5
6
+ MINOR = 0
7
7
  PATCH = 0
8
- PRE = nil
8
+ PRE = "alpha"
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
 
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 = ["Gusto"]
11
- spec.email = ["gusto-opensource-buildkite@gusto.com"]
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
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
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.add_dependency "activemodel", ">= 8.1"
33
- spec.add_dependency "activesupport", ">= 8.1"
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", ">= 8.1"
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.10.0
4
+ version: 5.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
- - Gusto
7
+ - Mike Nelson
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
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: '8.1'
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: '8.1'
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: '8.1'
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: '8.1'
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: '8.1'
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: '8.1'
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
- - gusto-opensource-buildkite@gusto.com
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.3.0
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: 4.0.21
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.