eac_tools 0.62.1 → 0.64.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +33 -33
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/data/package.rb +11 -0
- data/sub/avm/lib/avm/instances/base/subcommand_parent.rb +25 -0
- data/sub/avm/lib/avm/instances/data/files_unit.rb +2 -2
- data/sub/avm/lib/avm/instances/data/unit.rb +12 -0
- data/sub/avm/lib/avm/instances/entry_keys.rb +1 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_postgresql_base0/Gemfile +3 -0
- data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +3 -3
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +16 -16
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +0 -4
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance_with.rb +5 -0
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +3 -3
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +2 -10
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/load.rb +3 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +11 -11
- data/sub/{avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners → avm-tools/lib/avm/tools/runner/instance}/data/dump.rb +11 -6
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/load.rb +58 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/clear.rb +24 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/dump.rb +41 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit.rb +42 -0
- data/sub/{avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners → avm-tools/lib/avm/tools/runner/instance}/data.rb +4 -3
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_cli/eac_cli.gemspec +1 -1
- data/sub/eac_cli/lib/eac_cli/definition/base_option.rb +3 -1
- data/sub/eac_cli/lib/eac_cli/definition/default_value.rb +17 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +22 -23
- data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +40 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +15 -4
- data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +2 -2
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +21 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +0 -1
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/{abstract_methods.rb → acts_as_abstract.rb} +4 -4
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/abstract.rb +2 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +3 -3
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_abstract.rb +14 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +5 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +14 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +2 -11
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +2 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{abstract_methods_spec.rb → acts_as_abstract_spec.rb} +2 -2
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/abstract_spec.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/acts_as_abstract_spec.rb +14 -0
- metadata +26 -29
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/subcommand_parent.rb +0 -26
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/runner'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Instance < ::Avm::Instances::Runner
|
10
|
+
class Data
|
11
|
+
class Unit
|
12
|
+
require_sub __FILE__
|
13
|
+
runner_with :help, :subcommands do
|
14
|
+
pos_arg :identifier
|
15
|
+
subcommands
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Enumerable<String>]
|
19
|
+
def available_units_ids
|
20
|
+
data_package.units_ids
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Avm::Instances::Data::Package]
|
24
|
+
def data_package
|
25
|
+
runner_context.call(:instance).data_package
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Avm::Instances::Data::Unit]
|
29
|
+
def data_unit
|
30
|
+
data_package.unit(parsed.identifier)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [String]
|
34
|
+
def help_extra_text
|
35
|
+
help_join_sections(super, list_section('Available units', available_units_ids))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/instances/runner'
|
3
4
|
require 'eac_cli/core_ext'
|
4
5
|
|
5
6
|
module Avm
|
6
|
-
module
|
7
|
-
|
8
|
-
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Instance < ::Avm::Instances::Runner
|
9
10
|
class Data
|
10
11
|
require_sub __FILE__
|
11
12
|
runner_with :help, :subcommands do
|
data/sub/eac_cli/eac_cli.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
16
16
|
s.add_dependency 'eac_config', '~> 0.12'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.114'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
20
20
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/definition/default_value'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EacCli
|
6
7
|
class Definition
|
7
8
|
class BaseOption
|
8
9
|
require_sub __FILE__
|
10
|
+
include ::EacCli::Definition::DefaultValue
|
9
11
|
|
10
12
|
class << self
|
11
13
|
def from_args(args)
|
@@ -17,7 +19,7 @@ module EacCli
|
|
17
19
|
DEFAULT_REQUIRED = false
|
18
20
|
|
19
21
|
enable_listable
|
20
|
-
enable_abstract_methods :build_value
|
22
|
+
enable_abstract_methods :build_value
|
21
23
|
lists.add_symbol :option, :default, :optional, :usage, :repeat, :required
|
22
24
|
common_constructor :short, :long, :description, :options, default: [{}] do
|
23
25
|
raise 'Nor short neither long selector was set' if short.blank? && long.blank?
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
class Definition
|
7
|
+
module DefaultValue
|
8
|
+
def default_value
|
9
|
+
default_value? ? options[OPTION_DEFAULT] : default_default_value
|
10
|
+
end
|
11
|
+
|
12
|
+
def default_value?
|
13
|
+
options.key?(OPTION_DEFAULT)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/runner_with/help/layout'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EacCli
|
6
7
|
module RunnerWith
|
7
8
|
module Help
|
8
9
|
class Builder
|
10
|
+
include ::EacCli::RunnerWith::Help::Layout
|
9
11
|
require_sub __FILE__, require_dependency: true
|
10
12
|
common_constructor :runner
|
11
13
|
|
12
|
-
SEP = ' '
|
13
|
-
IDENT = SEP * 2
|
14
|
-
OPTION_DESC_SEP = IDENT * 2
|
15
|
-
|
16
14
|
class << self
|
17
15
|
def option_long(option)
|
18
16
|
b = option.long
|
@@ -35,7 +33,7 @@ module EacCli
|
|
35
33
|
end
|
36
34
|
|
37
35
|
def word_separator
|
38
|
-
|
36
|
+
WORD_SEPARATOR
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
@@ -45,36 +43,37 @@ module EacCli
|
|
45
43
|
runner.class.runner_definition
|
46
44
|
end
|
47
45
|
|
46
|
+
# @return [Enumerable<String>]
|
47
|
+
def extra_sections
|
48
|
+
runner.if_respond(:help_extra_text, []) do |v|
|
49
|
+
[v.to_s]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
48
53
|
def option_definition(option)
|
49
54
|
[self.class.option_usage_full(option), option.description,
|
50
55
|
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
51
|
-
.reject(&:blank?).join(
|
52
|
-
end
|
53
|
-
|
54
|
-
def section(header, include_header = true)
|
55
|
-
b = include_header ? "#{header.humanize}:\n" : ''
|
56
|
-
b += send("self_#{header}") + "\n"
|
57
|
-
definition.alternatives.each do |alternative|
|
58
|
-
b += IDENT + self.alternative(alternative) + "\n"
|
59
|
-
end
|
60
|
-
b
|
56
|
+
.reject(&:blank?).join(OPTION_DESCRIPTION_SEPARATOR)
|
61
57
|
end
|
62
58
|
|
59
|
+
# @return [String]
|
63
60
|
def options_section
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
list_section(
|
62
|
+
'Options',
|
63
|
+
definition.alternatives.flat_map(&:options).map { |option| option_definition(option) }
|
64
|
+
)
|
67
65
|
end
|
68
66
|
|
67
|
+
# @return [String]
|
69
68
|
def usage_section
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
list_section(
|
70
|
+
'Usage',
|
71
|
+
definition.alternatives.map { |alternative| self.alternative(alternative) }
|
72
|
+
)
|
74
73
|
end
|
75
74
|
|
76
75
|
def to_s
|
77
|
-
|
76
|
+
join_sections(definition.description, usage_section, options_section, *extra_sections)
|
78
77
|
end
|
79
78
|
end
|
80
79
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module Help
|
8
|
+
module Layout
|
9
|
+
common_concern do
|
10
|
+
include InstanceClassMethods
|
11
|
+
extend InstanceClassMethods
|
12
|
+
end
|
13
|
+
|
14
|
+
module InstanceClassMethods
|
15
|
+
WORD_SEPARATOR = ' '
|
16
|
+
IDENTATION = WORD_SEPARATOR * 2
|
17
|
+
OPTION_DESCRIPTION_SEPARATOR = IDENTATION * 2
|
18
|
+
LINE_BREAK = "\n"
|
19
|
+
SECTION_SEPARATOR = LINE_BREAK * 2
|
20
|
+
|
21
|
+
# @param title String
|
22
|
+
# @param items [Enumerable<String>]
|
23
|
+
# @return [String]
|
24
|
+
def list_section(title, items)
|
25
|
+
(["#{title}:"] + items.map { |line| "#{IDENTATION}#{line}" })
|
26
|
+
.map { |line| "#{line}\n" }.join
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param sections [Enumerable<String>]
|
30
|
+
# @return [String]
|
31
|
+
def join_sections(*sections)
|
32
|
+
sections.map { |s| s.to_s.strip }.join(SECTION_SEPARATOR) + LINE_BREAK
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
extend InstanceClassMethods
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
|
|
6
6
|
module EacCli
|
7
7
|
module RunnerWith
|
8
8
|
module Help
|
9
|
-
require_sub __FILE__,
|
9
|
+
require_sub __FILE__, require_mode: :kernel
|
10
10
|
common_concern do
|
11
11
|
include ::EacCli::Runner
|
12
12
|
|
@@ -20,6 +20,18 @@ module EacCli
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
# @param items [Enumerable<String>]
|
24
|
+
# @return [String]
|
25
|
+
def help_list_section(title, items)
|
26
|
+
::EacCli::RunnerWith::Help::Layout.list_section(title, items)
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param items [Enumerable<String>]
|
30
|
+
# @return [String]
|
31
|
+
def help_join_sections(*sections)
|
32
|
+
::EacCli::RunnerWith::Help::Layout.join_sections(*sections)
|
33
|
+
end
|
34
|
+
|
23
35
|
def help_run
|
24
36
|
return unless show_help?
|
25
37
|
|
@@ -27,10 +39,9 @@ module EacCli
|
|
27
39
|
raise ::EacCli::Runner::Exit
|
28
40
|
end
|
29
41
|
|
42
|
+
# @return [String]
|
30
43
|
def help_text
|
31
|
-
|
32
|
-
r += help_extra_text if respond_to?(:help_extra_text)
|
33
|
-
r
|
44
|
+
::EacCli::RunnerWith::Help::Builder.new(self).to_s
|
34
45
|
end
|
35
46
|
|
36
47
|
def show_help?
|
@@ -51,9 +51,9 @@ module EacCli
|
|
51
51
|
available_subcommands.keys.sort.join(', ')
|
52
52
|
end
|
53
53
|
|
54
|
+
# @return [Hash<String, Enumerable<String>]
|
54
55
|
def help_extra_text
|
55
|
-
(
|
56
|
-
.map { |v| "#{v}\n" }.join
|
56
|
+
help_list_section('Subcommands', available_subcommands.keys.sort)
|
57
57
|
end
|
58
58
|
|
59
59
|
def method_missing(method_name, *arguments, &block)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/help/layout'
|
4
|
+
|
5
|
+
::RSpec.describe ::EacCli::RunnerWith::Help::Layout do
|
6
|
+
describe '#list_section' do
|
7
|
+
{
|
8
|
+
['Options', ['Option A', 'Option B']] => <<~TEXT
|
9
|
+
Options:
|
10
|
+
Option A
|
11
|
+
Option B
|
12
|
+
TEXT
|
13
|
+
}.each do |source, expected|
|
14
|
+
context "when source is #{source}" do
|
15
|
+
it do
|
16
|
+
expect(described_class.list_section(*source)).to eq(expected)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = Dir['{lib}/**/*', 'MIT-LICENSE', 'README.rdoc']
|
17
17
|
|
18
18
|
s.add_dependency 'activesupport', '>= 4', '< 7'
|
19
|
-
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.
|
19
|
+
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.4'
|
20
20
|
s.add_dependency 'bundler'
|
21
21
|
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'net-ssh', '~> 4.2'
|
@@ -8,10 +8,10 @@ module EacRubyUtils
|
|
8
8
|
#
|
9
9
|
# Usage:
|
10
10
|
#
|
11
|
-
# require 'eac_ruby_utils/
|
11
|
+
# require 'eac_ruby_utils/acts_as_abstract'
|
12
12
|
#
|
13
13
|
# class BaseClass
|
14
|
-
# include EacRubyUtils::
|
14
|
+
# include EacRubyUtils::ActsAsAbstract
|
15
15
|
#
|
16
16
|
# abstract_methods :mymethod
|
17
17
|
# end
|
@@ -25,12 +25,12 @@ module EacRubyUtils
|
|
25
25
|
# end
|
26
26
|
#
|
27
27
|
# SubClass.new.mymethod # return "Implemented"
|
28
|
-
module
|
28
|
+
module ActsAsAbstract
|
29
29
|
common_concern
|
30
30
|
|
31
31
|
class << self
|
32
32
|
def abstract?(a_class)
|
33
|
-
a_class.self_included_modules.include?(::EacRubyUtils::
|
33
|
+
a_class.self_included_modules.include?(::EacRubyUtils::ActsAsAbstract)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
4
4
|
|
5
5
|
class Class
|
6
6
|
def abstract?
|
7
|
-
::EacRubyUtils::
|
7
|
+
::EacRubyUtils::ActsAsAbstract.abstract?(self)
|
8
8
|
end
|
9
9
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/patches/module/acts_as_abstract'
|
4
4
|
|
5
5
|
class Module
|
6
|
+
# @deprecated Use {#acts_as_abstract} instead.
|
6
7
|
def enable_abstract_methods(*methods)
|
7
|
-
|
8
|
-
abstract_methods(*methods)
|
8
|
+
acts_as_abstract(*methods)
|
9
9
|
end
|
10
10
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
4
|
+
|
5
|
+
class Module
|
6
|
+
# Include [EacRubyUtils::ActsAsAbstract] and perform EacRubyUtils::ActsAsAbstract.abstract_methods
|
7
|
+
# on parameter +methods+.
|
8
|
+
# @param methods [Array<Symbol>]
|
9
|
+
# @return [void]
|
10
|
+
def acts_as_abstract(*methods)
|
11
|
+
include ::EacRubyUtils::ActsAsAbstract
|
12
|
+
abstract_methods(*methods)
|
13
|
+
end
|
14
|
+
end
|
@@ -3,7 +3,11 @@
|
|
3
3
|
require 'pathname'
|
4
4
|
|
5
5
|
class Pathname
|
6
|
+
# @param suffix [String]
|
7
|
+
# @return [Pathname]
|
6
8
|
def basename_sub(suffix = '')
|
7
|
-
|
9
|
+
new_basename = basename(suffix)
|
10
|
+
new_basename = yield(new_basename) if block_given?
|
11
|
+
parent.join(new_basename)
|
8
12
|
end
|
9
13
|
end
|
@@ -15,13 +15,17 @@ module EacRubyUtils
|
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
include ::EacRubyUtils::Listable
|
18
|
-
lists.add_symbol :option, :base, :include_modules, :require_dependency
|
18
|
+
lists.add_symbol :option, :base, :include_modules, :require_dependency, :require_mode
|
19
|
+
lists.add_symbol :require_mode, :active_support, :autoload, :kernel
|
19
20
|
|
20
21
|
attr_reader :file, :options
|
21
22
|
|
22
23
|
def initialize(file, options = {})
|
23
24
|
@file = file
|
24
25
|
@options = self.class.lists.option.hash_keys_validate!(options)
|
26
|
+
return unless options[OPTION_REQUIRE_MODE]
|
27
|
+
|
28
|
+
self.class.lists.require_mode.value_validate!(options[OPTION_REQUIRE_MODE])
|
25
29
|
end
|
26
30
|
|
27
31
|
# @return [Boolean]
|
@@ -54,6 +58,15 @@ module EacRubyUtils
|
|
54
58
|
" \"#{options[OPTION_INCLUDE_MODULES]}\""
|
55
59
|
end
|
56
60
|
|
61
|
+
# @return [Symbol]
|
62
|
+
def require_mode
|
63
|
+
return options[OPTION_REQUIRE_MODE] if options[OPTION_REQUIRE_MODE]
|
64
|
+
return REQUIRE_MODE_ACTIVE_SUPPORT if active_support_require?
|
65
|
+
return REQUIRE_MODE_AUTOLOAD if base?
|
66
|
+
|
67
|
+
REQUIRE_MODE_KERNEL
|
68
|
+
end
|
69
|
+
|
57
70
|
def require_sub_files
|
58
71
|
sub_files.each(&:require_file)
|
59
72
|
end
|
@@ -38,26 +38,17 @@ module EacRubyUtils
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def require_file
|
41
|
-
|
41
|
+
send("#{owner.require_mode}_require")
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def active_support_require
|
47
|
-
return false unless owner.active_support_require?
|
48
|
-
|
49
47
|
::Kernel.require_dependency(path)
|
50
|
-
true
|
51
48
|
end
|
52
49
|
|
53
50
|
def autoload_require
|
54
|
-
|
55
|
-
|
56
|
-
basename = ::File.basename(path, '.*')
|
57
|
-
return false if basename.start_with?('_')
|
58
|
-
|
59
|
-
owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
|
60
|
-
true
|
51
|
+
owner.base.autoload ::ActiveSupport::Inflector.camelize(::File.basename(path, '.*')), path
|
61
52
|
end
|
62
53
|
|
63
54
|
def kernel_require
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
4
4
|
|
5
5
|
module EacRubyUtils
|
6
6
|
module Speaker
|
7
7
|
module Receiver
|
8
8
|
extend ::ActiveSupport::Concern
|
9
|
-
extend ::EacRubyUtils::
|
9
|
+
extend ::EacRubyUtils::ActsAsAbstract
|
10
10
|
|
11
11
|
module ClassMethods
|
12
12
|
def on(*args, &block)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
4
4
|
|
5
|
-
RSpec.describe(::EacRubyUtils::
|
5
|
+
RSpec.describe(::EacRubyUtils::ActsAsAbstract) do
|
6
6
|
let(:base_class) do
|
7
7
|
the_module = described_class
|
8
8
|
::Class.new do
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
4
|
+
require 'eac_ruby_utils/patches/module/acts_as_abstract'
|
5
|
+
|
6
|
+
::RSpec.describe ::Class do
|
7
|
+
let(:stub_class) do
|
8
|
+
described_class.new { acts_as_abstract }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#acts_as_abstract' do
|
12
|
+
it { expect(stub_class.included_modules).to include(::EacRubyUtils::ActsAsAbstract) }
|
13
|
+
end
|
14
|
+
end
|