avm-tools 0.117.0 → 0.117.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +0 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
- data/lib/avm/tools/version.rb +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/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb +56 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb +19 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb +34 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb +11 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/eac_cli/eac_cli.gemspec +1 -1
- data/sub/eac_cli/lib/eac_cli/definition.rb +0 -4
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +9 -22
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +50 -0
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +0 -9
- 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 +2 -2
- 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 +26 -17
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +4 -1
- data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +2 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +17 -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: 4fec1bb05188ea00085f3ca44ed3945e58675f2dddb1593fd857312ce98caa45
|
4
|
+
data.tar.gz: 695a666752439b000d12d60da7ee84c1b34aba488a650409eedeb2708702a8f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb85f443966aa7612f54b69f367a0b72df3d9ba4016cb6b4b4ea8e1f927d34c6d3716bcbdfd1f2638faba539b50d7042043d202469ffb604e35f41ea6b8e5906
|
7
|
+
data.tar.gz: d3629c61d983caee50edfc740da31ff96d031e9632f170ce25be6f73687295baa5c6fe410ffb32260c212290c0716fb0534a1229884be2849bfa3206bc84dac5
|
data/lib/avm/tools/version.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Bundler
|
8
|
+
class Gemfile
|
9
|
+
class AddOrReplaceGemLine
|
10
|
+
enable_method_class
|
11
|
+
common_constructor :sender, :gem_name, :gem_specs
|
12
|
+
delegate :lines, to: :sender
|
13
|
+
|
14
|
+
def existing_gem_line_index
|
15
|
+
lines.index { |line| line.start_with?(gem_line_prefix) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def result
|
19
|
+
if existing_gem_line_index.present?
|
20
|
+
replace_line
|
21
|
+
else
|
22
|
+
add_line
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_line
|
27
|
+
lines.insert(add_line_index, new_gem_line)
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_line_index
|
31
|
+
(gems_lines_start_index..(lines.count - 1)).each do |e|
|
32
|
+
return e if new_gem_line < lines[e]
|
33
|
+
end
|
34
|
+
lines.count
|
35
|
+
end
|
36
|
+
|
37
|
+
def gems_lines_start_index
|
38
|
+
lines.index { |line| line.start_with?('gem ') } || lines.count
|
39
|
+
end
|
40
|
+
|
41
|
+
def new_gem_line
|
42
|
+
([gem_line_prefix] + gem_specs).join(', ')
|
43
|
+
end
|
44
|
+
|
45
|
+
def gem_line_prefix
|
46
|
+
"gem '#{gem_name}'"
|
47
|
+
end
|
48
|
+
|
49
|
+
def replace_line
|
50
|
+
lines[existing_gem_line_index] = new_gem_line
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Bundler
|
8
|
+
class Gemfile
|
9
|
+
class Dependency
|
10
|
+
common_constructor :gemfile, :gem_name
|
11
|
+
|
12
|
+
def version_specs=(version_specs)
|
13
|
+
gemfile.add_or_replace_gem_line(gem_name, version_specs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Bundler
|
8
|
+
class Gemfile
|
9
|
+
require_sub __FILE__, require_dependency: true
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def from_file(path)
|
13
|
+
new(path.read.each_line.map(&:rstrip))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
common_constructor :lines
|
18
|
+
|
19
|
+
# @return [Avm::EacRubyBase1::Bundler::Gemfile::Dependency]
|
20
|
+
def dependency(gem_name)
|
21
|
+
::Avm::EacRubyBase1::Bundler::Gemfile::Dependency.new(self, gem_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def write(path)
|
25
|
+
path.to_pathname.write(to_text)
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_text
|
29
|
+
lines.map { |line| "#{line}\n" }.join
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
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.1'
|
16
16
|
s.add_dependency 'eac_config', '~> 0.8'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.95'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
20
20
|
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
|
@@ -33,7 +33,7 @@ module EacCli
|
|
33
33
|
# @return [EacCli::Definition::BaseOption] The option collected.
|
34
34
|
def short_option_collect_char(char)
|
35
35
|
option = find_short_option(char)
|
36
|
-
|
36
|
+
raise_argv_current_invalid_option unless option
|
37
37
|
|
38
38
|
option_collect_option(option)
|
39
39
|
end
|
@@ -1,23 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_cli/
|
4
|
-
require '
|
3
|
+
require 'eac_cli/definition'
|
4
|
+
require 'eac_cli/runner/class_runner'
|
5
5
|
|
6
6
|
module EacCli
|
7
7
|
module Runner
|
8
8
|
module AfterClassMethods
|
9
|
+
# @return [EacCli::Runner::ClassRunner]
|
10
|
+
def class_runner(runner_context_args)
|
11
|
+
::EacCli::Runner::ClassRunner.new(self, runner_context_args)
|
12
|
+
end
|
13
|
+
|
9
14
|
def create(*runner_context_args)
|
10
|
-
|
11
|
-
r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
|
12
|
-
r
|
15
|
+
class_runner(runner_context_args).create
|
13
16
|
end
|
14
17
|
|
15
18
|
def run(*runner_context_args)
|
16
|
-
|
17
|
-
r = create(*runner_context_args)
|
18
|
-
r.run_run
|
19
|
-
r
|
20
|
-
end
|
19
|
+
class_runner(runner_context_args).run
|
21
20
|
end
|
22
21
|
|
23
22
|
def runner_definition(&block)
|
@@ -29,18 +28,6 @@ module EacCli
|
|
29
28
|
def super_runner_definition
|
30
29
|
superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
|
31
30
|
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def on_asserted_speaker
|
36
|
-
if ::EacRubyUtils::Speaker.context.optional_current
|
37
|
-
yield
|
38
|
-
else
|
39
|
-
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
|
40
|
-
yield
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
31
|
end
|
45
32
|
end
|
46
33
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/speaker'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/speaker'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module Runner
|
9
|
+
class ClassRunner
|
10
|
+
PARSER_ERROR_EXIT_CODE = 1
|
11
|
+
|
12
|
+
common_constructor :klass, :context_args
|
13
|
+
|
14
|
+
def create
|
15
|
+
r = klass.new
|
16
|
+
r.runner_context = ::EacCli::Runner::Context.new(r, *context_args)
|
17
|
+
r
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
on_asserted_speaker do
|
22
|
+
r = create
|
23
|
+
begin
|
24
|
+
r.run_run
|
25
|
+
rescue ::EacCli::Parser::Error => e
|
26
|
+
run_parser_error(r, e)
|
27
|
+
end
|
28
|
+
r
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def run_parser_error(runner_instance, error)
|
33
|
+
$stderr.write("#{runner_instance.program_name}: #{error}\n")
|
34
|
+
::Kernel.exit(PARSER_ERROR_EXIT_CODE)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def on_asserted_speaker
|
40
|
+
if ::EacRubyUtils::Speaker.context.optional_current
|
41
|
+
yield
|
42
|
+
else
|
43
|
+
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
|
44
|
+
yield
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -3,22 +3,13 @@
|
|
3
3
|
module EacCli
|
4
4
|
module Runner
|
5
5
|
module InstanceMethods
|
6
|
-
PARSER_ERROR_EXIT_CODE = 1
|
7
|
-
|
8
6
|
def run_run
|
9
7
|
parsed
|
10
8
|
run_callbacks(:run) { run }
|
11
|
-
rescue ::EacCli::Parser::Error => e
|
12
|
-
run_parser_error(e)
|
13
9
|
rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
|
14
10
|
# Do nothing
|
15
11
|
end
|
16
12
|
|
17
|
-
def run_parser_error(error)
|
18
|
-
$stderr.write("#{program_name}: #{error}\n")
|
19
|
-
::Kernel.exit(PARSER_ERROR_EXIT_CODE)
|
20
|
-
end
|
21
|
-
|
22
13
|
def runner_context
|
23
14
|
return @runner_context if @runner_context
|
24
15
|
|
@@ -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
|
|
@@ -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_dependency: true
|
10
10
|
common_concern do
|
11
11
|
include ::EacCli::Runner
|
12
12
|
|
@@ -28,7 +28,7 @@ module EacCli
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def help_text
|
31
|
-
r = ::EacCli::RunnerWith::Help::Builder.new(self
|
31
|
+
r = ::EacCli::RunnerWith::Help::Builder.new(self).to_s
|
32
32
|
r += help_extra_text if respond_to?(:help_extra_text)
|
33
33
|
r
|
34
34
|
end
|
@@ -20,23 +20,32 @@ RSpec.describe ::EacCli::RunnerWith::Help do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
[
|
24
|
+
['--help'],
|
25
|
+
['trash-pos-arg-before', '--help', 'trash-pos-arg-after']
|
26
|
+
].each do |runner_argv|
|
27
|
+
context "when runner ARGV is #{runner_argv}" do
|
28
|
+
let(:instance) { runner.create(argv: runner_argv) }
|
29
|
+
let(:expected_output_source) do
|
30
|
+
<<~OUTPUT
|
31
|
+
A stub runner.
|
32
|
+
|
33
|
+
Usage:
|
34
|
+
__PROGRAM__ [options] <a_argument>
|
35
|
+
__PROGRAM__ --help
|
36
|
+
|
37
|
+
Options:
|
38
|
+
-h --help Show help.
|
39
|
+
|
40
|
+
OUTPUT
|
41
|
+
end
|
42
|
+
let(:expected_output) do
|
43
|
+
expected_output_source.gsub('__PROGRAM__', instance.program_name)
|
44
|
+
end
|
38
45
|
|
39
|
-
|
40
|
-
|
46
|
+
it 'show help text' do
|
47
|
+
expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
|
48
|
+
end
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
@@ -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,10 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_cli', '~> 0.
|
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
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
|
19
19
|
|
20
20
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
21
21
|
end
|
@@ -68,12 +68,12 @@ module EacRubyUtils
|
|
68
68
|
|
69
69
|
def setup_class_attr_readers(klass)
|
70
70
|
klass.send(:attr_reader, *args)
|
71
|
-
klass.send(:public, *args)
|
71
|
+
klass.send(:public, *args) if args.any?
|
72
72
|
end
|
73
73
|
|
74
74
|
def setup_class_attr_writers(klass)
|
75
75
|
klass.send(:attr_writer, *args)
|
76
|
-
klass.send(:private, *args.map { |a| "#{a}=" })
|
76
|
+
klass.send(:private, *args.map { |a| "#{a}=" }) if args.any?
|
77
77
|
end
|
78
78
|
|
79
79
|
def setup_class_initialize(klass)
|
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.117.
|
4
|
+
version: 0.117.3
|
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-21 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
|
@@ -194,14 +194,20 @@ dependencies:
|
|
194
194
|
requirements:
|
195
195
|
- - "~>"
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
version: '0.
|
197
|
+
version: '0.16'
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 0.16.4
|
198
201
|
type: :runtime
|
199
202
|
prerelease: false
|
200
203
|
version_requirements: !ruby/object:Gem::Requirement
|
201
204
|
requirements:
|
202
205
|
- - "~>"
|
203
206
|
- !ruby/object:Gem::Version
|
204
|
-
version: '0.
|
207
|
+
version: '0.16'
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: 0.16.4
|
205
211
|
- !ruby/object:Gem::Dependency
|
206
212
|
name: eac_ruby_gems_utils
|
207
213
|
requirement: !ruby/object:Gem::Requirement
|
@@ -542,6 +548,10 @@ files:
|
|
542
548
|
- sub/avm-eac_ruby_base1/Gemfile
|
543
549
|
- sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec
|
544
550
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb
|
551
|
+
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb
|
552
|
+
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb
|
553
|
+
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb
|
554
|
+
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb
|
545
555
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop.rb
|
546
556
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb
|
547
557
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb
|
@@ -796,7 +806,6 @@ files:
|
|
796
806
|
- sub/eac_cli/lib/eac_cli/definition/base_option.rb
|
797
807
|
- sub/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb
|
798
808
|
- sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
|
799
|
-
- sub/eac_cli/lib/eac_cli/definition/help_formatter.rb
|
800
809
|
- sub/eac_cli/lib/eac_cli/definition/positional_argument.rb
|
801
810
|
- sub/eac_cli/lib/eac_cli/enum.rb
|
802
811
|
- sub/eac_cli/lib/eac_cli/old_configs.rb
|
@@ -822,6 +831,7 @@ files:
|
|
822
831
|
- sub/eac_cli/lib/eac_cli/rspec/setup.rb
|
823
832
|
- sub/eac_cli/lib/eac_cli/runner.rb
|
824
833
|
- sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb
|
834
|
+
- sub/eac_cli/lib/eac_cli/runner/class_runner.rb
|
825
835
|
- sub/eac_cli/lib/eac_cli/runner/context.rb
|
826
836
|
- sub/eac_cli/lib/eac_cli/runner/exit.rb
|
827
837
|
- sub/eac_cli/lib/eac_cli/runner/instance_methods.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
|