avm-tools 0.117.1 → 0.118.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/tools/runner/app_src/info.rb +0 -8
- data/lib/avm/tools/runner/app_src/subs.rb +71 -0
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
- data/lib/avm/tools/version.rb +1 -1
- data/sub/avm/lib/avm/sources/base/configuration.rb +13 -6
- data/sub/avm/lib/avm/sources/base/subs.rb +55 -0
- data/sub/avm/lib/avm/sources/base/subs_paths.rb +32 -0
- data/sub/avm/lib/avm/sources/base.rb +0 -5
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +1 -1
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb +27 -0
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +1 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb +27 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +4 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +27 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/definition.rb +0 -4
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +12 -5
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +15 -6
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +4 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +4 -1
- data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +1 -1
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- metadata +12 -7
- data/sub/eac_cli/lib/eac_cli/definition/help_formatter.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934d4ed06e787c60b6d3bb79b2962290ab933e7dc4b75a0f2a7b767e346d8ed6
|
4
|
+
data.tar.gz: ed4f80fe5ec3bac6ae64e6efc6c8bf95f47e228ecc6445f79f9ab9807239278e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9fe3ccc4c3b9c5527405cf534c1ac481bacf9be50cadca02511a6a58311fde0132e1905ac466eb0a0d3b9529f36f2174b7100e4581a4842c4870f93952f2065
|
7
|
+
data.tar.gz: 7f6e8a7c43bedeeb8bf8c28d3fbd0d6467c5ec41ab7914b46d978a6adba1babfbbe8c7809d86744165ac2edffa6bc58a2475ab57d84106360a76696793718e70
|
@@ -14,7 +14,6 @@ module Avm
|
|
14
14
|
def run
|
15
15
|
show_instance
|
16
16
|
show_source
|
17
|
-
show_subs
|
18
17
|
end
|
19
18
|
|
20
19
|
private
|
@@ -29,13 +28,6 @@ module Avm
|
|
29
28
|
infov 'SCM', runner_context.call(:subject).scm
|
30
29
|
end
|
31
30
|
|
32
|
-
def show_subs
|
33
|
-
infov 'Sub applications', instance.avm_instance.subs.count
|
34
|
-
instance.avm_instance.subs.each do |subapp|
|
35
|
-
infov ' * ', "#{subapp.relative_path} [#{subapp.class}]"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
31
|
def instance
|
40
32
|
runner_context.call(:instance)
|
41
33
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class AppSrc
|
9
|
+
class Subs
|
10
|
+
PADDING = ' '
|
11
|
+
|
12
|
+
runner_with :help, :output do
|
13
|
+
desc 'Output source\'s subs.'
|
14
|
+
bool_opt '-i', '--info'
|
15
|
+
bool_opt '-R', '--recursive'
|
16
|
+
bool_opt '-t', '--tree'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
start_banner
|
21
|
+
run_output
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_banner
|
25
|
+
infov 'Include PATH', runner_context.call(:subject).subs_include_path
|
26
|
+
infov 'Exclude PATH', runner_context.call(:subject).subs_exclude_path
|
27
|
+
infov 'Count', runner_context.call(:subject).subs.count
|
28
|
+
end
|
29
|
+
|
30
|
+
def output_content
|
31
|
+
b = []
|
32
|
+
runner_context.call(:subject).subs.each do |sub|
|
33
|
+
b += sub_output_content_lines(sub, 0)
|
34
|
+
end
|
35
|
+
b.map { |line| "#{line}\n" }.join
|
36
|
+
end
|
37
|
+
|
38
|
+
def sub_info_label(sub)
|
39
|
+
return '' unless parsed.info?
|
40
|
+
|
41
|
+
' [' + {
|
42
|
+
'CLASS' => sub.class.name
|
43
|
+
}.map { |k, v| "#{k}: #{v}" }.join(', ') + ']'
|
44
|
+
end
|
45
|
+
|
46
|
+
def sub_label(sub, level)
|
47
|
+
sub_self_label(sub, level) + sub_info_label(sub)
|
48
|
+
end
|
49
|
+
|
50
|
+
def sub_self_label(sub, level)
|
51
|
+
if parsed.tree?
|
52
|
+
(PADDING * level) + sub.relative_path.to_s
|
53
|
+
else
|
54
|
+
sub.path.relative_path_from(runner_context.call(:subject).path).to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def sub_output_content_lines(sub, level)
|
59
|
+
[sub_label(sub, level)] + sub_subs_output_content_lines(sub, level)
|
60
|
+
end
|
61
|
+
|
62
|
+
def sub_subs_output_content_lines(sub, level)
|
63
|
+
return [] unless parsed.recursive?
|
64
|
+
|
65
|
+
sub.subs.flat_map { |sub_sub| sub_output_content_lines(sub_sub, level + 1) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_config/yaml_file_node'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
require 'eac_ruby_utils/yaml'
|
5
6
|
require 'shellwords'
|
@@ -10,21 +11,27 @@ module Avm
|
|
10
11
|
module Configuration
|
11
12
|
# @return [Array<String>, nil]
|
12
13
|
def read_configuration_as_shell_words(key)
|
13
|
-
configuration
|
14
|
+
configuration.entry(key).value.if_present do |v|
|
14
15
|
v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
# @return [
|
21
|
+
# @return [EacConfig::YamlFileNode]
|
21
22
|
def configuration_uncached
|
22
23
|
::Avm::Sources::Configuration::FILENAMES.each do |filename|
|
23
|
-
|
24
|
-
return ::EacRubyUtils::Yaml.load_file(file_path).with_indifferent_access if
|
25
|
-
file_path.exist?
|
24
|
+
configuration_with_filename(filename, true)
|
26
25
|
end
|
27
|
-
|
26
|
+
configuration_with_filename(::Avm::Sources::Configuration::FILENAMES.first, false)
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [EacConfig::YamlFileNode, nil]
|
30
|
+
def configuration_with_filename(filename, needs_exist)
|
31
|
+
file_path = path.join(filename)
|
32
|
+
return ::EacConfig::YamlFileNode.new(file_path) if !needs_exist || file_path.exist?
|
33
|
+
|
34
|
+
nil
|
28
35
|
end
|
29
36
|
|
30
37
|
# @return [Avm::Sources::Configuration]
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/base/subs_paths'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Sources
|
8
|
+
class Base
|
9
|
+
module Subs
|
10
|
+
CONFIGURATION_SUBS_EXCLUDE_PATHS_KEY = 'subs.exclude_path'
|
11
|
+
CONFIGURATION_SUBS_INCLUDE_PATHS_KEY = 'subs.include_path'
|
12
|
+
SUBS_EXCLUDE_PATHS_DEFAULT = [].freeze
|
13
|
+
SUBS_INCLUDE_PATHS_DEFAULT = ['sub/*'].freeze
|
14
|
+
|
15
|
+
# @return [Enumerable<Avm::Sources::Base>]
|
16
|
+
def subs
|
17
|
+
subs_paths_to_search
|
18
|
+
.map { |sub_path| ::Avm::Registry.sources.detect_optional(sub_path, parent: self) }
|
19
|
+
.reject(&:blank?)
|
20
|
+
.sort_by { |sub| [sub.path] }
|
21
|
+
end
|
22
|
+
|
23
|
+
def subs_paths_to_search
|
24
|
+
subs_include_paths.flat_map do |subs_include_path|
|
25
|
+
::Pathname.glob(path.join(subs_include_path)).reject do |sub_path|
|
26
|
+
subs_exclude_paths.any? do |subs_exclude_path|
|
27
|
+
sub_path.fnmatch?(path.join(subs_exclude_path).to_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
%i[include exclude].each do |type|
|
34
|
+
%i[path paths configured_paths default_paths].each do |method_suffix|
|
35
|
+
obj_method_name = "subs_#{type}_path_obj"
|
36
|
+
|
37
|
+
define_method "subs_#{type}_#{method_suffix}" do
|
38
|
+
send(obj_method_name).send(method_suffix)
|
39
|
+
end
|
40
|
+
|
41
|
+
define_method "#{obj_method_name}_uncached" do
|
42
|
+
::Avm::Sources::Base::SubsPaths.new(
|
43
|
+
self,
|
44
|
+
self.class.const_get("CONFIGURATION_SUBS_#{type}_PATHS_KEY".upcase),
|
45
|
+
self.class.const_get("SUBS_#{type}_PATHS_DEFAULT".upcase)
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
private "#{obj_method_name}_uncached" # rubocop:disable Style/AccessModifierDeclarations
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Base
|
8
|
+
class SubsPaths
|
9
|
+
SUBS_PATH_SEPARATOR = ':'
|
10
|
+
|
11
|
+
common_constructor :source, :configuration_key, :default_paths
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def path
|
15
|
+
paths.join(SUBS_PATH_SEPARATOR)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Array<String>]
|
19
|
+
def paths
|
20
|
+
configured_paths || default_paths
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Array<String>]
|
24
|
+
def configured_paths
|
25
|
+
source.configuration.entry(configuration_key).value.if_present do |v|
|
26
|
+
v.split(SUBS_PATH_SEPARATOR)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm-eac_rails_base1', '~> 0.
|
15
|
+
s.add_dependency 'avm-eac_rails_base1', '~> 0.3'
|
16
16
|
s.add_dependency 'eac_ruby_utils', '~> 0.80', '>= 0.80.2'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_rails_base1/sources/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRailsBase0
|
8
|
+
module Sources
|
9
|
+
class Base < ::Avm::EacRailsBase1::Sources::Base
|
10
|
+
CONFIG_RU_SUBPATH = 'config.ru'
|
11
|
+
SUBS_PATHS_DEFAULT = ['sub/*/*'].freeze
|
12
|
+
|
13
|
+
def config_ru_path
|
14
|
+
path.join(CONFIG_RU_SUBPATH)
|
15
|
+
end
|
16
|
+
|
17
|
+
def subs_paths_default
|
18
|
+
SUBS_PATHS_DEFAULT
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
super && config_ru_path.exist?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.6'
|
15
16
|
s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
|
16
17
|
s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.9'
|
17
18
|
s.add_dependency 'eac_ruby_utils', '~> 0.68'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ruby_base1/sources/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRailsBase1
|
8
|
+
module Sources
|
9
|
+
class Base < ::Avm::EacRubyBase1::Sources::Base
|
10
|
+
CONFIG_RU_SUBPATH = 'config.ru'
|
11
|
+
SUBS_PATHS_DEFAULT = ['sub/*/*'].freeze
|
12
|
+
|
13
|
+
def config_ru_path
|
14
|
+
path.join(CONFIG_RU_SUBPATH)
|
15
|
+
end
|
16
|
+
|
17
|
+
def subs_paths_default
|
18
|
+
SUBS_PATHS_DEFAULT
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
super && config_ru_path.exist?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm-eac_rails_base1', '~> 0.
|
15
|
+
s.add_dependency 'avm-eac_rails_base1', '~> 0.3'
|
16
16
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.2'
|
17
17
|
s.add_dependency 'curb', '~> 0.9.10'
|
18
18
|
s.add_dependency 'eac_fs', '~> 0.4'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_rails_base1/sources/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRedmineBase0
|
8
|
+
module Sources
|
9
|
+
class Base < ::Avm::EacRailsBase1::Sources::Base
|
10
|
+
REDMINE_LIB_SUBPATH = 'lib/redmine.rb'
|
11
|
+
SUBS_PATHS_DEFAULT = ['plugins/*'].freeze
|
12
|
+
|
13
|
+
def redmine_lib_path
|
14
|
+
path.join(REDMINE_LIB_SUBPATH)
|
15
|
+
end
|
16
|
+
|
17
|
+
def subs_paths_default
|
18
|
+
SUBS_PATHS_DEFAULT
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
super && redmine_lib_path.exist?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -39,10 +39,6 @@ module EacCli
|
|
39
39
|
self.description = description
|
40
40
|
end
|
41
41
|
|
42
|
-
def help_formatter
|
43
|
-
@help_formatter ||= ::EacCli::Definition::HelpFormatter.new(self)
|
44
|
-
end
|
45
|
-
|
46
42
|
def main_alternative
|
47
43
|
@main_alternative ||= begin
|
48
44
|
r = ::EacCli::Definition::Alternative.new
|
@@ -7,18 +7,19 @@ module EacCli
|
|
7
7
|
module Help
|
8
8
|
class Builder
|
9
9
|
class Alternative
|
10
|
-
|
10
|
+
enable_method_class
|
11
|
+
|
11
12
|
SUBCOMMANDS_MACRO = '__SUBCOMMANDS__'
|
12
13
|
|
13
|
-
common_constructor :alternative
|
14
|
+
common_constructor :builder, :alternative
|
14
15
|
|
15
|
-
def
|
16
|
+
def result
|
16
17
|
(
|
17
|
-
|
18
|
+
program_name +
|
18
19
|
alternative.options_argument?.if_present([]) { |_v| ['[options]'] } +
|
19
20
|
options +
|
20
21
|
positionals
|
21
|
-
).join(
|
22
|
+
).join(builder.word_separator)
|
22
23
|
end
|
23
24
|
|
24
25
|
def options
|
@@ -49,6 +50,12 @@ module EacCli
|
|
49
50
|
r
|
50
51
|
end
|
51
52
|
end
|
53
|
+
|
54
|
+
def program_name
|
55
|
+
r = builder.runner.program_name
|
56
|
+
r = [r] unless r.is_a?(::Enumerable)
|
57
|
+
r
|
58
|
+
end
|
52
59
|
end
|
53
60
|
end
|
54
61
|
end
|
@@ -6,8 +6,8 @@ module EacCli
|
|
6
6
|
module RunnerWith
|
7
7
|
module Help
|
8
8
|
class Builder
|
9
|
-
require_sub __FILE__
|
10
|
-
common_constructor :
|
9
|
+
require_sub __FILE__, require_dependency: true
|
10
|
+
common_constructor :runner
|
11
11
|
|
12
12
|
SEP = ' '
|
13
13
|
IDENT = SEP * 2
|
@@ -28,11 +28,21 @@ module EacCli
|
|
28
28
|
|
29
29
|
def option_usage_full(option)
|
30
30
|
if option.long.present?
|
31
|
-
[option.short, option_long(option)].reject(&:blank?).join(
|
31
|
+
[option.short, option_long(option)].reject(&:blank?).join(word_separator)
|
32
32
|
else
|
33
33
|
option_short(option)
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def word_separator
|
38
|
+
SEP
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
delegate :word_separator, to: :class
|
43
|
+
|
44
|
+
def definition
|
45
|
+
runner.class.runner_definition
|
36
46
|
end
|
37
47
|
|
38
48
|
def option_definition(option)
|
@@ -45,8 +55,7 @@ module EacCli
|
|
45
55
|
b = include_header ? "#{header.humanize}:\n" : ''
|
46
56
|
b += send("self_#{header}") + "\n"
|
47
57
|
definition.alternatives.each do |alternative|
|
48
|
-
b += IDENT +
|
49
|
-
"\n"
|
58
|
+
b += IDENT + self.alternative(alternative) + "\n"
|
50
59
|
end
|
51
60
|
b
|
52
61
|
end
|
@@ -60,7 +69,7 @@ module EacCli
|
|
60
69
|
def usage_section
|
61
70
|
"Usage:\n" +
|
62
71
|
definition.alternatives.map do |alternative|
|
63
|
-
IDENT +
|
72
|
+
IDENT + self.alternative(alternative) + "\n"
|
64
73
|
end.join
|
65
74
|
end
|
66
75
|
|
@@ -26,7 +26,7 @@ RSpec.describe ::EacCli::RunnerWith::Help do
|
|
26
26
|
].each do |runner_argv|
|
27
27
|
context "when runner ARGV is #{runner_argv}" do
|
28
28
|
let(:instance) { runner.create(argv: runner_argv) }
|
29
|
-
let(:
|
29
|
+
let(:expected_output_source) do
|
30
30
|
<<~OUTPUT
|
31
31
|
A stub runner.
|
32
32
|
|
@@ -39,6 +39,9 @@ RSpec.describe ::EacCli::RunnerWith::Help do
|
|
39
39
|
|
40
40
|
OUTPUT
|
41
41
|
end
|
42
|
+
let(:expected_output) do
|
43
|
+
expected_output_source.gsub('__PROGRAM__', instance.program_name)
|
44
|
+
end
|
42
45
|
|
43
46
|
it 'show help text' do
|
44
47
|
expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
|
@@ -57,7 +57,7 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
57
57
|
|
58
58
|
context 'with help' do
|
59
59
|
let(:instance) { parent_runner.create(%w[--help]) }
|
60
|
-
let(:
|
60
|
+
let(:expected_output_source) do
|
61
61
|
<<~OUTPUT
|
62
62
|
A stub root runner.
|
63
63
|
|
@@ -73,6 +73,9 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
73
73
|
child-cmd
|
74
74
|
OUTPUT
|
75
75
|
end
|
76
|
+
let(:expected_output) do
|
77
|
+
expected_output_source.gsub('__PROGRAM__', instance.program_name)
|
78
|
+
end
|
76
79
|
|
77
80
|
before do
|
78
81
|
parent_runner.include(::EacCli::RunnerWith::Help)
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_cli', '~> 0.27', '>= 0.27.
|
15
|
+
s.add_dependency 'eac_cli', '~> 0.27', '>= 0.27.5'
|
16
16
|
s.add_dependency 'eac_fs', '~> 0.10'
|
17
17
|
s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '~> 0.9.6'
|
18
18
|
s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.118.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
version: '0.5'
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.5.
|
84
|
+
version: 0.5.2
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
version: '0.5'
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.5.
|
94
|
+
version: 0.5.2
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: avm-eac_ruby_base1
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
version: '0.16'
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 0.16.
|
200
|
+
version: 0.16.4
|
201
201
|
type: :runtime
|
202
202
|
prerelease: false
|
203
203
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -207,7 +207,7 @@ dependencies:
|
|
207
207
|
version: '0.16'
|
208
208
|
- - ">="
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0.16.
|
210
|
+
version: 0.16.4
|
211
211
|
- !ruby/object:Gem::Dependency
|
212
212
|
name: eac_ruby_gems_utils
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|
@@ -398,6 +398,7 @@ files:
|
|
398
398
|
- lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock.rb
|
399
399
|
- lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb
|
400
400
|
- lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb
|
401
|
+
- lib/avm/tools/runner/app_src/subs.rb
|
401
402
|
- lib/avm/tools/runner/app_src/test.rb
|
402
403
|
- lib/avm/tools/runner/app_src/update.rb
|
403
404
|
- lib/avm/tools/runner/app_src/version_bump.rb
|
@@ -490,6 +491,7 @@ files:
|
|
490
491
|
- sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instance.rb
|
491
492
|
- sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners.rb
|
492
493
|
- sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb
|
494
|
+
- sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb
|
493
495
|
- sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb
|
494
496
|
- sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb
|
495
497
|
- sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec_files/apache_host_spec_no_ssl_content.conf
|
@@ -516,6 +518,7 @@ files:
|
|
516
518
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb
|
517
519
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb
|
518
520
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb
|
521
|
+
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb
|
519
522
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb
|
520
523
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb
|
521
524
|
- sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb
|
@@ -534,6 +537,7 @@ files:
|
|
534
537
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
|
535
538
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb
|
536
539
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/rest_api.rb
|
540
|
+
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb
|
537
541
|
- sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb
|
538
542
|
- sub/avm-eac_redmine_base0/spec/rubocop_spec.rb
|
539
543
|
- sub/avm-eac_redmine_base0/spec/spec_helper.rb
|
@@ -773,6 +777,8 @@ files:
|
|
773
777
|
- sub/avm/lib/avm/sources/base/configuration.rb
|
774
778
|
- sub/avm/lib/avm/sources/base/instance.rb
|
775
779
|
- sub/avm/lib/avm/sources/base/parent.rb
|
780
|
+
- sub/avm/lib/avm/sources/base/subs.rb
|
781
|
+
- sub/avm/lib/avm/sources/base/subs_paths.rb
|
776
782
|
- sub/avm/lib/avm/sources/base/testing.rb
|
777
783
|
- sub/avm/lib/avm/sources/configuration.rb
|
778
784
|
- sub/avm/lib/avm/sources/configuration/locale.rb
|
@@ -806,7 +812,6 @@ files:
|
|
806
812
|
- sub/eac_cli/lib/eac_cli/definition/base_option.rb
|
807
813
|
- sub/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb
|
808
814
|
- sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
|
809
|
-
- sub/eac_cli/lib/eac_cli/definition/help_formatter.rb
|
810
815
|
- sub/eac_cli/lib/eac_cli/definition/positional_argument.rb
|
811
816
|
- sub/eac_cli/lib/eac_cli/enum.rb
|
812
817
|
- sub/eac_cli/lib/eac_cli/old_configs.rb
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/runner_with/help/builder/alternative'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module EacCli
|
7
|
-
class Definition
|
8
|
-
class HelpFormatter
|
9
|
-
SEP = ' '
|
10
|
-
IDENT = SEP * 2
|
11
|
-
OPTION_DESC_SEP = IDENT * 2
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def option_long(option)
|
15
|
-
b = option.long
|
16
|
-
b += '=VALUE' if option.argument?
|
17
|
-
b
|
18
|
-
end
|
19
|
-
|
20
|
-
def option_short(option)
|
21
|
-
b = option.short
|
22
|
-
b += 'VALUE' if option.argument?
|
23
|
-
b
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
common_constructor :definition
|
28
|
-
|
29
|
-
def positional_argument(positional)
|
30
|
-
if positional.subcommand?
|
31
|
-
::EacCli::RunnerWith::Help::Builder::Alternative::SUBCOMMANDS_MACRO
|
32
|
-
else
|
33
|
-
r = "<#{positional.name}>"
|
34
|
-
r += '...' if positional.repeat?
|
35
|
-
r = "[#{r}]" if positional.optional?
|
36
|
-
r
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def section(header, include_header = true)
|
41
|
-
b = include_header ? "#{header.humanize}:\n" : ''
|
42
|
-
b += send("self_#{header}") + "\n"
|
43
|
-
# TO-DO: implement alternatives
|
44
|
-
b
|
45
|
-
end
|
46
|
-
|
47
|
-
def self_options
|
48
|
-
definition.options.map { |option| IDENT + option_definition(option) }.join("\n")
|
49
|
-
end
|
50
|
-
|
51
|
-
def self_usage
|
52
|
-
IDENT + self_usage_arguments.join(SEP)
|
53
|
-
end
|
54
|
-
|
55
|
-
def self_usage_arguments
|
56
|
-
[::EacCli::RunnerWith::Help::Builder::Alternative::PROGRAM_MACRO] +
|
57
|
-
definition.options_argument.if_present([]) { |_v| ['[options]'] } +
|
58
|
-
self_usage_arguments_options +
|
59
|
-
self_usage_arguments_positional
|
60
|
-
end
|
61
|
-
|
62
|
-
def self_usage_arguments_options
|
63
|
-
definition.options.select(&:show_on_usage?).map do |option|
|
64
|
-
self.class.option_long(option)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def self_usage_arguments_positional
|
69
|
-
definition.positional.map { |p| positional_argument(p) }
|
70
|
-
end
|
71
|
-
|
72
|
-
def to_banner
|
73
|
-
"#{definition.description}\n\n#{section('usage')}"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|