servactory 2.2.0.rc2 → 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/configuration/factory.rb +8 -0
- data/lib/servactory/context/workspace.rb +1 -1
- data/lib/servactory/version.rb +1 -1
- metadata +17 -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
|
|
@@ -35,6 +35,14 @@ module Servactory
|
|
|
35
35
|
@config.input_option_helpers.merge(input_option_helpers)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def internal_option_helpers(internal_option_helpers)
|
|
39
|
+
@config.internal_option_helpers.merge(internal_option_helpers)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def output_option_helpers(output_option_helpers)
|
|
43
|
+
@config.output_option_helpers.merge(output_option_helpers)
|
|
44
|
+
end
|
|
45
|
+
|
|
38
46
|
def action_aliases(action_aliases)
|
|
39
47
|
@config.action_aliases.merge(action_aliases)
|
|
40
48
|
end
|
|
@@ -55,7 +55,7 @@ module Servactory
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def fail_result!(service_result)
|
|
58
|
-
fail!(message: service_result.error.message, meta: service_result.error.meta)
|
|
58
|
+
fail!(service_result.error.type, message: service_result.error.message, meta: service_result.error.meta)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
private
|
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
|
|
@@ -72,6 +72,20 @@ dependencies:
|
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: '2.5'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: async
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.31'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '1.31'
|
|
75
89
|
- !ruby/object:Gem::Dependency
|
|
76
90
|
name: pry
|
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -231,6 +245,7 @@ files:
|
|
|
231
245
|
- lib/servactory/actions/shortcuts/collection.rb
|
|
232
246
|
- lib/servactory/actions/stages/collection.rb
|
|
233
247
|
- lib/servactory/actions/stages/stage.rb
|
|
248
|
+
- lib/servactory/actions/tools/rules.rb
|
|
234
249
|
- lib/servactory/actions/tools/runner.rb
|
|
235
250
|
- lib/servactory/actions/workspace.rb
|
|
236
251
|
- lib/servactory/base.rb
|