servactory 2.2.1 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d6caa4bc22185741274dfaa2482bb254795dfa692f7890de4ec47651fd3a574
4
- data.tar.gz: e7852ab4e6edc5be891f3551c5c7daccd7ab90d5e448cae08b4efc115278af0a
3
+ metadata.gz: a51453d18412c6b59e5bf08eafdc54c5bf30d5f174b3f0bac9f765f86ce571d3
4
+ data.tar.gz: 2c808474f78bc6de5305768c95ed8da3b235c25f51bdf03b8f88e824aa25ad9d
5
5
  SHA512:
6
- metadata.gz: e1dad15de09d231e20f79b5fbf0a51b4fb4a7f17f23797bbe1a2adae97e53cb036ed056be687342847897b3bb7e3b7724d399409f270f27d5a2c061fa9c2e33f
7
- data.tar.gz: ac7036078315e72298aac49674111adf3d15ccc6c7b643ee75bff9c5ac92078a5915d27b1c560ce33eebbc55ed50ac747306ed6ea9cfd9c76d6e311e64cfe513
6
+ metadata.gz: 2868a096dd3b76d8bcc5ee718220c7335abbab1b5d9423260b0d0e84e258bf97cf2b737976a625d6bed4ef0dbbfc036bb26f9aadfc7ebf208fedd97c797cad47
7
+ data.tar.gz: fb248ceeaf20d9d4945b7e0872d3c069416379f650afca902910d324747c03d98dce46330283ae67466a1cc79651225903ef53075b3d5c3295023fd3ac883c84
@@ -1,9 +1,8 @@
1
1
  en:
2
2
  servactory:
3
3
  common:
4
- undefined_local_variable_or_method: "[%{service_class_name}] Undefined local variable or method `%{method_name}`"
5
4
  undefined_method:
6
- missing_name: "[%{service_class_name}] Undefined method `%{method_name}` for `%{missing_name}`"
5
+ missing_name: "[%{service_class_name}] %{error_text}"
7
6
  methods:
8
7
  call:
9
8
  not_used: "[%{service_class_name}] Nothing to perform. Use `make` or create a `call` method."
@@ -1,9 +1,8 @@
1
1
  ru:
2
2
  servactory:
3
3
  common:
4
- undefined_local_variable_or_method: "[%{service_class_name}] Неопределенная локальная переменная или метод `%{method_name}`"
5
4
  undefined_method:
6
- missing_name: "[%{service_class_name}] Неопределенный метод `%{method_name}` для `%{missing_name}`"
5
+ missing_name: "[%{service_class_name}] %{error_text}"
7
6
  methods:
8
7
  call:
9
8
  not_used: "[%{service_class_name}] Нечего выполнять. Используйте `make` или создайте метод `call`."
@@ -57,10 +57,6 @@ module Servactory
57
57
 
58
58
  def call_method(method)
59
59
  @context.send(method.name)
60
- rescue NoMethodError => e
61
- rescue_no_method_error_with(exception: e)
62
- rescue NameError
63
- rescue_name_error_with(method: method)
64
60
  end
65
61
 
66
62
  def unnecessary_for_stage?(stage)
@@ -87,37 +83,6 @@ module Servactory
87
83
 
88
84
  !condition.call(context: @context)
89
85
  end
90
-
91
- ########################################################################
92
-
93
- def rescue_no_method_error_with(exception:) # rubocop:disable Metrics/MethodLength
94
- raise @context.class.config.failure_class.new(
95
- type: :base,
96
- message: I18n.t(
97
- "servactory.common.undefined_method.missing_name",
98
- service_class_name: @context.class.name,
99
- method_name: exception.name,
100
- missing_name: if exception.missing_name.nil?
101
- exception.missing_name.inspect
102
- elsif exception.missing_name == "NilClass"
103
- nil.inspect
104
- else
105
- exception.missing_name
106
- end
107
- )
108
- )
109
- end
110
-
111
- def rescue_name_error_with(method:)
112
- raise @context.class.config.failure_class.new(
113
- type: :base,
114
- message: I18n.t(
115
- "servactory.common.undefined_local_variable_or_method",
116
- service_class_name: @context.class.name,
117
- method_name: method.name
118
- )
119
- )
120
- end
121
86
  end
122
87
  end
123
88
  end
@@ -8,7 +8,7 @@ module Servactory
8
8
  end
9
9
 
10
10
  module ClassMethods
11
- def inherited(child) # rubocop:disable Metrics/AbcSize
11
+ def inherited(child) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
12
12
  super
13
13
 
14
14
  child.config.input_error_class = config.input_error_class
@@ -21,6 +21,8 @@ module Servactory
21
21
  child.config.collection_mode_class_names = config.collection_mode_class_names
22
22
 
23
23
  child.config.input_option_helpers = config.input_option_helpers
24
+ child.config.internal_option_helpers = config.internal_option_helpers
25
+ child.config.output_option_helpers = config.output_option_helpers
24
26
 
25
27
  child.config.action_aliases = config.action_aliases
26
28
  child.config.action_shortcuts = config.action_shortcuts
@@ -93,7 +93,7 @@ module Servactory
93
93
 
94
94
  ########################################################################
95
95
 
96
- def rescue_no_method_error_with(exception:)
96
+ def rescue_no_method_error_with(exception:) # rubocop:disable Metrics/MethodLength
97
97
  raise exception if @context.blank?
98
98
 
99
99
  raise @context.class.config.failure_class.new(
@@ -101,9 +101,11 @@ module Servactory
101
101
  message: I18n.t(
102
102
  "servactory.common.undefined_method.missing_name",
103
103
  service_class_name: @context.class.name,
104
- method_name: exception.name,
105
- missing_name: exception.missing_name.inspect
106
- )
104
+ error_text: exception.message
105
+ ),
106
+ meta: {
107
+ original_exception: exception
108
+ }
107
109
  )
108
110
  end
109
111
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 2
7
- PATCH = 1
7
+ PATCH = 3
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
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.1
4
+ version: 2.2.3
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-28 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport