servactory 1.8.2 → 1.8.4
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/servactory/context/callable.rb +13 -51
 - data/lib/servactory/context/dsl.rb +1 -1
 - data/lib/servactory/context/workspace/inputs.rb +3 -10
 - data/lib/servactory/context/workspace/internals.rb +4 -4
 - data/lib/servactory/context/workspace/outputs.rb +4 -4
 - data/lib/servactory/context/workspace.rb +69 -5
 - data/lib/servactory/inputs/dsl.rb +1 -4
 - data/lib/servactory/inputs/workspace.rb +15 -0
 - data/lib/servactory/internals/dsl.rb +0 -4
 - data/lib/servactory/methods/dsl.rb +4 -7
 - data/lib/servactory/methods/tools/runner.rb +86 -0
 - data/lib/servactory/methods/workspace.rb +13 -0
 - data/lib/servactory/outputs/dsl.rb +1 -4
 - data/lib/servactory/outputs/workspace.rb +13 -0
 - data/lib/servactory/result.rb +8 -21
 - data/lib/servactory/version.rb +1 -1
 - metadata +6 -7
 - data/lib/servactory/context/store.rb +0 -13
 - data/lib/servactory/inputs/workbench.rb +0 -39
 - data/lib/servactory/internals/workbench.rb +0 -25
 - data/lib/servactory/methods/workbench.rb +0 -90
 - data/lib/servactory/outputs/workbench.rb +0 -29
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5ca0fa5827beb874848039178b4711da493272bc8d1005ba5f0d7d3a566aa099
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 62e0eb9d9a955aaf04848f7612ac7f91a88cd583e5ead545d25df9ec99a02e06
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a0720019832d9e0e5b8ca4ed63641ab2f21457b85dbe645bdbe9d1c771b13e261b60318368ec1f3dc98a1a0108761e67b9225c3da678bb9e4f29de5df47dd407
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8b4471a08a037994f8b8e79aac11fb5d0bdaec365ea48a1843323a09518d5a679586656f11ef6c8f1805e18f1236e76ee00f2fd4646f4084e28b6a6d6939b90f
         
     | 
| 
         @@ -3,64 +3,26 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Servactory
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Context
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Callable
         
     | 
| 
       6 
     | 
    
         
            -
                  def call!(arguments = {}) 
     | 
| 
       7 
     | 
    
         
            -
                     
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                     
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                       
     | 
| 
      
 6 
     | 
    
         
            +
                  def call!(arguments = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                    context = send(:new)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    context.send(
         
     | 
| 
      
 10 
     | 
    
         
            +
                      :_call!,
         
     | 
| 
      
 11 
     | 
    
         
            +
                      incoming_arguments: arguments,
         
     | 
| 
      
 12 
     | 
    
         
            +
                      collection_of_inputs: collection_of_inputs,
         
     | 
| 
      
 13 
     | 
    
         
            +
                      collection_of_internals: collection_of_internals,
         
     | 
| 
      
 14 
     | 
    
         
            +
                      collection_of_outputs: collection_of_outputs,
         
     | 
| 
      
 15 
     | 
    
         
            +
                      collection_of_stages: collection_of_stages
         
     | 
| 
       15 
16 
     | 
    
         
             
                    )
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                    methods_workbench.run!
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    Servactory::Result.success_for(
         
     | 
| 
       22 
     | 
    
         
            -
                      context: context_store.context,
         
     | 
| 
       23 
     | 
    
         
            -
                      collection_of_outputs: collection_of_outputs
         
     | 
| 
       24 
     | 
    
         
            -
                    )
         
     | 
| 
      
 18 
     | 
    
         
            +
                    Servactory::Result.success_for(context: context)
         
     | 
| 
       25 
19 
     | 
    
         
             
                  end
         
     | 
| 
       26 
20 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
                  def call(arguments = {}) 
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                    assign_data_with(arguments)
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                    inputs_workbench.find_unnecessary!
         
     | 
| 
       33 
     | 
    
         
            -
                    inputs_workbench.check_rules!
         
     | 
| 
       34 
     | 
    
         
            -
                    outputs_workbench.find_conflicts_in!(
         
     | 
| 
       35 
     | 
    
         
            -
                      collection_of_internals: collection_of_internals
         
     | 
| 
       36 
     | 
    
         
            -
                    )
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                    inputs_workbench.validate!
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                    methods_workbench.run!
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                    Servactory::Result.success_for(
         
     | 
| 
       43 
     | 
    
         
            -
                      context: context_store.context,
         
     | 
| 
       44 
     | 
    
         
            -
                      collection_of_outputs: collection_of_outputs
         
     | 
| 
       45 
     | 
    
         
            -
                    )
         
     | 
| 
      
 21 
     | 
    
         
            +
                  def call(arguments = {})
         
     | 
| 
      
 22 
     | 
    
         
            +
                    call!(arguments)
         
     | 
| 
       46 
23 
     | 
    
         
             
                  rescue Servactory.configuration.failure_class => e
         
     | 
| 
       47 
24 
     | 
    
         
             
                    Servactory::Result.failure_for(exception: e)
         
     | 
| 
       48 
25 
     | 
    
         
             
                  end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                  private
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                  attr_reader :context_store
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                  def assign_data_with(arguments)
         
     | 
| 
       55 
     | 
    
         
            -
                    inputs_workbench.assign(
         
     | 
| 
       56 
     | 
    
         
            -
                      context: context_store.context,
         
     | 
| 
       57 
     | 
    
         
            -
                      arguments: arguments
         
     | 
| 
       58 
     | 
    
         
            -
                    )
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                    internals_workbench.assign(context: context_store.context)
         
     | 
| 
       61 
     | 
    
         
            -
                    outputs_workbench.assign(context: context_store.context)
         
     | 
| 
       62 
     | 
    
         
            -
                    methods_workbench.assign(context: context_store.context)
         
     | 
| 
       63 
     | 
    
         
            -
                  end
         
     | 
| 
       64 
26 
     | 
    
         
             
                end
         
     | 
| 
       65 
27 
     | 
    
         
             
              end
         
     | 
| 
       66 
28 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,18 +3,11 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Servactory
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Context
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Workspace
         
     | 
| 
       6 
     | 
    
         
            -
                  # class Inputs
         
     | 
| 
       7 
     | 
    
         
            -
                  #   def initialize(**)
         
     | 
| 
       8 
     | 
    
         
            -
                  #     # NOTE: Look at the file `lib/servactory/inputs/tools/prepare.rb`
         
     | 
| 
       9 
     | 
    
         
            -
                  #   end
         
     | 
| 
       10 
     | 
    
         
            -
                  # end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
6 
     | 
    
         
             
                  class Inputs
         
     | 
| 
       13 
     | 
    
         
            -
                    def initialize(context 
     | 
| 
      
 7 
     | 
    
         
            +
                    def initialize(context:, incoming_arguments:, collection_of_inputs:)
         
     | 
| 
       14 
8 
     | 
    
         
             
                      @context = context
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                      @collection_of_inputs =  
     | 
| 
       17 
     | 
    
         
            -
                      @incoming_arguments = workbench.incoming_arguments
         
     | 
| 
      
 9 
     | 
    
         
            +
                      @incoming_arguments = incoming_arguments
         
     | 
| 
      
 10 
     | 
    
         
            +
                      @collection_of_inputs = collection_of_inputs
         
     | 
| 
       18 
11 
     | 
    
         
             
                    end
         
     | 
| 
       19 
12 
     | 
    
         | 
| 
       20 
13 
     | 
    
         
             
                    def method_missing(name, *args, &block)
         
     | 
| 
         @@ -4,9 +4,9 @@ module Servactory 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Context
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Workspace
         
     | 
| 
       6 
6 
     | 
    
         
             
                  class Internals
         
     | 
| 
       7 
     | 
    
         
            -
                    def initialize(context 
     | 
| 
      
 7 
     | 
    
         
            +
                    def initialize(context:, collection_of_internals:)
         
     | 
| 
       8 
8 
     | 
    
         
             
                      @context = context
         
     | 
| 
       9 
     | 
    
         
            -
                      @collection_of_internals =  
     | 
| 
      
 9 
     | 
    
         
            +
                      @collection_of_internals = collection_of_internals
         
     | 
| 
       10 
10 
     | 
    
         
             
                    end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                    def method_missing(name, *args, &block)
         
     | 
| 
         @@ -38,7 +38,7 @@ module Servactory 
     | 
|
| 
       38 
38 
     | 
    
         
             
                        value: value
         
     | 
| 
       39 
39 
     | 
    
         
             
                      )
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                      @context. 
     | 
| 
      
 41 
     | 
    
         
            +
                      @context.send(:assign_internal, internal.name, value)
         
     | 
| 
       42 
42 
     | 
    
         
             
                    end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                    def getter_with(name:, &block) # rubocop:disable Lint/UnusedMethodArgument
         
     | 
| 
         @@ -46,7 +46,7 @@ module Servactory 
     | 
|
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                      return yield if internal.nil?
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                      @context. 
     | 
| 
      
 49 
     | 
    
         
            +
                      @context.send(:fetch_internal, internal.name)
         
     | 
| 
       50 
50 
     | 
    
         
             
                    end
         
     | 
| 
       51 
51 
     | 
    
         
             
                  end
         
     | 
| 
       52 
52 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,9 +4,9 @@ module Servactory 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Context
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Workspace
         
     | 
| 
       6 
6 
     | 
    
         
             
                  class Outputs
         
     | 
| 
       7 
     | 
    
         
            -
                    def initialize(context 
     | 
| 
      
 7 
     | 
    
         
            +
                    def initialize(context:, collection_of_outputs:)
         
     | 
| 
       8 
8 
     | 
    
         
             
                      @context = context
         
     | 
| 
       9 
     | 
    
         
            -
                      @collection_of_outputs =  
     | 
| 
      
 9 
     | 
    
         
            +
                      @collection_of_outputs = collection_of_outputs
         
     | 
| 
       10 
10 
     | 
    
         
             
                    end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                    def method_missing(name, *args, &block)
         
     | 
| 
         @@ -38,7 +38,7 @@ module Servactory 
     | 
|
| 
       38 
38 
     | 
    
         
             
                        value: value
         
     | 
| 
       39 
39 
     | 
    
         
             
                      )
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                      @context. 
     | 
| 
      
 41 
     | 
    
         
            +
                      @context.send(:assign_output, output.name, value)
         
     | 
| 
       42 
42 
     | 
    
         
             
                    end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                    def getter_with(name:, &block) # rubocop:disable Lint/UnusedMethodArgument
         
     | 
| 
         @@ -46,7 +46,7 @@ module Servactory 
     | 
|
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                      return yield if output.nil?
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                      @context. 
     | 
| 
      
 49 
     | 
    
         
            +
                      @context.send(:fetch_output, output.name)
         
     | 
| 
       50 
50 
     | 
    
         
             
                    end
         
     | 
| 
       51 
51 
     | 
    
         
             
                  end
         
     | 
| 
       52 
52 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,22 +4,30 @@ module Servactory 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Context
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Workspace
         
     | 
| 
       6 
6 
     | 
    
         
             
                  def inputs
         
     | 
| 
       7 
     | 
    
         
            -
                    @inputs ||= Inputs.new( 
     | 
| 
      
 7 
     | 
    
         
            +
                    @inputs ||= Inputs.new(
         
     | 
| 
      
 8 
     | 
    
         
            +
                      context: self,
         
     | 
| 
      
 9 
     | 
    
         
            +
                      incoming_arguments: incoming_arguments,
         
     | 
| 
      
 10 
     | 
    
         
            +
                      collection_of_inputs: collection_of_inputs
         
     | 
| 
      
 11 
     | 
    
         
            +
                    )
         
     | 
| 
       8 
12 
     | 
    
         
             
                  end
         
     | 
| 
       9 
13 
     | 
    
         
             
                  alias inp inputs
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
15 
     | 
    
         
             
                  def internals
         
     | 
| 
       12 
     | 
    
         
            -
                    @internals ||= Internals.new( 
     | 
| 
      
 16 
     | 
    
         
            +
                    @internals ||= Internals.new(
         
     | 
| 
      
 17 
     | 
    
         
            +
                      context: self,
         
     | 
| 
      
 18 
     | 
    
         
            +
                      collection_of_internals: collection_of_internals
         
     | 
| 
      
 19 
     | 
    
         
            +
                    )
         
     | 
| 
       13 
20 
     | 
    
         
             
                  end
         
     | 
| 
       14 
21 
     | 
    
         
             
                  alias int internals
         
     | 
| 
       15 
22 
     | 
    
         | 
| 
       16 
23 
     | 
    
         
             
                  def outputs
         
     | 
| 
       17 
     | 
    
         
            -
                    @outputs ||= Outputs.new( 
     | 
| 
      
 24 
     | 
    
         
            +
                    @outputs ||= Outputs.new(
         
     | 
| 
      
 25 
     | 
    
         
            +
                      context: self,
         
     | 
| 
      
 26 
     | 
    
         
            +
                      collection_of_outputs: collection_of_outputs
         
     | 
| 
      
 27 
     | 
    
         
            +
                    )
         
     | 
| 
       18 
28 
     | 
    
         
             
                  end
         
     | 
| 
       19 
29 
     | 
    
         
             
                  alias out outputs
         
     | 
| 
       20 
30 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                  protected
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
31 
     | 
    
         
             
                  def fail_input!(input_name, message:)
         
     | 
| 
       24 
32 
     | 
    
         
             
                    raise Servactory.configuration.input_error_class.new(
         
     | 
| 
       25 
33 
     | 
    
         
             
                      input_name: input_name,
         
     | 
| 
         @@ -30,6 +38,62 @@ module Servactory 
     | 
|
| 
       30 
38 
     | 
    
         
             
                  def fail!(message:, meta: nil)
         
     | 
| 
       31 
39 
     | 
    
         
             
                    raise Servactory.configuration.failure_class.new(message: message, meta: meta)
         
     | 
| 
       32 
40 
     | 
    
         
             
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  private
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  attr_reader :incoming_arguments,
         
     | 
| 
      
 45 
     | 
    
         
            +
                              :collection_of_inputs,
         
     | 
| 
      
 46 
     | 
    
         
            +
                              :collection_of_internals,
         
     | 
| 
      
 47 
     | 
    
         
            +
                              :collection_of_outputs
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def _call!(
         
     | 
| 
      
 50 
     | 
    
         
            +
                    incoming_arguments:,
         
     | 
| 
      
 51 
     | 
    
         
            +
                    collection_of_inputs:,
         
     | 
| 
      
 52 
     | 
    
         
            +
                    collection_of_internals:,
         
     | 
| 
      
 53 
     | 
    
         
            +
                    collection_of_outputs:,
         
     | 
| 
      
 54 
     | 
    
         
            +
                    collection_of_stages:
         
     | 
| 
      
 55 
     | 
    
         
            +
                  )
         
     | 
| 
      
 56 
     | 
    
         
            +
                    call!(
         
     | 
| 
      
 57 
     | 
    
         
            +
                      incoming_arguments: incoming_arguments,
         
     | 
| 
      
 58 
     | 
    
         
            +
                      collection_of_inputs: collection_of_inputs,
         
     | 
| 
      
 59 
     | 
    
         
            +
                      collection_of_internals: collection_of_internals,
         
     | 
| 
      
 60 
     | 
    
         
            +
                      collection_of_outputs: collection_of_outputs,
         
     | 
| 
      
 61 
     | 
    
         
            +
                      collection_of_stages: collection_of_stages
         
     | 
| 
      
 62 
     | 
    
         
            +
                    )
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  def call!(
         
     | 
| 
      
 66 
     | 
    
         
            +
                    incoming_arguments:,
         
     | 
| 
      
 67 
     | 
    
         
            +
                    collection_of_inputs:,
         
     | 
| 
      
 68 
     | 
    
         
            +
                    collection_of_internals:,
         
     | 
| 
      
 69 
     | 
    
         
            +
                    collection_of_outputs:,
         
     | 
| 
      
 70 
     | 
    
         
            +
                    **
         
     | 
| 
      
 71 
     | 
    
         
            +
                  )
         
     | 
| 
      
 72 
     | 
    
         
            +
                    @incoming_arguments = incoming_arguments
         
     | 
| 
      
 73 
     | 
    
         
            +
                    @collection_of_inputs = collection_of_inputs
         
     | 
| 
      
 74 
     | 
    
         
            +
                    @collection_of_internals = collection_of_internals
         
     | 
| 
      
 75 
     | 
    
         
            +
                    @collection_of_outputs = collection_of_outputs
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  def service_storage
         
     | 
| 
      
 79 
     | 
    
         
            +
                    @service_storage ||= { internals: {}, outputs: {} }
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  def assign_internal(key, value)
         
     | 
| 
      
 83 
     | 
    
         
            +
                    service_storage[:internals].merge!({ key => value })
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  def fetch_internal(key)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    service_storage.fetch(:internals).fetch(key, nil)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                  def assign_output(key, value)
         
     | 
| 
      
 91 
     | 
    
         
            +
                    service_storage[:outputs].merge!({ key => value })
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                  def fetch_output(key)
         
     | 
| 
      
 95 
     | 
    
         
            +
                    service_storage.fetch(:outputs).fetch(key, nil)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
       33 
97 
     | 
    
         
             
                end
         
     | 
| 
       34 
98 
     | 
    
         
             
              end
         
     | 
| 
       35 
99 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,6 +5,7 @@ module Servactory 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module DSL
         
     | 
| 
       6 
6 
     | 
    
         
             
                  def self.included(base)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    base.extend(ClassMethods)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    base.include(Workspace)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  module ClassMethods
         
     | 
| 
         @@ -27,10 +28,6 @@ module Servactory 
     | 
|
| 
       27 
28 
     | 
    
         
             
                    def collection_of_inputs
         
     | 
| 
       28 
29 
     | 
    
         
             
                      @collection_of_inputs ||= Collection.new
         
     | 
| 
       29 
30 
     | 
    
         
             
                    end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                    def inputs_workbench
         
     | 
| 
       32 
     | 
    
         
            -
                      @inputs_workbench ||= Workbench.work_with(collection_of_inputs)
         
     | 
| 
       33 
     | 
    
         
            -
                    end
         
     | 
| 
       34 
31 
     | 
    
         
             
                  end
         
     | 
| 
       35 
32 
     | 
    
         
             
                end
         
     | 
| 
       36 
33 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Servactory
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Inputs
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Workspace
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def call!(incoming_arguments:, collection_of_inputs:, **)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    Tools::FindUnnecessary.validate!(self, incoming_arguments, collection_of_inputs)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    Tools::Rules.validate!(self, collection_of_inputs)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    Servactory::Inputs::Tools::Validation.validate!(self, incoming_arguments, collection_of_inputs)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,6 +5,7 @@ module Servactory 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module DSL
         
     | 
| 
       6 
6 
     | 
    
         
             
                  def self.included(base)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    base.extend(ClassMethods)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    base.include(Workspace)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  module ClassMethods
         
     | 
| 
         @@ -47,15 +48,15 @@ module Servactory 
     | 
|
| 
       47 
48 
     | 
    
         
             
                    def make(name, position: nil, **options)
         
     | 
| 
       48 
49 
     | 
    
         
             
                      position = position.presence || next_position
         
     | 
| 
       49 
50 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                       
     | 
| 
      
 51 
     | 
    
         
            +
                      current_stage = @current_stage.presence || Stage.new(position: position)
         
     | 
| 
       51 
52 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                       
     | 
| 
      
 53 
     | 
    
         
            +
                      current_stage.methods << Method.new(
         
     | 
| 
       53 
54 
     | 
    
         
             
                        name,
         
     | 
| 
       54 
55 
     | 
    
         
             
                        position: position,
         
     | 
| 
       55 
56 
     | 
    
         
             
                        **options
         
     | 
| 
       56 
57 
     | 
    
         
             
                      )
         
     | 
| 
       57 
58 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                      collection_of_stages <<  
     | 
| 
      
 59 
     | 
    
         
            +
                      collection_of_stages << current_stage
         
     | 
| 
       59 
60 
     | 
    
         
             
                    end
         
     | 
| 
       60 
61 
     | 
    
         | 
| 
       61 
62 
     | 
    
         
             
                    def method_missing(name, *args, &block)
         
     | 
| 
         @@ -100,10 +101,6 @@ module Servactory 
     | 
|
| 
       100 
101 
     | 
    
         
             
                    def collection_of_stages
         
     | 
| 
       101 
102 
     | 
    
         
             
                      @collection_of_stages ||= StageCollection.new
         
     | 
| 
       102 
103 
     | 
    
         
             
                    end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                    def methods_workbench
         
     | 
| 
       105 
     | 
    
         
            -
                      @methods_workbench ||= Workbench.work_with(collection_of_stages)
         
     | 
| 
       106 
     | 
    
         
            -
                    end
         
     | 
| 
       107 
104 
     | 
    
         
             
                  end
         
     | 
| 
       108 
105 
     | 
    
         
             
                end
         
     | 
| 
       109 
106 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,86 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Servactory
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Methods
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Tools
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class Runner
         
     | 
| 
      
 7 
     | 
    
         
            +
                    def self.run!(...)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      new(...).run!
         
     | 
| 
      
 9 
     | 
    
         
            +
                    end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    def initialize(context, collection_of_stages)
         
     | 
| 
      
 12 
     | 
    
         
            +
                      @context = context
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @collection_of_stages = collection_of_stages
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                    def run!
         
     | 
| 
      
 17 
     | 
    
         
            +
                      return try_to_use_call if @collection_of_stages.empty?
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                      @collection_of_stages.sorted_by_position.each do |stage|
         
     | 
| 
      
 20 
     | 
    
         
            +
                        call_stage(stage)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      end
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    private
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    def try_to_use_call
         
     | 
| 
      
 27 
     | 
    
         
            +
                      @context.try(:send, :call)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    def call_stage(stage)
         
     | 
| 
      
 31 
     | 
    
         
            +
                      return if unnecessary_for_stage?(stage)
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                      wrapper = stage.wrapper
         
     | 
| 
      
 34 
     | 
    
         
            +
                      rollback = stage.rollback
         
     | 
| 
      
 35 
     | 
    
         
            +
                      methods = stage.methods.sorted_by_position
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                      if wrapper.is_a?(Proc)
         
     | 
| 
      
 38 
     | 
    
         
            +
                        call_wrapper_with_methods(wrapper, rollback, methods)
         
     | 
| 
      
 39 
     | 
    
         
            +
                      else
         
     | 
| 
      
 40 
     | 
    
         
            +
                        call_methods(methods)
         
     | 
| 
      
 41 
     | 
    
         
            +
                      end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    def call_wrapper_with_methods(wrapper, rollback, methods)
         
     | 
| 
      
 45 
     | 
    
         
            +
                      wrapper.call(methods: -> { call_methods(methods) })
         
     | 
| 
      
 46 
     | 
    
         
            +
                    rescue StandardError => e
         
     | 
| 
      
 47 
     | 
    
         
            +
                      @context.send(rollback, e) if rollback.present?
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    def call_methods(methods)
         
     | 
| 
      
 51 
     | 
    
         
            +
                      methods.each do |method|
         
     | 
| 
      
 52 
     | 
    
         
            +
                        next if unnecessary_for_make?(method)
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                        @context.send(method.name)
         
     | 
| 
      
 55 
     | 
    
         
            +
                      end
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                    def unnecessary_for_stage?(stage)
         
     | 
| 
      
 59 
     | 
    
         
            +
                      condition = stage.condition
         
     | 
| 
      
 60 
     | 
    
         
            +
                      # is_condition_opposite = stage.is_condition_opposite
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                      result = prepare_condition_for(condition) # rubocop:disable Style/RedundantAssignment
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                      # is_condition_opposite ? !result : result
         
     | 
| 
      
 65 
     | 
    
         
            +
                      result
         
     | 
| 
      
 66 
     | 
    
         
            +
                    end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    def unnecessary_for_make?(make_method)
         
     | 
| 
      
 69 
     | 
    
         
            +
                      condition = make_method.condition
         
     | 
| 
      
 70 
     | 
    
         
            +
                      is_condition_opposite = make_method.is_condition_opposite
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                      result = prepare_condition_for(condition)
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                      is_condition_opposite ? !result : result
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    def prepare_condition_for(condition)
         
     | 
| 
      
 78 
     | 
    
         
            +
                      return false if condition.nil?
         
     | 
| 
      
 79 
     | 
    
         
            +
                      return !Servactory::Utils.true?(condition) unless condition.is_a?(Proc)
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                      !condition.call(context: @context)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    end
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
                end
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,6 +5,7 @@ module Servactory 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module DSL
         
     | 
| 
       6 
6 
     | 
    
         
             
                  def self.included(base)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    base.extend(ClassMethods)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    base.include(Workspace)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  module ClassMethods
         
     | 
| 
         @@ -23,10 +24,6 @@ module Servactory 
     | 
|
| 
       23 
24 
     | 
    
         
             
                    def collection_of_outputs
         
     | 
| 
       24 
25 
     | 
    
         
             
                      @collection_of_outputs ||= Collection.new
         
     | 
| 
       25 
26 
     | 
    
         
             
                    end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    def outputs_workbench
         
     | 
| 
       28 
     | 
    
         
            -
                      @outputs_workbench ||= Workbench.work_with(collection_of_outputs)
         
     | 
| 
       29 
     | 
    
         
            -
                    end
         
     | 
| 
       30 
27 
     | 
    
         
             
                  end
         
     | 
| 
       31 
28 
     | 
    
         
             
                end
         
     | 
| 
       32 
29 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Servactory
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Outputs
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Workspace
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def call!(collection_of_internals:, collection_of_outputs:, **)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    Tools::Conflicts.validate!(self, collection_of_outputs, collection_of_internals)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/servactory/result.rb
    CHANGED
    
    | 
         @@ -10,24 +10,11 @@ module Servactory 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  new(...).send(:as_failure)
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                def initialize(context: nil,  
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(context: nil, exception: nil)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  @context = context
         
     | 
| 
       15 
     | 
    
         
            -
                  @collection_of_outputs = collection_of_outputs
         
     | 
| 
       16 
15 
     | 
    
         
             
                  @exception = exception
         
     | 
| 
       17 
16 
     | 
    
         
             
                end
         
     | 
| 
       18 
17 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                def method_missing(name, *args, &block)
         
     | 
| 
       20 
     | 
    
         
            -
                  output = @collection_of_outputs&.find_by(name: name)
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  return super if output.nil?
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  output_value_for(output)
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                def respond_to_missing?(name, *)
         
     | 
| 
       28 
     | 
    
         
            -
                  @collection_of_outputs&.names&.include?(name) || super
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
18 
     | 
    
         
             
                def inspect
         
     | 
| 
       32 
19 
     | 
    
         
             
                  "#<#{self.class.name} #{draw_result}>"
         
     | 
| 
       33 
20 
     | 
    
         
             
                end
         
     | 
| 
         @@ -38,6 +25,10 @@ module Servactory 
     | 
|
| 
       38 
25 
     | 
    
         
             
                  define_singleton_method(:success?) { true }
         
     | 
| 
       39 
26 
     | 
    
         
             
                  define_singleton_method(:failure?) { false }
         
     | 
| 
       40 
27 
     | 
    
         | 
| 
      
 28 
     | 
    
         
            +
                  @context.send(:service_storage).fetch(:outputs).each_pair do |key, value|
         
     | 
| 
      
 29 
     | 
    
         
            +
                    define_singleton_method(key) { value }
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       41 
32 
     | 
    
         
             
                  self
         
     | 
| 
       42 
33 
     | 
    
         
             
                end
         
     | 
| 
       43 
34 
     | 
    
         | 
| 
         @@ -51,13 +42,9 @@ module Servactory 
     | 
|
| 
       51 
42 
     | 
    
         
             
                end
         
     | 
| 
       52 
43 
     | 
    
         | 
| 
       53 
44 
     | 
    
         
             
                def draw_result
         
     | 
| 
       54 
     | 
    
         
            -
                   
     | 
| 
       55 
     | 
    
         
            -
                    "@#{ 
     | 
| 
       56 
     | 
    
         
            -
                  end 
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                def output_value_for(output)
         
     | 
| 
       60 
     | 
    
         
            -
                  @context.instance_variable_get(:"@#{output.name}")
         
     | 
| 
      
 45 
     | 
    
         
            +
                  methods(false).sort.map do |method_name|
         
     | 
| 
      
 46 
     | 
    
         
            +
                    "@#{method_name}=#{send(method_name)}"
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end.join(", ")
         
     | 
| 
       61 
48 
     | 
    
         
             
                end
         
     | 
| 
       62 
49 
     | 
    
         
             
              end
         
     | 
| 
       63 
50 
     | 
    
         
             
            end
         
     | 
    
        data/lib/servactory/version.rb
    CHANGED
    
    
    
        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: 1.8. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.8.4
         
     | 
| 
       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-06- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-06-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -195,7 +195,6 @@ files: 
     | 
|
| 
       195 
195 
     | 
    
         
             
            - lib/servactory/configuration/setup.rb
         
     | 
| 
       196 
196 
     | 
    
         
             
            - lib/servactory/context/callable.rb
         
     | 
| 
       197 
197 
     | 
    
         
             
            - lib/servactory/context/dsl.rb
         
     | 
| 
       198 
     | 
    
         
            -
            - lib/servactory/context/store.rb
         
     | 
| 
       199 
198 
     | 
    
         
             
            - lib/servactory/context/workspace.rb
         
     | 
| 
       200 
199 
     | 
    
         
             
            - lib/servactory/context/workspace/inputs.rb
         
     | 
| 
       201 
200 
     | 
    
         
             
            - lib/servactory/context/workspace/internals.rb
         
     | 
| 
         @@ -227,13 +226,12 @@ files: 
     | 
|
| 
       227 
226 
     | 
    
         
             
            - lib/servactory/inputs/validations/must.rb
         
     | 
| 
       228 
227 
     | 
    
         
             
            - lib/servactory/inputs/validations/required.rb
         
     | 
| 
       229 
228 
     | 
    
         
             
            - lib/servactory/inputs/validations/type.rb
         
     | 
| 
       230 
     | 
    
         
            -
            - lib/servactory/inputs/ 
     | 
| 
      
 229 
     | 
    
         
            +
            - lib/servactory/inputs/workspace.rb
         
     | 
| 
       231 
230 
     | 
    
         
             
            - lib/servactory/internals/collection.rb
         
     | 
| 
       232 
231 
     | 
    
         
             
            - lib/servactory/internals/dsl.rb
         
     | 
| 
       233 
232 
     | 
    
         
             
            - lib/servactory/internals/internal.rb
         
     | 
| 
       234 
233 
     | 
    
         
             
            - lib/servactory/internals/validations/base.rb
         
     | 
| 
       235 
234 
     | 
    
         
             
            - lib/servactory/internals/validations/type.rb
         
     | 
| 
       236 
     | 
    
         
            -
            - lib/servactory/internals/workbench.rb
         
     | 
| 
       237 
235 
     | 
    
         
             
            - lib/servactory/methods/aliases_for_make/collection.rb
         
     | 
| 
       238 
236 
     | 
    
         
             
            - lib/servactory/methods/dsl.rb
         
     | 
| 
       239 
237 
     | 
    
         
             
            - lib/servactory/methods/method.rb
         
     | 
| 
         @@ -241,14 +239,15 @@ files: 
     | 
|
| 
       241 
239 
     | 
    
         
             
            - lib/servactory/methods/shortcuts_for_make/collection.rb
         
     | 
| 
       242 
240 
     | 
    
         
             
            - lib/servactory/methods/stage.rb
         
     | 
| 
       243 
241 
     | 
    
         
             
            - lib/servactory/methods/stage_collection.rb
         
     | 
| 
       244 
     | 
    
         
            -
            - lib/servactory/methods/ 
     | 
| 
      
 242 
     | 
    
         
            +
            - lib/servactory/methods/tools/runner.rb
         
     | 
| 
      
 243 
     | 
    
         
            +
            - lib/servactory/methods/workspace.rb
         
     | 
| 
       245 
244 
     | 
    
         
             
            - lib/servactory/outputs/collection.rb
         
     | 
| 
       246 
245 
     | 
    
         
             
            - lib/servactory/outputs/dsl.rb
         
     | 
| 
       247 
246 
     | 
    
         
             
            - lib/servactory/outputs/output.rb
         
     | 
| 
       248 
247 
     | 
    
         
             
            - lib/servactory/outputs/tools/conflicts.rb
         
     | 
| 
       249 
248 
     | 
    
         
             
            - lib/servactory/outputs/validations/base.rb
         
     | 
| 
       250 
249 
     | 
    
         
             
            - lib/servactory/outputs/validations/type.rb
         
     | 
| 
       251 
     | 
    
         
            -
            - lib/servactory/outputs/ 
     | 
| 
      
 250 
     | 
    
         
            +
            - lib/servactory/outputs/workspace.rb
         
     | 
| 
       252 
251 
     | 
    
         
             
            - lib/servactory/result.rb
         
     | 
| 
       253 
252 
     | 
    
         
             
            - lib/servactory/test_kit/fake_type.rb
         
     | 
| 
       254 
253 
     | 
    
         
             
            - lib/servactory/test_kit/result.rb
         
     | 
| 
         @@ -1,39 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Servactory
         
     | 
| 
       4 
     | 
    
         
            -
              module Inputs
         
     | 
| 
       5 
     | 
    
         
            -
                class Workbench
         
     | 
| 
       6 
     | 
    
         
            -
                  attr_reader :collection,
         
     | 
| 
       7 
     | 
    
         
            -
                              :incoming_arguments
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                  def self.work_with(...)
         
     | 
| 
       10 
     | 
    
         
            -
                    new(...)
         
     | 
| 
       11 
     | 
    
         
            -
                  end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                  def initialize(collection)
         
     | 
| 
       14 
     | 
    
         
            -
                    @collection = collection
         
     | 
| 
       15 
     | 
    
         
            -
                  end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  def assign(context:, arguments:)
         
     | 
| 
       18 
     | 
    
         
            -
                    @context = context
         
     | 
| 
       19 
     | 
    
         
            -
                    @incoming_arguments = arguments
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  def find_unnecessary!
         
     | 
| 
       23 
     | 
    
         
            -
                    Tools::FindUnnecessary.validate!(context, @incoming_arguments, collection)
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  def check_rules!
         
     | 
| 
       27 
     | 
    
         
            -
                    Tools::Rules.validate!(context, collection)
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                  def validate!
         
     | 
| 
       31 
     | 
    
         
            -
                    Tools::Validation.validate!(context, @incoming_arguments, collection)
         
     | 
| 
       32 
     | 
    
         
            -
                  end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                  private
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  attr_reader :context
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
              end
         
     | 
| 
       39 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,25 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Servactory
         
     | 
| 
       4 
     | 
    
         
            -
              module Internals
         
     | 
| 
       5 
     | 
    
         
            -
                class Workbench
         
     | 
| 
       6 
     | 
    
         
            -
                  attr_reader :collection
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                  def self.work_with(...)
         
     | 
| 
       9 
     | 
    
         
            -
                    new(...)
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  def initialize(collection)
         
     | 
| 
       13 
     | 
    
         
            -
                    @collection = collection
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def assign(context:)
         
     | 
| 
       17 
     | 
    
         
            -
                    @context = context
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  private
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  attr_reader :context
         
     | 
| 
       23 
     | 
    
         
            -
                end
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,90 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Servactory
         
     | 
| 
       4 
     | 
    
         
            -
              module Methods
         
     | 
| 
       5 
     | 
    
         
            -
                class Workbench
         
     | 
| 
       6 
     | 
    
         
            -
                  def self.work_with(...)
         
     | 
| 
       7 
     | 
    
         
            -
                    new(...)
         
     | 
| 
       8 
     | 
    
         
            -
                  end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                  def initialize(collection_of_stages)
         
     | 
| 
       11 
     | 
    
         
            -
                    @collection_of_stages = collection_of_stages
         
     | 
| 
       12 
     | 
    
         
            -
                  end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  def assign(context:)
         
     | 
| 
       15 
     | 
    
         
            -
                    @context = context
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                  def run!
         
     | 
| 
       19 
     | 
    
         
            -
                    return try_to_use_call if collection_of_stages.empty?
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    collection_of_stages.sorted_by_position.each do |stage|
         
     | 
| 
       22 
     | 
    
         
            -
                      call_stage(stage)
         
     | 
| 
       23 
     | 
    
         
            -
                    end
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  private
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  attr_reader :context,
         
     | 
| 
       29 
     | 
    
         
            -
                              :collection_of_stages
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                  def try_to_use_call
         
     | 
| 
       32 
     | 
    
         
            -
                    context.try(:send, :call)
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                  def call_stage(stage)
         
     | 
| 
       36 
     | 
    
         
            -
                    return if unnecessary_for_stage?(stage)
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                    wrapper = stage.wrapper
         
     | 
| 
       39 
     | 
    
         
            -
                    rollback = stage.rollback
         
     | 
| 
       40 
     | 
    
         
            -
                    methods = stage.methods.sorted_by_position
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                    if wrapper.is_a?(Proc)
         
     | 
| 
       43 
     | 
    
         
            -
                      call_wrapper_with_methods(wrapper, rollback, methods)
         
     | 
| 
       44 
     | 
    
         
            -
                    else
         
     | 
| 
       45 
     | 
    
         
            -
                      call_methods(methods)
         
     | 
| 
       46 
     | 
    
         
            -
                    end
         
     | 
| 
       47 
     | 
    
         
            -
                  end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  def call_wrapper_with_methods(wrapper, rollback, methods)
         
     | 
| 
       50 
     | 
    
         
            -
                    wrapper.call(methods: -> { call_methods(methods) })
         
     | 
| 
       51 
     | 
    
         
            -
                  rescue StandardError => e
         
     | 
| 
       52 
     | 
    
         
            -
                    context.send(rollback, e) if rollback.present?
         
     | 
| 
       53 
     | 
    
         
            -
                  end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                  def call_methods(methods)
         
     | 
| 
       56 
     | 
    
         
            -
                    methods.each do |make_method|
         
     | 
| 
       57 
     | 
    
         
            -
                      next if unnecessary_for_make?(make_method)
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                      context.send(make_method.name)
         
     | 
| 
       60 
     | 
    
         
            -
                    end
         
     | 
| 
       61 
     | 
    
         
            -
                  end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                  def unnecessary_for_stage?(stage)
         
     | 
| 
       64 
     | 
    
         
            -
                    condition = stage.condition
         
     | 
| 
       65 
     | 
    
         
            -
                    # is_condition_opposite = stage.is_condition_opposite
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                    result = prepare_condition_for(condition) # rubocop:disable Style/RedundantAssignment
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                    # is_condition_opposite ? !result : result
         
     | 
| 
       70 
     | 
    
         
            -
                    result
         
     | 
| 
       71 
     | 
    
         
            -
                  end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                  def unnecessary_for_make?(make_method)
         
     | 
| 
       74 
     | 
    
         
            -
                    condition = make_method.condition
         
     | 
| 
       75 
     | 
    
         
            -
                    is_condition_opposite = make_method.is_condition_opposite
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                    result = prepare_condition_for(condition)
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                    is_condition_opposite ? !result : result
         
     | 
| 
       80 
     | 
    
         
            -
                  end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                  def prepare_condition_for(condition)
         
     | 
| 
       83 
     | 
    
         
            -
                    return false if condition.nil?
         
     | 
| 
       84 
     | 
    
         
            -
                    return !Servactory::Utils.true?(condition) unless condition.is_a?(Proc)
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                    !condition.call(context: context)
         
     | 
| 
       87 
     | 
    
         
            -
                  end
         
     | 
| 
       88 
     | 
    
         
            -
                end
         
     | 
| 
       89 
     | 
    
         
            -
              end
         
     | 
| 
       90 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,29 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Servactory
         
     | 
| 
       4 
     | 
    
         
            -
              module Outputs
         
     | 
| 
       5 
     | 
    
         
            -
                class Workbench
         
     | 
| 
       6 
     | 
    
         
            -
                  attr_reader :collection
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                  def self.work_with(...)
         
     | 
| 
       9 
     | 
    
         
            -
                    new(...)
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  def initialize(collection)
         
     | 
| 
       13 
     | 
    
         
            -
                    @collection = collection
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def assign(context:)
         
     | 
| 
       17 
     | 
    
         
            -
                    @context = context
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  def find_conflicts_in!(collection_of_internals:)
         
     | 
| 
       21 
     | 
    
         
            -
                    Tools::Conflicts.validate!(context, collection, collection_of_internals)
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  private
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  attr_reader :context
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
            end
         
     |