servactory 2.2.0.rc3 → 2.2.0.rc4
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/config/locales/en.yml +1 -0
 - data/config/locales/ru.yml +1 -0
 - data/lib/servactory/actions/tools/rules.rb +71 -0
 - data/lib/servactory/actions/workspace.rb +1 -0
 - data/lib/servactory/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: '018fb4d826b26f9497722a3f89104d1869b478f8b9e5a951bc1b3af2e065a8fa'
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2a47ba47a772ab0825a544888ce0cdcfe840aa9a50ac32971135d3d23dae60fd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e6b88d34c9a3efba9ed2fc47b963284cb6bcdc998dc5f2d8a5f9973d93ac42a825ac8ac6eb5f0f2a15348dc34380274c88d1d43162cd653b1be1062621874fe9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 115231d9fa2863b7c7ad02867ea79c363c11369c621e125d331e1ad2be16c810b790dcc5f8a98f091701097d989a9b8c8c352a65089f4cf1ad90b29d1c93abfd
         
     | 
    
        data/config/locales/en.yml
    CHANGED
    
    | 
         @@ -7,6 +7,7 @@ en: 
     | 
|
| 
       7 
7 
     | 
    
         
             
                methods:
         
     | 
| 
       8 
8 
     | 
    
         
             
                  call:
         
     | 
| 
       9 
9 
     | 
    
         
             
                    not_used: "[%{service_class_name}] Nothing to perform. Use `make` or create a `call` method."
         
     | 
| 
      
 10 
     | 
    
         
            +
                  cannot_be_overwritten: "[%{service_class_name}] The following methods cannot be overwritten: %{list_of_methods}"
         
     | 
| 
       10 
11 
     | 
    
         
             
                inputs:
         
     | 
| 
       11 
12 
     | 
    
         
             
                  undefined:
         
     | 
| 
       12 
13 
     | 
    
         
             
                    getter: "[%{service_class_name}] Undefined input attribute `%{input_name}`"
         
     | 
    
        data/config/locales/ru.yml
    CHANGED
    
    | 
         @@ -7,6 +7,7 @@ ru: 
     | 
|
| 
       7 
7 
     | 
    
         
             
                methods:
         
     | 
| 
       8 
8 
     | 
    
         
             
                  call:
         
     | 
| 
       9 
9 
     | 
    
         
             
                    not_used: "[%{service_class_name}] Нечего выполнять. Используйте `make` или создайте метод `call`."
         
     | 
| 
      
 10 
     | 
    
         
            +
                  cannot_be_overwritten: "[%{service_class_name}] Нельзя перезаписать следующие методы: %{list_of_methods}"
         
     | 
| 
       10 
11 
     | 
    
         
             
                inputs:
         
     | 
| 
       11 
12 
     | 
    
         
             
                  undefined:
         
     | 
| 
       12 
13 
     | 
    
         
             
                    getter: "[%{service_class_name}] Неизвестный входящий атрибут `%{input_name}`"
         
     | 
| 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Servactory
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Actions
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Tools
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class Rules
         
     | 
| 
      
 7 
     | 
    
         
            +
                    RESERVED_METHOD_NAMES = %i[
         
     | 
| 
      
 8 
     | 
    
         
            +
                      inputs
         
     | 
| 
      
 9 
     | 
    
         
            +
                      internals
         
     | 
| 
      
 10 
     | 
    
         
            +
                      outputs
         
     | 
| 
      
 11 
     | 
    
         
            +
                      success!
         
     | 
| 
      
 12 
     | 
    
         
            +
                      fail_input!
         
     | 
| 
      
 13 
     | 
    
         
            +
                      fail_internal!
         
     | 
| 
      
 14 
     | 
    
         
            +
                      fail_output!
         
     | 
| 
      
 15 
     | 
    
         
            +
                      fail!
         
     | 
| 
      
 16 
     | 
    
         
            +
                      fail_result!
         
     | 
| 
      
 17 
     | 
    
         
            +
                    ].freeze
         
     | 
| 
      
 18 
     | 
    
         
            +
                    private_constant :RESERVED_METHOD_NAMES
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    def self.check!(...)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      new(...).check!
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    def initialize(context)
         
     | 
| 
      
 25 
     | 
    
         
            +
                      @context = context
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                    def check!
         
     | 
| 
      
 29 
     | 
    
         
            +
                      check_public_methods!
         
     | 
| 
      
 30 
     | 
    
         
            +
                      check_protected_methods!
         
     | 
| 
      
 31 
     | 
    
         
            +
                      check_private_methods!
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                    private
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    def check_public_methods!
         
     | 
| 
      
 37 
     | 
    
         
            +
                      check_in!(@context.public_methods(false))
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    def check_protected_methods!
         
     | 
| 
      
 41 
     | 
    
         
            +
                      check_in!(@context.protected_methods(false))
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    def check_private_methods!
         
     | 
| 
      
 45 
     | 
    
         
            +
                      check_in!(@context.private_methods(false))
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                    def check_in!(list_of_methods)
         
     | 
| 
      
 49 
     | 
    
         
            +
                      found_reserved_names = RESERVED_METHOD_NAMES & list_of_methods
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                      return if found_reserved_names.empty?
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                      formatted_text = found_reserved_names.map { |method_name| "`#{method_name}`" }.join(", ")
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                      raise_message_with!(formatted_text)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                    def raise_message_with!(formatted_text)
         
     | 
| 
      
 59 
     | 
    
         
            +
                      raise @context.class.config.failure_class.new(
         
     | 
| 
      
 60 
     | 
    
         
            +
                        type: :base,
         
     | 
| 
      
 61 
     | 
    
         
            +
                        message: I18n.t(
         
     | 
| 
      
 62 
     | 
    
         
            +
                          "servactory.methods.cannot_be_overwritten",
         
     | 
| 
      
 63 
     | 
    
         
            +
                          service_class_name: @context.class.name,
         
     | 
| 
      
 64 
     | 
    
         
            +
                          list_of_methods: formatted_text
         
     | 
| 
      
 65 
     | 
    
         
            +
                        )
         
     | 
| 
      
 66 
     | 
    
         
            +
                      )
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
            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: 2.2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.2.0.rc4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Anton Sokolov
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-02-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -245,6 +245,7 @@ files: 
     | 
|
| 
       245 
245 
     | 
    
         
             
            - lib/servactory/actions/shortcuts/collection.rb
         
     | 
| 
       246 
246 
     | 
    
         
             
            - lib/servactory/actions/stages/collection.rb
         
     | 
| 
       247 
247 
     | 
    
         
             
            - lib/servactory/actions/stages/stage.rb
         
     | 
| 
      
 248 
     | 
    
         
            +
            - lib/servactory/actions/tools/rules.rb
         
     | 
| 
       248 
249 
     | 
    
         
             
            - lib/servactory/actions/tools/runner.rb
         
     | 
| 
       249 
250 
     | 
    
         
             
            - lib/servactory/actions/workspace.rb
         
     | 
| 
       250 
251 
     | 
    
         
             
            - lib/servactory/base.rb
         
     |