servactory 2.0.0.rc3 → 2.0.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdc12e7e579fdacbd13a9d7d4997113023dd0f3acb9be1050bf88d3c83c324a9
4
- data.tar.gz: dbfb8137159dce0ae2fa37a143b9a7b75d1f6a758852fd580567615aa1081bc3
3
+ metadata.gz: ecb994c1e8be578cb83edfa20eb4b60efc3b80a36d24439e83e6b0c6208ac3be
4
+ data.tar.gz: d75f094fd6d07465761b542e7997ac222fcaf1c2e397216c10c768485a5b4250
5
5
  SHA512:
6
- metadata.gz: d7696c3a4c46fc4dc72980fcb513d39a0a7f69a5e64d4ec2e6244f3c4f950e27cf25faa583c2b1a36dda2d91b33402588a24fc64d294b3fc83bd3f3bc227fcc1
7
- data.tar.gz: 0531261cbd2a5e9b0af78c7775cbf08cd45f635b328788510d435bdaf361080931f4f6c7b3d1953e8538288c276fc35a4383e9276bc015ef88600f6591e49593
6
+ metadata.gz: a0213bf096871d202defff4eab2055bd91c9414c1ebd8bba279b2fda73df0345b1321bcb802a68176cc3b16abdc81c77dd2fd55294f06123a674ed74c2ae2c0f
7
+ data.tar.gz: 403bc708be4a3cfc9ce73c78f2f14336a8d49b9e9a488b0781b80ee2808cc2217599f3b5cc6f54396239e404e52f8d5719676b491f0adc0019bdb4f31c5b69b4
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
5
- class Method
4
+ module Actions
5
+ class Action
6
6
  attr_reader :name,
7
7
  :position,
8
8
  :condition,
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
5
- module AliasesForMake
4
+ module Actions
5
+ module Aliases
6
6
  class Collection
7
7
  extend Forwardable
8
8
  def_delegators :@collection, :<<, :merge, :include?
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
5
- class MethodCollection
4
+ module Actions
5
+ class Collection
6
6
  extend Forwardable
7
7
  def_delegators :@collection, :<<, :each, :sort_by
8
8
 
@@ -11,7 +11,7 @@ module Servactory
11
11
  end
12
12
 
13
13
  def sorted_by_position
14
- MethodCollection.new(sort_by(&:position))
14
+ Collection.new(sort_by(&:position))
15
15
  end
16
16
  end
17
17
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
4
+ module Actions
5
5
  module DSL
6
6
  def self.included(base)
7
7
  base.extend(ClassMethods)
@@ -18,7 +18,7 @@ module Servactory
18
18
  private
19
19
 
20
20
  def stage(&block)
21
- @current_stage = Stage.new(position: next_position)
21
+ @current_stage = Stages::Stage.new(position: next_position)
22
22
 
23
23
  instance_eval(&block)
24
24
 
@@ -56,9 +56,9 @@ module Servactory
56
56
  def make(name, position: nil, **options)
57
57
  position = position.presence || next_position
58
58
 
59
- current_stage = @current_stage.presence || Stage.new(position: position)
59
+ current_stage = @current_stage.presence || Stages::Stage.new(position: position)
60
60
 
61
- current_stage.methods << Method.new(
61
+ current_stage.methods << Action.new(
62
62
  name,
63
63
  position: position,
64
64
  **options
@@ -68,9 +68,9 @@ module Servactory
68
68
  end
69
69
 
70
70
  def method_missing(name, *args, &block)
71
- return method_missing_for_aliases_for_make(name, *args, &block) if config.aliases_for_make.include?(name)
71
+ return method_missing_for_aliases_for_make(name, *args, &block) if config.action_aliases.include?(name)
72
72
 
73
- return method_missing_for_shortcuts_for_make(name, *args, &block) if config.shortcuts_for_make.include?(name)
73
+ return method_missing_for_shortcuts_for_make(name, *args, &block) if config.action_shortcuts.include?(name)
74
74
 
75
75
  super
76
76
  end
@@ -93,7 +93,7 @@ module Servactory
93
93
  end
94
94
 
95
95
  def respond_to_missing?(name, *)
96
- config.aliases_for_make.include?(name) || config.shortcuts_for_make.include?(name) || super
96
+ config.action_aliases.include?(name) || config.action_shortcuts.include?(name) || super
97
97
  end
98
98
 
99
99
  def next_position
@@ -101,7 +101,7 @@ module Servactory
101
101
  end
102
102
 
103
103
  def collection_of_stages
104
- @collection_of_stages ||= StageCollection.new
104
+ @collection_of_stages ||= Stages::Collection.new
105
105
  end
106
106
  end
107
107
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
5
- module ShortcutsForMake
4
+ module Actions
5
+ module Shortcuts
6
6
  class Collection
7
7
  extend Forwardable
8
8
  def_delegators :@collection, :<<, :each, :merge, :include?
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Actions
5
+ module Stages
6
+ class Collection
7
+ extend Forwardable
8
+ def_delegators :@collection, :<<, :each, :merge, :sort_by, :size, :empty?
9
+
10
+ def initialize(collection = Set.new)
11
+ @collection = collection
12
+ end
13
+
14
+ def sorted_by_position
15
+ Collection.new(sort_by(&:position))
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Actions
5
+ module Stages
6
+ class Stage
7
+ attr_accessor :position,
8
+ :wrapper,
9
+ :rollback,
10
+ :condition,
11
+ :is_condition_opposite
12
+
13
+ def initialize(position:, wrapper: nil, rollback: nil, condition: nil)
14
+ @position = position
15
+ @wrapper = wrapper
16
+ @rollback = rollback
17
+ @condition = condition
18
+ end
19
+
20
+ def next_method_position
21
+ methods.size + 1
22
+ end
23
+
24
+ def methods
25
+ @methods ||= Collection.new
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
4
+ module Actions
5
5
  module Tools
6
6
  class Runner
7
7
  def self.run!(...)
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Methods
4
+ module Actions
5
5
  module Workspace
6
6
  private
7
7
 
8
8
  def call!(collection_of_stages:, **)
9
9
  super
10
10
 
11
- Servactory::Methods::Tools::Runner.run!(self, collection_of_stages)
11
+ Servactory::Actions::Tools::Runner.run!(self, collection_of_stages)
12
12
  end
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ module Servactory
8
8
  include Inputs::DSL
9
9
  include Internals::DSL
10
10
  include Outputs::DSL
11
- include Methods::DSL
11
+ include Actions::DSL
12
12
 
13
13
  private_class_method :new
14
14
  end
@@ -21,8 +21,8 @@ module Servactory
21
21
 
22
22
  child.config.input_option_helpers = config.input_option_helpers
23
23
 
24
- child.config.aliases_for_make = config.aliases_for_make
25
- child.config.shortcuts_for_make = config.shortcuts_for_make
24
+ child.config.action_aliases = config.action_aliases
25
+ child.config.action_shortcuts = config.action_shortcuts
26
26
  end
27
27
 
28
28
  def config
@@ -28,19 +28,19 @@ module Servactory
28
28
  end
29
29
 
30
30
  def hash_mode_class_names(hash_mode_class_names)
31
- @config.collection_mode_class_names.merge(hash_mode_class_names)
31
+ @config.hash_mode_class_names.merge(hash_mode_class_names)
32
32
  end
33
33
 
34
34
  def input_option_helpers(input_option_helpers)
35
35
  @config.input_option_helpers.merge(input_option_helpers)
36
36
  end
37
37
 
38
- def aliases_for_make(aliases_for_make)
39
- @config.aliases_for_make.merge(aliases_for_make)
38
+ def action_aliases(action_aliases)
39
+ @config.action_aliases.merge(action_aliases)
40
40
  end
41
41
 
42
- def shortcuts_for_make(shortcuts_for_make)
43
- @config.shortcuts_for_make.merge(shortcuts_for_make)
42
+ def action_shortcuts(action_shortcuts)
43
+ @config.action_shortcuts.merge(action_shortcuts)
44
44
  end
45
45
  end
46
46
  end
@@ -10,8 +10,8 @@ module Servactory
10
10
  :collection_mode_class_names,
11
11
  :hash_mode_class_names,
12
12
  :input_option_helpers,
13
- :aliases_for_make,
14
- :shortcuts_for_make
13
+ :action_aliases,
14
+ :action_shortcuts
15
15
 
16
16
  def initialize # rubocop:disable Metrics/MethodLength
17
17
  @input_error_class = Servactory::Errors::InputError
@@ -29,8 +29,8 @@ module Servactory
29
29
  @input_option_helpers =
30
30
  Servactory::Maintenance::Attributes::OptionHelpersCollection.new(default_input_option_helpers)
31
31
 
32
- @aliases_for_make = Servactory::Methods::AliasesForMake::Collection.new
33
- @shortcuts_for_make = Servactory::Methods::ShortcutsForMake::Collection.new
32
+ @action_aliases = Servactory::Actions::Aliases::Collection.new
33
+ @action_shortcuts = Servactory::Actions::Shortcuts::Collection.new
34
34
  end
35
35
 
36
36
  private
@@ -48,7 +48,9 @@ module Servactory
48
48
 
49
49
  input.value = input.default if input.optional? && input.value.blank?
50
50
 
51
- input.value = prepare_object_values_inside(object: input.value, schema: input.schema) if input.hash_mode?
51
+ if input.hash_mode?
52
+ input.value = prepare_hash_values_inside(object: input.value, schema: input.schema.fetch(:is))
53
+ end
52
54
 
53
55
  input_prepare = input.prepare.fetch(:in, nil)
54
56
  input.value = input_prepare.call(value: input.value) if input_prepare.present?
@@ -60,7 +62,7 @@ module Servactory
60
62
  end
61
63
  end
62
64
 
63
- def prepare_object_values_inside(object:, schema:) # rubocop:disable Metrics/MethodLength
65
+ def prepare_hash_values_inside(object:, schema:) # rubocop:disable Metrics/MethodLength
64
66
  return object unless object.respond_to?(:fetch)
65
67
 
66
68
  schema.to_h do |schema_key, schema_value|
@@ -68,12 +70,12 @@ module Servactory
68
70
 
69
71
  result =
70
72
  if attribute_type == Hash
71
- prepare_object_values_inside(
73
+ prepare_hash_values_inside(
72
74
  object: object.fetch(schema_key, {}),
73
75
  schema: schema_value.except(*RESERVED_ATTRIBUTES)
74
76
  )
75
77
  else
76
- fetch_object_values_from(
78
+ fetch_hash_values_from(
77
79
  value: object.fetch(schema_key, {}),
78
80
  schema_value: schema_value,
79
81
  attribute_required: schema_value.fetch(:required, true)
@@ -84,7 +86,7 @@ module Servactory
84
86
  end
85
87
  end
86
88
 
87
- def fetch_object_values_from(value:, schema_value:, attribute_required:)
89
+ def fetch_hash_values_from(value:, schema_value:, attribute_required:)
88
90
  return value if attribute_required
89
91
  return value if value.present?
90
92
 
@@ -14,7 +14,7 @@ module Servactory
14
14
 
15
15
  extensions.each { |extension| base.include(extension) }
16
16
 
17
- base.include(Methods::DSL)
17
+ base.include(Actions::DSL)
18
18
  end
19
19
 
20
20
  def self.with_extensions(*extensions)
@@ -68,7 +68,7 @@ module Servactory
68
68
  add_types_option_with(type)
69
69
  add_default_option_with(options)
70
70
  add_collection_option_with(type, options)
71
- add_object_option_with(type, options)
71
+ add_hash_option_with(type, options)
72
72
 
73
73
  # Check Class: Servactory::Inputs::Validations::Inclusion
74
74
  add_inclusion_option_with(options)
@@ -161,7 +161,7 @@ module Servactory
161
161
  )
162
162
  end
163
163
 
164
- def add_object_option_with(type, options) # rubocop:disable Metrics/MethodLength
164
+ def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
165
165
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
166
166
  name: :schema,
167
167
  attribute: self,
@@ -178,8 +178,8 @@ module Servactory
178
178
  )
179
179
  ],
180
180
  need_for_checks: false,
181
+ body_key: :is,
181
182
  body_fallback: {},
182
- with_advanced_mode: false,
183
183
  **options
184
184
  )
185
185
  end
@@ -37,7 +37,7 @@ module Servactory
37
37
  # Check Class: Servactory::Internals::Validations::Type
38
38
  add_types_option_with(type)
39
39
  add_collection_option_with(type, options)
40
- add_object_option_with(type, options)
40
+ add_hash_option_with(type, options)
41
41
  end
42
42
 
43
43
  def add_types_option_with(type)
@@ -71,7 +71,7 @@ module Servactory
71
71
  )
72
72
  end
73
73
 
74
- def add_object_option_with(type, options) # rubocop:disable Metrics/MethodLength
74
+ def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
75
75
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
76
76
  name: :schema,
77
77
  attribute: self,
@@ -83,8 +83,8 @@ module Servactory
83
83
  )
84
84
  ],
85
85
  need_for_checks: false,
86
+ body_key: :is,
86
87
  body_fallback: {},
87
- with_advanced_mode: false,
88
88
  **options
89
89
  )
90
90
  end
@@ -75,6 +75,7 @@ module Servactory
75
75
  )
76
76
  end
77
77
 
78
+ # rubocop:disable Metrics/MethodLength
78
79
  def prepare_advanced_for(
79
80
  body:,
80
81
  body_key:,
@@ -82,17 +83,22 @@ module Servactory
82
83
  body_fallback:
83
84
  )
84
85
  if body.is_a?(Hash)
85
- message = body.fetch(:message, nil)
86
-
87
- DEFAULT_BODY.call(
88
- key: body_key,
89
- body: body.fetch(body_key, message.present? ? body_value : body_fallback),
90
- message: message
91
- )
86
+ if @name == :schema && body.fetch(body_key, nil).nil?
87
+ DEFAULT_BODY.call(key: body_key, body: body)
88
+ else
89
+ message = body.fetch(:message, nil)
90
+
91
+ DEFAULT_BODY.call(
92
+ key: body_key,
93
+ body: body.fetch(body_key, message.present? ? body_value : body_fallback),
94
+ message: message
95
+ )
96
+ end
92
97
  else
93
98
  DEFAULT_BODY.call(key: body_key, body: body)
94
99
  end
95
100
  end
101
+ # rubocop:enable Metrics/MethodLength
96
102
 
97
103
  def prepare_methods_for(attribute)
98
104
  attribute.instance_eval(define_methods_template) if define_methods_template.present?
@@ -15,7 +15,7 @@ module Servactory
15
15
 
16
16
  def initialize(object:, schema:)
17
17
  @object = object
18
- @schema = schema
18
+ @schema = schema.fetch(:is)
19
19
 
20
20
  @errors = []
21
21
  end
@@ -17,7 +17,11 @@ module Servactory
17
17
  collection_message = attribute.consists_of.fetch(:message)
18
18
 
19
19
  if collection_message.is_a?(Proc)
20
- collection_message.call(attribute_system_name => attribute, expected_type: expected_type)
20
+ collection_message.call(
21
+ "#{attribute_system_name}_name": attribute.name,
22
+ expected_type: expected_type,
23
+ given_type: given_type
24
+ )
21
25
  elsif collection_message.is_a?(String) && collection_message.present?
22
26
  collection_message
23
27
  elsif value.is_a?(attribute.types.fetch(0, Array))
@@ -38,14 +42,27 @@ module Servactory
38
42
  )
39
43
  end
40
44
  elsif attribute.hash_mode? && key_name.present?
41
- I18n.t(
42
- "servactory.#{attribute_system_name.to_s.pluralize}.checks.type.default_error.for_hash.wrong_element_type", # rubocop:disable Layout/LineLength
43
- service_class_name: service_class_name,
44
- "#{attribute_system_name}_name": attribute.name,
45
- key_name: key_name,
46
- expected_type: expected_type,
47
- given_type: given_type
48
- )
45
+ hash_message = attribute.schema.fetch(:message)
46
+
47
+ if hash_message.is_a?(Proc)
48
+ hash_message.call(
49
+ "#{attribute_system_name}_name": attribute.name,
50
+ key_name: key_name,
51
+ expected_type: expected_type,
52
+ given_type: given_type
53
+ )
54
+ elsif hash_message.is_a?(String) && hash_message.present?
55
+ hash_message
56
+ else
57
+ I18n.t(
58
+ "servactory.#{attribute_system_name.to_s.pluralize}.checks.type.default_error.for_hash.wrong_element_type", # rubocop:disable Layout/LineLength
59
+ service_class_name: service_class_name,
60
+ "#{attribute_system_name}_name": attribute.name,
61
+ key_name: key_name,
62
+ expected_type: expected_type,
63
+ given_type: given_type
64
+ )
65
+ end
49
66
  else
50
67
  I18n.t(
51
68
  "servactory.#{attribute_system_name.to_s.pluralize}.checks.type.default_error.default",
@@ -37,7 +37,7 @@ module Servactory
37
37
  # Check Class: Servactory::Outputs::Validations::Type
38
38
  add_types_option_with(type)
39
39
  add_collection_option_with(type, options)
40
- add_object_option_with(type, options)
40
+ add_hash_option_with(type, options)
41
41
  end
42
42
 
43
43
  def add_types_option_with(type)
@@ -71,7 +71,7 @@ module Servactory
71
71
  )
72
72
  end
73
73
 
74
- def add_object_option_with(type, options) # rubocop:disable Metrics/MethodLength
74
+ def add_hash_option_with(type, options) # rubocop:disable Metrics/MethodLength
75
75
  collection_of_options << Servactory::Maintenance::Attributes::Option.new(
76
76
  name: :schema,
77
77
  attribute: self,
@@ -83,8 +83,8 @@ module Servactory
83
83
  )
84
84
  ],
85
85
  need_for_checks: false,
86
+ body_key: :is,
86
87
  body_fallback: {},
87
- with_advanced_mode: false,
88
88
  **options
89
89
  )
90
90
  end
@@ -5,7 +5,7 @@ module Servactory
5
5
  MAJOR = 2
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc3"
8
+ PRE = "rc5"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc3
4
+ version: 2.0.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.13'
33
+ version: '1.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.13'
40
+ version: '1.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: zeitwerk
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.50'
117
+ version: '1.57'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.50'
124
+ version: '1.57'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.17'
131
+ version: '1.19'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.17'
138
+ version: '1.19'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-rake
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '2.19'
159
+ version: '2.24'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '2.19'
166
+ version: '2.24'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: steep
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +204,15 @@ files:
204
204
  - config/locales/en.yml
205
205
  - config/locales/ru.yml
206
206
  - lib/servactory.rb
207
+ - lib/servactory/actions/action.rb
208
+ - lib/servactory/actions/aliases/collection.rb
209
+ - lib/servactory/actions/collection.rb
210
+ - lib/servactory/actions/dsl.rb
211
+ - lib/servactory/actions/shortcuts/collection.rb
212
+ - lib/servactory/actions/stages/collection.rb
213
+ - lib/servactory/actions/stages/stage.rb
214
+ - lib/servactory/actions/tools/runner.rb
215
+ - lib/servactory/actions/workspace.rb
207
216
  - lib/servactory/base.rb
208
217
  - lib/servactory/configuration/dsl.rb
209
218
  - lib/servactory/configuration/factory.rb
@@ -254,15 +263,6 @@ files:
254
263
  - lib/servactory/maintenance/validations/collection.rb
255
264
  - lib/servactory/maintenance/validations/object_schema.rb
256
265
  - lib/servactory/maintenance/validations/types.rb
257
- - lib/servactory/methods/aliases_for_make/collection.rb
258
- - lib/servactory/methods/dsl.rb
259
- - lib/servactory/methods/method.rb
260
- - lib/servactory/methods/method_collection.rb
261
- - lib/servactory/methods/shortcuts_for_make/collection.rb
262
- - lib/servactory/methods/stage.rb
263
- - lib/servactory/methods/stage_collection.rb
264
- - lib/servactory/methods/tools/runner.rb
265
- - lib/servactory/methods/workspace.rb
266
266
  - lib/servactory/outputs/collection.rb
267
267
  - lib/servactory/outputs/dsl.rb
268
268
  - lib/servactory/outputs/output.rb
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Methods
5
- class Stage
6
- attr_accessor :position,
7
- :wrapper,
8
- :rollback,
9
- :condition,
10
- :is_condition_opposite
11
-
12
- def initialize(position:, wrapper: nil, rollback: nil, condition: nil)
13
- @position = position
14
- @wrapper = wrapper
15
- @rollback = rollback
16
- @condition = condition
17
- end
18
-
19
- def next_method_position
20
- methods.size + 1
21
- end
22
-
23
- def methods
24
- @methods ||= MethodCollection.new
25
- end
26
- end
27
- end
28
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Methods
5
- class StageCollection
6
- extend Forwardable
7
- def_delegators :@collection, :<<, :each, :merge, :sort_by, :size, :empty?
8
-
9
- def initialize(collection = Set.new)
10
- @collection = collection
11
- end
12
-
13
- def sorted_by_position
14
- StageCollection.new(sort_by(&:position))
15
- end
16
- end
17
- end
18
- end