avm-tools 0.76.1 → 0.77.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/avm/tools/version.rb +1 -1
- data/template/avm/eac_redmine_base0/deploy/config/install.sh.template +12 -0
- data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +21 -3
- data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +88 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +2 -2
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
- data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +14 -5
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +32 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +1 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +59 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -69
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +7 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +3 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
- metadata +16 -5
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'optparse'
|
5
|
-
|
6
|
-
module EacCli
|
7
|
-
class Parser
|
8
|
-
class OptionsCollection
|
9
|
-
enable_simple_cache
|
10
|
-
common_constructor(:definition, :argv, :collector) { collect }
|
11
|
-
attr_reader :arguments
|
12
|
-
|
13
|
-
def options_first?
|
14
|
-
definition.options_first? || definition.subcommands?
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def check_required_options
|
20
|
-
definition.options.each do |option|
|
21
|
-
next unless option.required?
|
22
|
-
next if collector.supplied?(option)
|
23
|
-
|
24
|
-
raise ::EacCli::Parser::Error.new(
|
25
|
-
definition, argv, "Option \"#{option}\" is required and a value was not supplied"
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def collect
|
31
|
-
build_banner
|
32
|
-
build_options
|
33
|
-
parse_argv
|
34
|
-
check_required_options
|
35
|
-
end
|
36
|
-
|
37
|
-
def option_parser_uncached
|
38
|
-
::OptionParser.new
|
39
|
-
end
|
40
|
-
|
41
|
-
def parse_argv
|
42
|
-
@arguments = options_first? ? option_parser.order(argv) : option_parser.parse(argv)
|
43
|
-
rescue ::OptionParser::InvalidOption => e
|
44
|
-
raise ::EacCli::Parser::Error.new(definition, argv, e.message)
|
45
|
-
end
|
46
|
-
|
47
|
-
def build_banner
|
48
|
-
option_parser.banner = definition.help_formatter.to_banner
|
49
|
-
end
|
50
|
-
|
51
|
-
def build_options
|
52
|
-
definition.options.each do |option|
|
53
|
-
build_option(option)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def build_option(option)
|
58
|
-
option_parser.on(
|
59
|
-
*[::EacCli::Definition::HelpFormatter.option_short(option),
|
60
|
-
::EacCli::Definition::HelpFormatter.option_long(option),
|
61
|
-
option.description].reject(&:blank?)
|
62
|
-
) do |value|
|
63
|
-
collector.collect(option, value)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_cli/parser/error'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module EacCli
|
7
|
-
class Parser
|
8
|
-
class ParseResult
|
9
|
-
common_constructor :definition, :argv
|
10
|
-
|
11
|
-
def result
|
12
|
-
result_or_error = parse(definition)
|
13
|
-
return result_or_error unless result_or_error.is_a?(::Exception)
|
14
|
-
|
15
|
-
definition.alternatives.each do |alternative|
|
16
|
-
alt_result_or_error = parse(alternative)
|
17
|
-
return alt_result_or_error unless alt_result_or_error.is_a?(::Exception)
|
18
|
-
end
|
19
|
-
|
20
|
-
raise result_or_error
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def parse(definition)
|
26
|
-
::EacCli::Parser::Collector.to_data(definition) do |collector|
|
27
|
-
::EacCli::Parser::PositionalCollection.new(
|
28
|
-
definition,
|
29
|
-
::EacCli::Parser::OptionsCollection.new(definition, argv, collector).arguments,
|
30
|
-
collector
|
31
|
-
)
|
32
|
-
end
|
33
|
-
rescue ::EacCli::Parser::Error => e
|
34
|
-
e
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_cli/parser/error'
|
5
|
-
|
6
|
-
module EacCli
|
7
|
-
class Parser
|
8
|
-
class PositionalCollection
|
9
|
-
common_constructor(:definition, :argv, :collector) { collect }
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def argv_enum
|
14
|
-
@argv_enum ||= argv.each
|
15
|
-
end
|
16
|
-
|
17
|
-
def argv_pending?
|
18
|
-
argv_enum.ongoing?
|
19
|
-
end
|
20
|
-
|
21
|
-
def argv_pending_check
|
22
|
-
return unless argv_pending?
|
23
|
-
return unless positional_enum.stopped?
|
24
|
-
|
25
|
-
raise ::EacCli::Parser::Error.new(
|
26
|
-
definition, argv, "No positional left for argv \"#{argv_enum.current}\""
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
def collected
|
31
|
-
@collected ||= ::Set.new
|
32
|
-
end
|
33
|
-
|
34
|
-
def collect
|
35
|
-
loop do
|
36
|
-
break unless enums('pending?').any?
|
37
|
-
|
38
|
-
enums('pending_check')
|
39
|
-
collect_argv_value
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def collect_argv_value
|
44
|
-
collector.collect(*enums('enum', &:peek))
|
45
|
-
collected << positional_enum.peek
|
46
|
-
positional_enum.next unless positional_enum.peek.repeat?
|
47
|
-
argv_enum.next
|
48
|
-
end
|
49
|
-
|
50
|
-
def enums(method_suffix, &block)
|
51
|
-
%w[positional argv].map do |method_prefix|
|
52
|
-
v = send("#{method_prefix}_#{method_suffix}")
|
53
|
-
block ? block.call(v) : v
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def positional_enum
|
58
|
-
@positional_enum ||= definition.positional.each
|
59
|
-
end
|
60
|
-
|
61
|
-
def positional_pending?
|
62
|
-
!(positional_enum.stopped? || positional_enum.current.optional? ||
|
63
|
-
collected.include?(positional_enum.current))
|
64
|
-
end
|
65
|
-
|
66
|
-
def positional_pending_check
|
67
|
-
return unless positional_pending?
|
68
|
-
return unless argv_enum.stopped?
|
69
|
-
|
70
|
-
raise ::EacCli::Parser::Error.new(
|
71
|
-
definition, argv, 'No value for required positional ' \
|
72
|
-
"\"#{positional_enum.current.identifier}\""
|
73
|
-
)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|