eac_ruby_utils 0.132.0 → 0.134.0
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/eac_ruby_utils/acts_as_instance_method.rb +14 -2
- data/lib/eac_ruby_utils/envs/base_command/execution.rb +13 -3
- data/lib/eac_ruby_utils/method_class.rb +4 -2
- data/lib/eac_ruby_utils/patch_module.rb +6 -6
- data/lib/eac_ruby_utils/patches/module/acts_as_instance_method.rb +3 -2
- data/lib/eac_ruby_utils/patches/module/patch_self.rb +1 -1
- data/lib/eac_ruby_utils/version.rb +1 -1
- data/lib/eac_ruby_utils.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67b9797b5e613c584015d1101bcf9027e34e5fa8442bd0087d967db89ff41e44
|
|
4
|
+
data.tar.gz: df3aab0d94a57473449bfeea90ef8959c687dfb84243182e7897cd7a3a2f7632
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa28edfdfec3de51d4a00c8cb39f6d259d4f352db7ce8f78e7b1fa11da7f36fe1520e4f5b422486fae990e1024f6a49808390b37b4c62618dc2a46fbaf35e690
|
|
7
|
+
data.tar.gz: 1ebcf27e69838827acce00cd02cad19574d6fe8fba15996b60a774bf74eb555c9ffc5dda51bf3f622195ad384b2d0f099484ae318ed828dbc6a75d9a22c94840
|
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
require 'active_support/core_ext/module/introspection'
|
|
4
4
|
require 'eac_ruby_utils/patches/class/common_constructor'
|
|
5
|
+
require 'eac_ruby_utils/patches/module/listable'
|
|
5
6
|
require 'eac_ruby_utils/patches/module/module_parent'
|
|
6
7
|
require 'eac_ruby_utils/patches/string/inflector'
|
|
7
8
|
|
|
8
9
|
module EacRubyUtils
|
|
9
10
|
class ActsAsInstanceMethod
|
|
10
|
-
|
|
11
|
+
enable_listable
|
|
12
|
+
lists.add_symbol :option, :name_mark
|
|
13
|
+
lists.add_symbol :name_mark, '': :none, '!': :exclamation, '?': :interrogation
|
|
14
|
+
|
|
15
|
+
common_constructor :method_class, :options, default: [{}] do
|
|
16
|
+
self.options = ::EacRubyUtils::ActsAsInstanceMethod.lists.option.hash_keys_validate!(options)
|
|
17
|
+
end
|
|
11
18
|
|
|
12
19
|
# @param sender_module [Module, nil]
|
|
13
20
|
# @return [self]
|
|
@@ -23,7 +30,12 @@ module EacRubyUtils
|
|
|
23
30
|
|
|
24
31
|
# @return [String]
|
|
25
32
|
def method_name
|
|
26
|
-
method_class.name.demodulize.underscore.variableize
|
|
33
|
+
"#{method_class.name.demodulize.underscore.variableize}#{method_name_mark}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @return [Symbol]
|
|
37
|
+
def method_name_mark
|
|
38
|
+
options[OPTION_NAME_MARK] || NAME_MARK_NONE
|
|
27
39
|
end
|
|
28
40
|
|
|
29
41
|
# @return [Module]
|
|
@@ -10,6 +10,12 @@ module EacRubyUtils
|
|
|
10
10
|
module Envs
|
|
11
11
|
module BaseCommand
|
|
12
12
|
module Execution
|
|
13
|
+
common_concern do
|
|
14
|
+
include ActiveSupport::Callbacks
|
|
15
|
+
|
|
16
|
+
define_callbacks :any_execution, :execute, :spawn, :system
|
|
17
|
+
end
|
|
18
|
+
|
|
13
19
|
def execute!(options = {})
|
|
14
20
|
options[:exit_outputs] = status_results.merge(options[:exit_outputs].presence || {})
|
|
15
21
|
er = ::EacRubyUtils::Envs::ExecutionResult.new(execute(options), options)
|
|
@@ -23,7 +29,9 @@ module EacRubyUtils
|
|
|
23
29
|
c = command(options)
|
|
24
30
|
debug_print("BEFORE: #{c}")
|
|
25
31
|
t1 = Time.now
|
|
26
|
-
r =
|
|
32
|
+
r = run_callbacks :any_execution, :execute do
|
|
33
|
+
::EacRubyUtils::Envs::Process.new(c).to_h
|
|
34
|
+
end
|
|
27
35
|
i = Time.now - t1
|
|
28
36
|
debug_print("AFTER [#{i}]: #{c}")
|
|
29
37
|
r
|
|
@@ -32,7 +40,9 @@ module EacRubyUtils
|
|
|
32
40
|
def spawn(options = {})
|
|
33
41
|
c = command(options)
|
|
34
42
|
debug_print("SPAWN: #{c}")
|
|
35
|
-
|
|
43
|
+
run_callbacks :any_execution, :spawn do
|
|
44
|
+
::EacRubyUtils::Envs::Spawn.new(c)
|
|
45
|
+
end
|
|
36
46
|
end
|
|
37
47
|
|
|
38
48
|
def system!(options = {})
|
|
@@ -44,7 +54,7 @@ module EacRubyUtils
|
|
|
44
54
|
def system(options = {})
|
|
45
55
|
c = command(options)
|
|
46
56
|
debug_print(c)
|
|
47
|
-
Kernel.system(c)
|
|
57
|
+
run_callbacks(:any_execution, :system) { Kernel.system(c) }
|
|
48
58
|
end
|
|
49
59
|
end
|
|
50
60
|
end
|
|
@@ -11,8 +11,10 @@ module EacRubyUtils
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
class Setup < ::EacRubyUtils::ActsAsInstanceMethod
|
|
14
|
-
common_constructor :method_class, :static_method, default: [false],
|
|
15
|
-
|
|
14
|
+
common_constructor :method_class, :static_method, :options, default: [false, {}],
|
|
15
|
+
super_args: lambda {
|
|
16
|
+
[method_class, options]
|
|
17
|
+
} do
|
|
16
18
|
perform
|
|
17
19
|
end
|
|
18
20
|
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
require 'eac_ruby_utils/patches/module/common_concern'
|
|
4
4
|
|
|
5
5
|
module EacRubyUtils
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class_methods do
|
|
10
|
-
delegate :patch_module, to: :'::EacRubyUtils::PatchModule'
|
|
6
|
+
class << self
|
|
7
|
+
def patch_module(*)
|
|
8
|
+
::EacRubyUtils::PatchModule.perform(*)
|
|
11
9
|
end
|
|
10
|
+
end
|
|
12
11
|
|
|
12
|
+
module PatchModule
|
|
13
13
|
class << self
|
|
14
|
-
def
|
|
14
|
+
def perform(target, patch)
|
|
15
15
|
return if target.include?(patch)
|
|
16
16
|
|
|
17
17
|
target.send(:include, patch)
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
require 'eac_ruby_utils/acts_as_instance_method'
|
|
4
4
|
|
|
5
5
|
class Module
|
|
6
|
+
# @param options [Hash]
|
|
6
7
|
# @return [EacRubyUtils::ActsAsInstanceMethod]
|
|
7
|
-
def acts_as_instance_method
|
|
8
|
-
::EacRubyUtils::ActsAsInstanceMethod.new(self).setup
|
|
8
|
+
def acts_as_instance_method(**options)
|
|
9
|
+
::EacRubyUtils::ActsAsInstanceMethod.new(self, options).setup
|
|
9
10
|
end
|
|
10
11
|
end
|
data/lib/eac_ruby_utils.rb
CHANGED