eac_tools 0.82.0 → 0.83.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/Gemfile.lock +45 -40
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +4 -3
- data/sub/avm/lib/avm/data/rotate.rb +1 -1
- data/sub/avm/lib/avm/launcher/instances/base/publishing.rb +1 -1
- data/sub/avm/lib/avm/registry/from_gems.rb +2 -2
- data/sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb +0 -1
- data/sub/avm/lib/avm/source_generators/base.rb +1 -0
- data/sub/avm/lib/avm/source_generators/runner.rb +6 -0
- data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/avm-tools.gemspec +1 -0
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec +1 -0
- data/sub/avm-eac_asciidoctor_base0/Gemfile +2 -2
- data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +6 -5
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb +5 -3
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +1 -3
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/file_formats/base_spec.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +18 -18
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +1 -0
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +3 -3
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/spec_helper/eac_asciidoctor_base0_stubs.rb +1 -1
- data/sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb +3 -3
- data/sub/avm-eac_python_base0/Gemfile +2 -2
- data/sub/avm-eac_python_base0/avm-eac_python_base0.gemspec +5 -4
- data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/executables.rb +1 -1
- data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/version.rb +1 -1
- data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec.rb +1 -1
- data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files/python_code.source +1 -1
- data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files/python_code.target +1 -1
- data/sub/avm-eac_python_base0/spec/rubocop_spec.rb +1 -1
- data/sub/avm-eac_python_base0/spec/spec_helper.rb +1 -1
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/rubocop_command.rb +2 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- metadata +14 -144
- data/sub/eac_cli/Gemfile +0 -8
- data/sub/eac_cli/eac_cli.gemspec +0 -22
- data/sub/eac_cli/lib/eac_cli/config/entry/options.rb +0 -58
- data/sub/eac_cli/lib/eac_cli/config/entry/undefined.rb +0 -31
- data/sub/eac_cli/lib/eac_cli/config/entry.rb +0 -60
- data/sub/eac_cli/lib/eac_cli/config.rb +0 -17
- data/sub/eac_cli/lib/eac_cli/core_ext.rb +0 -6
- data/sub/eac_cli/lib/eac_cli/default_runner.rb +0 -14
- data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +0 -105
- data/sub/eac_cli/lib/eac_cli/definition/argument_option.rb +0 -21
- data/sub/eac_cli/lib/eac_cli/definition/boolean_option.rb +0 -27
- data/sub/eac_cli/lib/eac_cli/definition/error.rb +0 -8
- data/sub/eac_cli/lib/eac_cli/definition/option/initialize_args_parser.rb +0 -48
- data/sub/eac_cli/lib/eac_cli/definition/option.rb +0 -73
- data/sub/eac_cli/lib/eac_cli/definition/option_or_positional.rb +0 -43
- data/sub/eac_cli/lib/eac_cli/definition/positional.rb +0 -53
- data/sub/eac_cli/lib/eac_cli/definition.rb +0 -109
- data/sub/eac_cli/lib/eac_cli/enum.rb +0 -45
- data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +0 -80
- data/sub/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +0 -16
- data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +0 -44
- data/sub/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +0 -25
- data/sub/eac_cli/lib/eac_cli/old_configs.rb +0 -35
- data/sub/eac_cli/lib/eac_cli/parser/alternative/any_options.rb +0 -19
- data/sub/eac_cli/lib/eac_cli/parser/alternative/argv.rb +0 -19
- data/sub/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +0 -24
- data/sub/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +0 -37
- data/sub/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +0 -29
- data/sub/eac_cli/lib/eac_cli/parser/alternative/options.rb +0 -29
- data/sub/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +0 -30
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +0 -54
- data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +0 -103
- data/sub/eac_cli/lib/eac_cli/parser/collector.rb +0 -55
- data/sub/eac_cli/lib/eac_cli/parser/error.rb +0 -15
- data/sub/eac_cli/lib/eac_cli/parser.rb +0 -34
- data/sub/eac_cli/lib/eac_cli/patches/object/runner_with.rb +0 -26
- data/sub/eac_cli/lib/eac_cli/patches/object.rb +0 -5
- data/sub/eac_cli/lib/eac_cli/patches.rb +0 -4
- data/sub/eac_cli/lib/eac_cli/rspec/setup.rb +0 -42
- data/sub/eac_cli/lib/eac_cli/rspec.rb +0 -9
- data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +0 -38
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +0 -36
- data/sub/eac_cli/lib/eac_cli/runner/context.rb +0 -63
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/base.rb +0 -24
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/parent.rb +0 -27
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner.rb +0 -20
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner_missing_method.rb +0 -32
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/set.rb +0 -44
- data/sub/eac_cli/lib/eac_cli/runner/context_responders.rb +0 -11
- data/sub/eac_cli/lib/eac_cli/runner/exit.rb +0 -14
- data/sub/eac_cli/lib/eac_cli/runner/for_context.rb +0 -40
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +0 -45
- data/sub/eac_cli/lib/eac_cli/runner.rb +0 -50
- data/sub/eac_cli/lib/eac_cli/runner_with/confirmation.rb +0 -44
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +0 -63
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +0 -81
- data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +0 -40
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +0 -53
- data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +0 -36
- data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +0 -58
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/base_formatter.rb +0 -15
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/csv_formatter.rb +0 -23
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +0 -18
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item.rb +0 -42
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/base_formatter.rb +0 -30
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/csv_formatter.rb +0 -26
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/yaml_formatter.rb +0 -23
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list.rb +0 -42
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +0 -10
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +0 -129
- data/sub/eac_cli/lib/eac_cli/runner_with.rb +0 -9
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +0 -56
- data/sub/eac_cli/lib/eac_cli/speaker/constants.rb +0 -13
- data/sub/eac_cli/lib/eac_cli/speaker/input_blocked.rb +0 -16
- data/sub/eac_cli/lib/eac_cli/speaker/input_requested.rb +0 -8
- data/sub/eac_cli/lib/eac_cli/speaker/list.rb +0 -61
- data/sub/eac_cli/lib/eac_cli/speaker/options.rb +0 -38
- data/sub/eac_cli/lib/eac_cli/speaker.rb +0 -127
- data/sub/eac_cli/lib/eac_cli/version.rb +0 -5
- data/sub/eac_cli/lib/eac_cli.rb +0 -7
- data/sub/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +0 -18
- data/sub/eac_cli/spec/lib/eac_cli/old_configs_spec.rb +0 -14
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative/subcommands_spec.rb +0 -58
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +0 -89
- data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +0 -79
- data/sub/eac_cli/spec/lib/eac_cli/runner_spec.rb +0 -129
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb +0 -42
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +0 -21
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +0 -51
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +0 -81
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +0 -98
- data/sub/eac_cli/spec/lib/eac_cli/speaker_spec.rb +0 -32
- data/sub/eac_cli/spec/rubocop_spec.rb +0 -3
- data/sub/eac_cli/spec/spec_helper.rb +0 -4
- data/sub/eac_config/Gemfile +0 -8
- data/sub/eac_config/eac_config.gemspec +0 -19
- data/sub/eac_config/lib/eac_config/entries.rb +0 -35
- data/sub/eac_config/lib/eac_config/entry/not_found_error.rb +0 -13
- data/sub/eac_config/lib/eac_config/entry.rb +0 -64
- data/sub/eac_config/lib/eac_config/entry_path.rb +0 -89
- data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +0 -54
- data/sub/eac_config/lib/eac_config/envvars_node.rb +0 -35
- data/sub/eac_config/lib/eac_config/load_nodes_search.rb +0 -39
- data/sub/eac_config/lib/eac_config/load_path.rb +0 -28
- data/sub/eac_config/lib/eac_config/node.rb +0 -81
- data/sub/eac_config/lib/eac_config/node_entry.rb +0 -28
- data/sub/eac_config/lib/eac_config/node_uri/instanciate_single.rb +0 -29
- data/sub/eac_config/lib/eac_config/node_uri.rb +0 -45
- data/sub/eac_config/lib/eac_config/old_configs/base.rb +0 -43
- data/sub/eac_config/lib/eac_config/old_configs/file.rb +0 -47
- data/sub/eac_config/lib/eac_config/old_configs.rb +0 -75
- data/sub/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +0 -8
- data/sub/eac_config/lib/eac_config/paths_hash/node.rb +0 -67
- data/sub/eac_config/lib/eac_config/paths_hash/path_search.rb +0 -39
- data/sub/eac_config/lib/eac_config/paths_hash.rb +0 -63
- data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +0 -25
- data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +0 -19
- data/sub/eac_config/lib/eac_config/rspec/setup.rb +0 -65
- data/sub/eac_config/lib/eac_config/rspec.rb +0 -9
- data/sub/eac_config/lib/eac_config/version.rb +0 -5
- data/sub/eac_config/lib/eac_config/yaml_file_node/entry.rb +0 -36
- data/sub/eac_config/lib/eac_config/yaml_file_node/self_entries.rb +0 -72
- data/sub/eac_config/lib/eac_config/yaml_file_node.rb +0 -54
- data/sub/eac_config/lib/eac_config.rb +0 -7
- data/sub/eac_config/spec/lib/eac_config/entry_path_spec.rb +0 -30
- data/sub/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -14
- data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +0 -51
- data/sub/eac_config/spec/lib/eac_config/old_configs_spec.rb +0 -46
- data/sub/eac_config/spec/lib/eac_config/paths_hash_spec.rb +0 -88
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +0 -88
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -10
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -4
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -4
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -10
- data/sub/eac_config/spec/rubocop_spec.rb +0 -3
- data/sub/eac_config/spec/spec_helper.rb +0 -4
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_cli/runner/context_responders/base'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module Runner
|
|
8
|
-
module ContextResponders
|
|
9
|
-
class Runner < ::EacCli::Runner::ContextResponders::Base
|
|
10
|
-
def callable?
|
|
11
|
-
runner.respond_to?(method_name)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def call(*args, &block)
|
|
15
|
-
runner.send(method_name, *args, &block)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_cli/runner/context_responders/base'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module Runner
|
|
8
|
-
module ContextResponders
|
|
9
|
-
class RunnerMissingMethod < ::EacCli::Runner::ContextResponders::Base
|
|
10
|
-
def callable?
|
|
11
|
-
responder_runner.present?
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def call(*args, &block)
|
|
15
|
-
responder_runner.send(method_name, *args, &block)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
def responder_runner
|
|
21
|
-
parent.if_present(nil) do |v|
|
|
22
|
-
next v if v.respond_to?(method_name) && v.for_context?(method_name)
|
|
23
|
-
|
|
24
|
-
v.if_respond(:runner_context, nil) do |w|
|
|
25
|
-
w.runner_missing_method_responder(method_name).send(__method__)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_cli/runner/context_responders/base'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module Runner
|
|
8
|
-
module ContextResponders
|
|
9
|
-
class Set < ::EacCli::Runner::ContextResponders::Base
|
|
10
|
-
attr_reader :responders_names
|
|
11
|
-
|
|
12
|
-
def initialize(context, method_name, responders_names)
|
|
13
|
-
super(context, method_name)
|
|
14
|
-
@responders_names = responders_names
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def callable?
|
|
18
|
-
responders_instances.any?(&:callable?)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def call(...)
|
|
22
|
-
caller = responder_to_call
|
|
23
|
-
return caller.call(...) if caller
|
|
24
|
-
|
|
25
|
-
raise ::NameError, "No method \"#{method_name}\" found in #{runner} or in its ancestors"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def responder_class(class_name)
|
|
31
|
-
::EacCli::Runner::ContextResponders.const_get(class_name.to_s.camelize)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def responders_instances
|
|
35
|
-
responders_names.lazy.map { |name| responder_class(name).new(context, method_name) }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def responder_to_call
|
|
39
|
-
responders_instances.lazy.select(&:callable?).first
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacCli
|
|
4
|
-
module Runner
|
|
5
|
-
class Exit < ::StandardError
|
|
6
|
-
attr_reader :status
|
|
7
|
-
|
|
8
|
-
def initialize(status = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
9
|
-
super
|
|
10
|
-
@status = status
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_ruby_utils/module_ancestors_variable/set'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module Runner
|
|
8
|
-
module ForContext
|
|
9
|
-
common_concern
|
|
10
|
-
|
|
11
|
-
module ClassMethods
|
|
12
|
-
# @param methods_names [Enumerable<Symbol>]
|
|
13
|
-
# @return [void]
|
|
14
|
-
def for_context(*methods_names)
|
|
15
|
-
for_context_methods.merge(methods_names.map(&:to_sym))
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# @param method_name [Symbol]
|
|
19
|
-
# @return [Boolean]
|
|
20
|
-
def for_context?(method_name)
|
|
21
|
-
for_context_methods.include?(method_name.to_sym)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
# @return [EacRubyUtils::ModuleAncestorsVariable::Set<Symbol>]
|
|
27
|
-
def for_context_methods
|
|
28
|
-
@for_context_methods ||=
|
|
29
|
-
::EacRubyUtils::ModuleAncestorsVariable::Set.new(self, __method__)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# @param method_name [Symbol]
|
|
34
|
-
# @return [Boolean]
|
|
35
|
-
def for_context?(method_name)
|
|
36
|
-
self.class.for_context?(method_name)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacCli
|
|
4
|
-
module Runner
|
|
5
|
-
module InstanceMethods
|
|
6
|
-
def run_run
|
|
7
|
-
parsed
|
|
8
|
-
run_callbacks(:run) { run }
|
|
9
|
-
rescue ::EacCli::Runner::Exit
|
|
10
|
-
# Do nothing
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def runner_context
|
|
14
|
-
return @runner_context if @runner_context
|
|
15
|
-
|
|
16
|
-
raise 'Context was required, but was not set yet'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def runner_context=(new_runner_context)
|
|
20
|
-
@runner_context = new_runner_context
|
|
21
|
-
@parsed = nil
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def parsed
|
|
25
|
-
@parsed ||= ::EacCli::Parser.new(self.class.runner_definition, runner_context.argv).parsed
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def program_name
|
|
29
|
-
runner_context.if_present(&:program_name) || $PROGRAM_NAME
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def respond_to_missing?(method, include_all = false)
|
|
33
|
-
runner_context.runner_missing_method_responder(method).callable? || super
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def method_missing(method, *args, &block)
|
|
37
|
-
runner_context.runner_missing_method_responder(method).if_callable do |v|
|
|
38
|
-
return v.call(*args, &block)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
super
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/definition'
|
|
4
|
-
require 'eac_cli/parser'
|
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module Runner
|
|
9
|
-
require_sub __FILE__
|
|
10
|
-
extend ::ActiveSupport::Concern
|
|
11
|
-
|
|
12
|
-
class << self
|
|
13
|
-
def alias_runner_class_methods(klass, from_suffix, to_suffix)
|
|
14
|
-
%i[create run].each do |method|
|
|
15
|
-
alias_class_method(klass, build_method_name(method, from_suffix),
|
|
16
|
-
build_method_name(method, to_suffix))
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def runner?(object)
|
|
21
|
-
object.is_a?(::Class) && object.included_modules.include?(::EacCli::Runner)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def alias_class_method(klass, from, to)
|
|
27
|
-
sklass = klass.singleton_class
|
|
28
|
-
return unless sklass.method_defined?(from)
|
|
29
|
-
|
|
30
|
-
sklass.send(:alias_method, to, from)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def build_method_name(name, suffix)
|
|
34
|
-
ss = suffix.if_present('') { |s| "#{s}_" }
|
|
35
|
-
"#{ss}#{name}"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
the_module = self
|
|
40
|
-
included do
|
|
41
|
-
the_module.alias_runner_class_methods(self, '', 'original')
|
|
42
|
-
|
|
43
|
-
extend AfterClassMethods
|
|
44
|
-
include InstanceMethods
|
|
45
|
-
include ::EacCli::Runner::ForContext
|
|
46
|
-
include ActiveSupport::Callbacks
|
|
47
|
-
define_callbacks :run
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module RunnerWith
|
|
8
|
-
module Confirmation
|
|
9
|
-
DEFAULT_CONFIRM_QUESTION_TEXT = 'Confirm?'
|
|
10
|
-
|
|
11
|
-
common_concern do
|
|
12
|
-
include ::EacCli::Runner
|
|
13
|
-
enable_settings_provider
|
|
14
|
-
enable_simple_cache
|
|
15
|
-
runner_definition do
|
|
16
|
-
bool_opt '--no', 'Deny confirmation without question.'
|
|
17
|
-
bool_opt '--yes', 'Accept confirmation without question.'
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def confirm?(message = nil)
|
|
22
|
-
return false if parsed.no?
|
|
23
|
-
return true if parsed.yes?
|
|
24
|
-
|
|
25
|
-
input(
|
|
26
|
-
message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
|
|
27
|
-
bool: true
|
|
28
|
-
)
|
|
29
|
-
rescue ::EacCli::Speaker::InputRequested => e
|
|
30
|
-
fatal_error e.message
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def run_confirm(message = nil)
|
|
34
|
-
yield if confirm?(message)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
def cached_confirm_uncached?(message = nil)
|
|
40
|
-
confirm?(message)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
|
|
5
|
-
module EacCli
|
|
6
|
-
module RunnerWith
|
|
7
|
-
module Help
|
|
8
|
-
class Builder
|
|
9
|
-
class Alternative
|
|
10
|
-
enable_method_class
|
|
11
|
-
|
|
12
|
-
SUBCOMMANDS_MACRO = '__SUBCOMMANDS__'
|
|
13
|
-
|
|
14
|
-
common_constructor :builder, :alternative
|
|
15
|
-
|
|
16
|
-
def result
|
|
17
|
-
(
|
|
18
|
-
program_name +
|
|
19
|
-
alternative.options_argument?.if_present([]) { |_v| ['[options]'] } +
|
|
20
|
-
options +
|
|
21
|
-
positionals
|
|
22
|
-
).join(builder.word_separator)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def options
|
|
26
|
-
alternative.options.select(&:show_on_usage?).map do |option|
|
|
27
|
-
::EacCli::RunnerWith::Help::Builder.option_long(option)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def option_argument(option)
|
|
32
|
-
b = option.long
|
|
33
|
-
b += '=<value>' if option.argument?
|
|
34
|
-
b
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def positionals
|
|
38
|
-
alternative.positional.map { |p| positional(p) }.compact_blank
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def positional(positional)
|
|
42
|
-
return unless positional.visible?
|
|
43
|
-
|
|
44
|
-
if positional.subcommand?
|
|
45
|
-
SUBCOMMANDS_MACRO
|
|
46
|
-
else
|
|
47
|
-
r = "<#{positional.name}>"
|
|
48
|
-
r += '...' if positional.repeat?
|
|
49
|
-
r = "[#{r}]" if positional.optional?
|
|
50
|
-
r
|
|
51
|
-
end
|
|
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
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner_with/help/layout'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module RunnerWith
|
|
8
|
-
module Help
|
|
9
|
-
class Builder
|
|
10
|
-
include ::EacCli::RunnerWith::Help::Layout
|
|
11
|
-
require_sub __FILE__, require_dependency: true
|
|
12
|
-
common_constructor :runner
|
|
13
|
-
|
|
14
|
-
class << self
|
|
15
|
-
def option_long(option)
|
|
16
|
-
b = option.long
|
|
17
|
-
b += '=<value>' if option.argument?
|
|
18
|
-
b
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def option_short(option)
|
|
22
|
-
b = option.short
|
|
23
|
-
b += '=<value>' if option.argument?
|
|
24
|
-
b
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def option_usage_full(option)
|
|
28
|
-
if option.long.present?
|
|
29
|
-
[option.short, option_long(option)].compact_blank.join(word_separator)
|
|
30
|
-
else
|
|
31
|
-
option_short(option)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def word_separator
|
|
36
|
-
WORD_SEPARATOR
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
delegate :word_separator, to: :class
|
|
41
|
-
|
|
42
|
-
def definition
|
|
43
|
-
runner.class.runner_definition
|
|
44
|
-
end
|
|
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
|
-
|
|
53
|
-
def option_definition(option)
|
|
54
|
-
[self.class.option_usage_full(option), option.description,
|
|
55
|
-
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
|
56
|
-
.compact_blank.join(OPTION_DESCRIPTION_SEPARATOR)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# @return [String]
|
|
60
|
-
def options_section
|
|
61
|
-
list_section(
|
|
62
|
-
'Options',
|
|
63
|
-
definition.alternatives.flat_map(&:options).map { |option| option_definition(option) }
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# @return [String]
|
|
68
|
-
def usage_section
|
|
69
|
-
list_section(
|
|
70
|
-
'Usage',
|
|
71
|
-
definition.alternatives.map { |alternative| self.alternative(alternative) }
|
|
72
|
-
)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def to_s
|
|
76
|
-
join_sections(definition.description, usage_section, options_section, *extra_sections)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module RunnerWith
|
|
8
|
-
module Help
|
|
9
|
-
require_sub __FILE__, require_mode: :kernel
|
|
10
|
-
common_concern do
|
|
11
|
-
include ::EacCli::Runner
|
|
12
|
-
|
|
13
|
-
runner_definition.alt do
|
|
14
|
-
bool_opt '-h', '--help', 'Show help.', usage: true, required: true
|
|
15
|
-
any_opt
|
|
16
|
-
pos_arg :any_arg_with_help, repeat: true, optional: true, visible: false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
set_callback :run, :before do
|
|
20
|
-
help_run
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# @param items [Enumerable<String>]
|
|
25
|
-
# @return [String]
|
|
26
|
-
def help_list_section(title, items)
|
|
27
|
-
::EacCli::RunnerWith::Help::Layout.list_section(title, items)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# @param items [Enumerable<String>]
|
|
31
|
-
# @return [String]
|
|
32
|
-
def help_join_sections(*sections)
|
|
33
|
-
::EacCli::RunnerWith::Help::Layout.join_sections(*sections)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def help_run
|
|
37
|
-
return unless show_help?
|
|
38
|
-
|
|
39
|
-
puts help_text
|
|
40
|
-
raise ::EacCli::Runner::Exit
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# @return [String]
|
|
44
|
-
def help_text
|
|
45
|
-
::EacCli::RunnerWith::Help::Builder.new(self).to_s
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def show_help?
|
|
49
|
-
parsed.help? && !if_respond(:run_subcommand?, false)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_ruby_utils/acts_as_abstract'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module Input
|
|
10
|
-
STDIN_OPTION = '-'
|
|
11
|
-
BLANK_OPTION = '+'
|
|
12
|
-
DEFAULT_DEFAULT_INPUT_OPTION = BLANK_OPTION
|
|
13
|
-
|
|
14
|
-
common_concern do
|
|
15
|
-
enable_settings_provider
|
|
16
|
-
include ::EacCli::Runner
|
|
17
|
-
|
|
18
|
-
runner_definition do
|
|
19
|
-
arg_opt '-i', '--input', 'Input from file.'
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def input_content
|
|
24
|
-
case input_option
|
|
25
|
-
when STDIN_OPTION then $stdin.read
|
|
26
|
-
when BLANK_OPTION then ''
|
|
27
|
-
else input_option.to_pathname.read
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def input_option
|
|
32
|
-
parsed.input || setting_value(:default_input_option, default: DEFAULT_DEFAULT_INPUT_OPTION)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_ruby_utils/acts_as_abstract'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module Output
|
|
10
|
-
STDOUT_OPTION = '-'
|
|
11
|
-
DEFAULT_FILE_OPTION = '+'
|
|
12
|
-
DEFAULT_DEFAULT_OUTPUT_OPTION = STDOUT_OPTION
|
|
13
|
-
DEFAULT_DEFAULT_FILE_TO_OUTPUT = 'output'
|
|
14
|
-
|
|
15
|
-
common_concern do
|
|
16
|
-
enable_abstract_methods
|
|
17
|
-
enable_settings_provider
|
|
18
|
-
include ::EacCli::Runner
|
|
19
|
-
|
|
20
|
-
abstract_methods :output_content
|
|
21
|
-
|
|
22
|
-
runner_definition do
|
|
23
|
-
arg_opt '-o', '--output', 'Output to file.'
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def run_output
|
|
28
|
-
file = file_to_output
|
|
29
|
-
if file
|
|
30
|
-
file.to_pathname.write(output_content)
|
|
31
|
-
else
|
|
32
|
-
$stdout.write(output_content)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def output_option
|
|
37
|
-
parsed.output || default_output_option_value
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def file_to_output
|
|
41
|
-
case output_option
|
|
42
|
-
when STDOUT_OPTION then nil
|
|
43
|
-
when DEFAULT_FILE_OPTION then default_file_to_output_value
|
|
44
|
-
else output_option
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def default_output_option_value
|
|
49
|
-
setting_value(:default_output_option,
|
|
50
|
-
default: DEFAULT_DEFAULT_OUTPUT_OPTION)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def default_file_to_output_value
|
|
54
|
-
setting_value(:default_file_to_output, default: DEFAULT_DEFAULT_FILE_TO_OUTPUT)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_ruby_utils/acts_as_abstract'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
module RunnerWith
|
|
8
|
-
module OutputItem
|
|
9
|
-
class BaseFormatter
|
|
10
|
-
acts_as_abstract :to_output
|
|
11
|
-
common_constructor :item_hash
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'csv'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_cli/runner_with/output_item/base_formatter'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputItem
|
|
10
|
-
class CsvFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
|
11
|
-
COLUMNS = %w[key value].freeze
|
|
12
|
-
|
|
13
|
-
# @return [String]
|
|
14
|
-
def to_output
|
|
15
|
-
::CSV.generate do |csv|
|
|
16
|
-
csv << COLUMNS
|
|
17
|
-
item_hash.each { |k, v| csv << [k, v] }
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|