eac_cli 0.6.0 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1853322785755d21efac308e25451d06916d45c48ea74707a0f9429c29c27746
4
- data.tar.gz: 13fcaa983d84cc271567eae554552fa71449051b3250429158576ac0e7ab53e9
3
+ metadata.gz: be9a0ff56cf7295f999d8fa365e9eb8b153c9f95c63f645ac0b3bb88e063912a
4
+ data.tar.gz: '09e64e9fd8dc0efe62b7c237ee0bb9e960ff21b148da33afa41599e8919f16da'
5
5
  SHA512:
6
- metadata.gz: 1ac522fbc5d345d5dbf135a07cc934a6f88158ff0470fee2e61667e82b84728c03b1902b995fbb201b7e20f1eae5aa5cab35367edc43ee1a614f603d35cd8777
7
- data.tar.gz: 4db03e5ba8a565abfd066f33e57a86bdffc97e0ecbf70e0234246d1e048fb6e0e8dc83824325687d724b64e03adae31cb9407c0319500df763ec05be23972fd8
6
+ metadata.gz: d35cf09f5d89dbd5243f827f3b75c95c3f26051be6b248e322f532823ff969296a3094571c8c9d91e275f6cf872ab9116fa8d27294009722df916f12508f7649
7
+ data.tar.gz: 1dbb6ef81c81fcaea236339cb530cb0ed7700675c1442e040cdea3b5779ea2a33ef9472db39d7f9a43a101d204bb2b080016b5d6487a3d25ea27495a14dc6138
@@ -9,7 +9,6 @@ module EacCli
9
9
  extend ::ActiveSupport::Concern
10
10
 
11
11
  included do
12
- singleton_class.prepend ClassMethods
13
12
  prepend InstanceMethods
14
13
  end
15
14
 
@@ -17,15 +16,10 @@ module EacCli
17
16
  def check(klass)
18
17
  return unless klass < ::EacRubyUtils::Console::DocoptRunner
19
18
 
20
- klass.include(self)
21
- end
22
- end
19
+ ::EacCli::Runner.alias_runner_class_methods(klass, '', 'eac_cli')
20
+ ::EacCli::Runner.alias_runner_class_methods(klass, 'original', '')
23
21
 
24
- module ClassMethods
25
- def create(*context_args)
26
- r = new(*context_args)
27
- r.runner_context = ::EacCli::Runner::Context.new(*context_args)
28
- r
22
+ klass.include(self)
29
23
  end
30
24
  end
31
25
 
@@ -10,13 +10,39 @@ module EacCli
10
10
  require_sub __FILE__
11
11
  extend ::ActiveSupport::Concern
12
12
 
13
+ class << self
14
+ def alias_runner_class_methods(klass, from_suffix, to_suffix)
15
+ %i[create run].each do |method|
16
+ alias_class_method(klass, build_method_name(method, from_suffix),
17
+ build_method_name(method, to_suffix))
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def alias_class_method(klass, from, to)
24
+ sklass = klass.singleton_class
25
+ return unless sklass.method_defined?(from)
26
+
27
+ sklass.alias_method to, from
28
+ end
29
+
30
+ def build_method_name(name, suffix)
31
+ ss = suffix.if_present('') { |s| "#{s}_" }
32
+ "#{ss}#{name}"
33
+ end
34
+ end
35
+
36
+ the_module = self
13
37
  included do
14
- extend ClassMethods
38
+ the_module.alias_runner_class_methods(self, '', 'original')
39
+
40
+ extend AfterClassMethods
15
41
  include InstanceMethods
16
42
  ::EacCli::Docopt::RunnerExtension.check(self)
17
43
  end
18
44
 
19
- module ClassMethods
45
+ module AfterClassMethods
20
46
  def create(*runner_context_args)
21
47
  r = new
22
48
  r.runner_context = ::EacCli::Runner::Context.new(*runner_context_args)
@@ -31,10 +57,14 @@ module EacCli
31
57
  end
32
58
 
33
59
  def runner_definition(&block)
34
- @runner_definition ||= ::EacCli::Definition.new
60
+ @runner_definition ||= super_runner_definition
35
61
  @runner_definition.instance_eval(&block) if block
36
62
  @runner_definition
37
63
  end
64
+
65
+ def super_runner_definition
66
+ superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
67
+ end
38
68
  end
39
69
 
40
70
  module InstanceMethods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils