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,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_cli/runner_with/output_item/base_formatter'
|
|
5
|
-
require 'yaml'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputItem
|
|
10
|
-
class YamlFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
|
11
|
-
# @return [String]
|
|
12
|
-
def to_output
|
|
13
|
-
::YAML.dump(item_hash.deep_stringify_keys)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner_with/output'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_ruby_utils/acts_as_abstract'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputItem
|
|
10
|
-
require_sub __FILE__
|
|
11
|
-
|
|
12
|
-
FORMATS = {
|
|
13
|
-
'csv' => ::EacCli::RunnerWith::OutputItem::CsvFormatter,
|
|
14
|
-
'yaml' => ::EacCli::RunnerWith::OutputItem::YamlFormatter
|
|
15
|
-
}.freeze
|
|
16
|
-
|
|
17
|
-
common_concern do
|
|
18
|
-
acts_as_abstract :item_hash
|
|
19
|
-
include ::EacCli::RunnerWith::Output
|
|
20
|
-
|
|
21
|
-
runner_definition do
|
|
22
|
-
arg_opt '-f', '--format', 'Format to output item.', default: 'yaml'
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# @return [String]
|
|
27
|
-
def output_content
|
|
28
|
-
formatter.to_output
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
|
32
|
-
def formatter
|
|
33
|
-
formatter_class.new(item_hash)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @return [Class]
|
|
37
|
-
def formatter_class
|
|
38
|
-
FORMATS.fetch(parsed.format)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,30 +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 OutputList
|
|
9
|
-
class BaseFormatter
|
|
10
|
-
acts_as_abstract :to_output
|
|
11
|
-
common_constructor :columns, :rows
|
|
12
|
-
|
|
13
|
-
# @return [String]
|
|
14
|
-
def build_column(column)
|
|
15
|
-
column.to_s
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# @return [Array<String>]
|
|
19
|
-
def build_columns
|
|
20
|
-
columns.map(&:to_s)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# @return [Array<Hash<String, String>>]
|
|
24
|
-
def build_rows
|
|
25
|
-
rows.map { |row| build_row(row) }
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,26 +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_list/base_formatter'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputList
|
|
10
|
-
class CsvFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
|
11
|
-
# @return [Array]
|
|
12
|
-
def build_row(row)
|
|
13
|
-
build_columns.map { |c| row.send(c) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @return [String]
|
|
17
|
-
def to_output
|
|
18
|
-
::CSV.generate do |csv|
|
|
19
|
-
csv << build_columns
|
|
20
|
-
build_rows.each { |row| csv << row }
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_cli/runner_with/output_list/base_formatter'
|
|
5
|
-
require 'yaml'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputList
|
|
10
|
-
class YamlFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
|
11
|
-
# @return [Hash<String, String>]
|
|
12
|
-
def build_row(row)
|
|
13
|
-
build_columns.inject({}) { |a, e| a.merge(e => row.send(e).to_s) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @return [String]
|
|
17
|
-
def to_output
|
|
18
|
-
::YAML.dump(build_rows)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/runner_with/output'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_ruby_utils/acts_as_abstract'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
module RunnerWith
|
|
9
|
-
module OutputList
|
|
10
|
-
require_sub __FILE__
|
|
11
|
-
|
|
12
|
-
FORMATS = {
|
|
13
|
-
'csv' => ::EacCli::RunnerWith::OutputList::CsvFormatter,
|
|
14
|
-
'yaml' => ::EacCli::RunnerWith::OutputList::YamlFormatter
|
|
15
|
-
}.freeze
|
|
16
|
-
|
|
17
|
-
common_concern do
|
|
18
|
-
acts_as_abstract :list_columns, :list_rows
|
|
19
|
-
include ::EacCli::RunnerWith::Output
|
|
20
|
-
|
|
21
|
-
runner_definition do
|
|
22
|
-
arg_opt '-f', '--format', 'Format to output list.', default: 'yaml'
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# @return [String]
|
|
27
|
-
def output_content
|
|
28
|
-
formatter.to_output
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
|
32
|
-
def formatter
|
|
33
|
-
formatter_class.new(list_columns, list_rows)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @return [Class]
|
|
37
|
-
def formatter_class
|
|
38
|
-
FORMATS.fetch(parsed.format)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,129 +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 Subcommands
|
|
9
|
-
require_sub __FILE__
|
|
10
|
-
|
|
11
|
-
class << self
|
|
12
|
-
def runner?(object)
|
|
13
|
-
::EacCli::Runner.runner?(object)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @return [Hash<String, EacCli::Runner>]
|
|
17
|
-
def subcommands_from_module(a_module)
|
|
18
|
-
a_module.constants
|
|
19
|
-
.map { |name| [name.to_s.underscore.gsub('_', '-'), a_module.const_get(name)] }
|
|
20
|
-
.select { |c| runner?(c[1]) }
|
|
21
|
-
.to_h.with_indifferent_access
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
common_concern do
|
|
26
|
-
include ::EacCli::Runner
|
|
27
|
-
runner_definition.singleton_class
|
|
28
|
-
.include(::EacCli::RunnerWith::Subcommands::DefinitionConcern)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME = :extra_available_subcommands
|
|
32
|
-
|
|
33
|
-
def available_subcommands
|
|
34
|
-
@available_subcommands ||= available_subcommands_auto.merge(available_subcommands_extra)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# @return [Hash<String, EacCli::Runner>]
|
|
38
|
-
def available_subcommands_auto
|
|
39
|
-
::EacCli::RunnerWith::Subcommands.subcommands_from_module(self.class)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def available_subcommands_extra
|
|
43
|
-
if respond_to?(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME, true)
|
|
44
|
-
send(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME)
|
|
45
|
-
else
|
|
46
|
-
{}
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def available_subcommands_to_s
|
|
51
|
-
available_subcommands.keys.sort.join(', ')
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# @return [Hash<String, Enumerable<String>]
|
|
55
|
-
def help_extra_text
|
|
56
|
-
help_list_section('Subcommands', available_subcommands.keys.sort)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def method_missing(method_name, *arguments, &block)
|
|
60
|
-
return run_with_subcommand(*arguments, &block) if
|
|
61
|
-
run_with_subcommand_alias_run?(method_name)
|
|
62
|
-
|
|
63
|
-
super
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def respond_to_missing?(method_name, include_private = false)
|
|
67
|
-
run_with_subcommand_alias_run?(method_name) || super
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def run_with_subcommand
|
|
71
|
-
if run_subcommand?
|
|
72
|
-
if subcommand_runner.respond_to?(:run_run)
|
|
73
|
-
subcommand_runner.run_run
|
|
74
|
-
else
|
|
75
|
-
subcommand_runner.run
|
|
76
|
-
end
|
|
77
|
-
else
|
|
78
|
-
run_without_subcommand
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def run_with_subcommand_alias_run?(method_name)
|
|
83
|
-
subcommands? && method_name.to_sym == :run
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def run_without_subcommand
|
|
87
|
-
"Method #{__method__} should be overrided in #{self.class.name}"
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def run_subcommand?
|
|
91
|
-
subcommand_name.present?
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def subcommands?
|
|
95
|
-
self.class.runner_definition.subcommands?
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def subcommand_args
|
|
99
|
-
parsed.fetch(::EacCli::Definition::SUBCOMMAND_ARGS_ARG)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def subcommand_class
|
|
103
|
-
available_subcommands[subcommand_name].if_present { |v| return v }
|
|
104
|
-
|
|
105
|
-
raise(::EacCli::Parser::Error.new(
|
|
106
|
-
self.class.runner_definition, runner_context.argv,
|
|
107
|
-
"Subcommand \"#{subcommand_name}\" not found " \
|
|
108
|
-
"(Available: #{available_subcommands_to_s})"
|
|
109
|
-
))
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def subcommand_name
|
|
113
|
-
parsed.fetch(::EacCli::Definition::SUBCOMMAND_NAME_ARG)
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def subcommand_program
|
|
117
|
-
[program_name, subcommand_name]
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def subcommand_runner
|
|
121
|
-
@subcommand_runner ||= subcommand_class.create(
|
|
122
|
-
argv: subcommand_args,
|
|
123
|
-
program_name: subcommand_program,
|
|
124
|
-
parent: self
|
|
125
|
-
)
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/gems_registry'
|
|
4
|
-
|
|
5
|
-
module EacCli
|
|
6
|
-
class RunnerWithSet
|
|
7
|
-
class << self
|
|
8
|
-
def default
|
|
9
|
-
@default ||= new
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def add_namespace(namespace)
|
|
14
|
-
namespace = sanitize_namespace(namespace)
|
|
15
|
-
namespace_set << namespace unless namespace_set.include?(namespace)
|
|
16
|
-
self
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def add_from_gems_registry
|
|
20
|
-
::EacRubyUtils::GemsRegistry.new('RunnerWith').registered.each do |registered_gem|
|
|
21
|
-
add_namespace(registered_gem.registered_module)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def item_to_module(item)
|
|
26
|
-
item.is_a?(::Module) ? item : key_to_module(item)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def namespaces
|
|
30
|
-
namespace_set.dup
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
def namespace_set
|
|
36
|
-
@namespace_set ||= []
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def key_to_module(key)
|
|
40
|
-
namespace_set.lazy
|
|
41
|
-
.map { |namespace| key_to_module_in_namespace(namespace, key) }
|
|
42
|
-
.find(&:present?) ||
|
|
43
|
-
raise("Not module found with key \"#{key}\" (Namespaces: #{namespace_set})")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def key_to_module_in_namespace(namespace, key)
|
|
47
|
-
namespace.const_get(key.to_s.camelize)
|
|
48
|
-
rescue ::NameError
|
|
49
|
-
nil
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def sanitize_namespace(source)
|
|
53
|
-
source.is_a?(::Module) ? source : source.to_s.constantize
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/by_reference'
|
|
4
|
-
|
|
5
|
-
module EacCli
|
|
6
|
-
class Speaker
|
|
7
|
-
module Constants
|
|
8
|
-
STDERR = ::EacRubyUtils::ByReference.new { $stderr }
|
|
9
|
-
STDIN = ::EacRubyUtils::ByReference.new { $stdin }
|
|
10
|
-
STDOUT = ::EacRubyUtils::ByReference.new { $stdout }
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/speaker/input_requested'
|
|
4
|
-
|
|
5
|
-
module EacCli
|
|
6
|
-
class Speaker
|
|
7
|
-
class InputBlocked
|
|
8
|
-
%w[gets noecho].each do |method|
|
|
9
|
-
define_method(method) do
|
|
10
|
-
raise ::EacCli::Speaker::InputRequested,
|
|
11
|
-
"Method (\"#{method}\") was requested, but input is blocked"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'active_support/hash_with_indifferent_access'
|
|
4
|
-
require 'ostruct'
|
|
5
|
-
|
|
6
|
-
module EacCli
|
|
7
|
-
class Speaker
|
|
8
|
-
class List
|
|
9
|
-
class << self
|
|
10
|
-
def build(list)
|
|
11
|
-
return List.new(hash_to_values(list)) if list.is_a?(::Hash)
|
|
12
|
-
return List.new(array_to_values(list)) if list.is_a?(::Array)
|
|
13
|
-
|
|
14
|
-
raise "Invalid list: #{list} (#{list.class})"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
def hash_to_values(list)
|
|
20
|
-
list.map { |key, value| ::OpenStruct.new(key: key, label: key, value: value) } # rubocop:disable Style/OpenStructUse
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def array_to_values(list)
|
|
24
|
-
list.map { |value| ::OpenStruct.new(key: value, label: value, value: value) } # rubocop:disable Style/OpenStructUse
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
attr_reader :values
|
|
29
|
-
|
|
30
|
-
def initialize(values)
|
|
31
|
-
@values = values.map do |v|
|
|
32
|
-
::OpenStruct.new(key: to_key(v.key), label: to_label(v.label), value: v.value) # rubocop:disable Style/OpenStructUse
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def valid_labels
|
|
37
|
-
values.map(&:label)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def valid_value?(value)
|
|
41
|
-
values.any? { |v| v.key == to_key(value) }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def to_key(value)
|
|
45
|
-
to_label(value).downcase
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def to_label(value)
|
|
49
|
-
value.to_s.strip
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def build_value(value)
|
|
53
|
-
key = to_key(value)
|
|
54
|
-
values.each do |v|
|
|
55
|
-
return v.value if v.key == key
|
|
56
|
-
end
|
|
57
|
-
raise "Value not found: \"#{value}\" (#{values})"
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
|
|
5
|
-
module EacCli
|
|
6
|
-
class Speaker
|
|
7
|
-
module Options
|
|
8
|
-
common_concern do
|
|
9
|
-
enable_listable
|
|
10
|
-
lists.add_symbol :option, :out_out, :err_out, :in_in, :parent, :err_line_prefix
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def err_out
|
|
14
|
-
option(OPTION_ERR_OUT, $stderr)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def out_out
|
|
18
|
-
option(OPTION_OUT_OUT, $stdout)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def in_in
|
|
22
|
-
option(OPTION_IN_IN, $stdin)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def err_line_prefix
|
|
26
|
-
option(OPTION_ERR_LINE_PREFIX, '')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def parent
|
|
30
|
-
options[OPTION_PARENT]
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def option(key, default)
|
|
34
|
-
options[key] || parent.if_present(default) { |v| v.send(__METHOD__) }
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'colorize'
|
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
|
5
|
-
require 'eac_ruby_utils/speaker/receiver'
|
|
6
|
-
|
|
7
|
-
module EacCli
|
|
8
|
-
class Speaker
|
|
9
|
-
require_sub __FILE__, include_modules: true
|
|
10
|
-
include ::EacRubyUtils::Speaker::Receiver
|
|
11
|
-
|
|
12
|
-
common_constructor :options, default: [{}] do
|
|
13
|
-
self.options = self.class.lists.option.hash_keys_validate!(options)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def puts(string = '')
|
|
17
|
-
string.to_s.each_line do |line|
|
|
18
|
-
err_out.puts(err_line_prefix.to_s + line)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def out(string = '')
|
|
23
|
-
out_out.write(string.to_s)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def error(string)
|
|
27
|
-
puts "ERROR: #{string}".white.on_red
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def title(string)
|
|
31
|
-
string = string.to_s
|
|
32
|
-
puts(('-' * (8 + string.length)).green)
|
|
33
|
-
puts("--- #{string} ---".green)
|
|
34
|
-
puts(('-' * (8 + string.length)).green)
|
|
35
|
-
puts
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def info(string)
|
|
39
|
-
puts string.to_s.white
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def infom(string)
|
|
43
|
-
puts string.to_s.light_yellow
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def warn(string)
|
|
47
|
-
puts string.to_s.yellow
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Options:
|
|
51
|
-
# +bool+ ([Boolean], default: +false+): requires a answer "yes" or "no".
|
|
52
|
-
# +list+ ([Hash] or [Array], default: +nil+): requires a answer from a list.
|
|
53
|
-
# +noecho+ ([Boolean], default: +false+): does not output answer.
|
|
54
|
-
def input(question, options = {})
|
|
55
|
-
bool, list, noecho = options.to_options_consumer.consume_all(:bool, :list, :noecho)
|
|
56
|
-
if list
|
|
57
|
-
request_from_list(question, list, noecho)
|
|
58
|
-
elsif bool
|
|
59
|
-
request_from_bool(question, noecho)
|
|
60
|
-
else
|
|
61
|
-
request_string(question, noecho)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def infov(*args)
|
|
66
|
-
r = []
|
|
67
|
-
args.each_with_index do |v, i|
|
|
68
|
-
if i.even?
|
|
69
|
-
r << "#{v}: ".cyan
|
|
70
|
-
else
|
|
71
|
-
r.last << v.to_s
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
puts r.join(', ')
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def success(string)
|
|
78
|
-
puts string.to_s.green
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
def list_value(list, input)
|
|
84
|
-
values = list_values(list)
|
|
85
|
-
return input, true unless values
|
|
86
|
-
|
|
87
|
-
[input, false] unless values.include?(input)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def list_values(list)
|
|
91
|
-
if list.is_a?(::Hash)
|
|
92
|
-
list.keys.map(&:to_s)
|
|
93
|
-
elsif list.is_a?(::Array)
|
|
94
|
-
list.map(&:to_s)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def request_from_bool(question, noecho)
|
|
99
|
-
request_from_list(question, { yes: true, y: true, no: false, n: false }, noecho)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def request_from_list(question, list, noecho)
|
|
103
|
-
list = ::EacCli::Speaker::List.build(list)
|
|
104
|
-
loop do
|
|
105
|
-
input = request_string("#{question} [#{list.valid_labels.join('/')}]", noecho)
|
|
106
|
-
return list.build_value(input) if list.valid_value?(input)
|
|
107
|
-
|
|
108
|
-
warn "Invalid input: \"#{input}\" (Valid: #{list.valid_labels.join(', ')})"
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def request_string(question, noecho)
|
|
113
|
-
err_out.write "#{question}: ".to_s.yellow
|
|
114
|
-
noecho ? request_string_noecho : request_string_echo
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def request_string_noecho
|
|
118
|
-
r = in_in.noecho(&:gets).chomp.strip
|
|
119
|
-
err_out.write("\n")
|
|
120
|
-
r
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def request_string_echo
|
|
124
|
-
in_in.gets.chomp.strip
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
data/sub/eac_cli/lib/eac_cli.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_cli/definition/alternative'
|
|
4
|
-
|
|
5
|
-
RSpec.describe EacCli::Definition::Alternative do
|
|
6
|
-
let(:instance) { described_class.new }
|
|
7
|
-
|
|
8
|
-
it { expect { instance.arg_opt '-a', '--opt2', 'A argument option' }.not_to raise_error }
|
|
9
|
-
it { expect { instance.bool_opt '-b', '--opt1', 'A boolean option' }.not_to raise_error }
|
|
10
|
-
it { expect { instance.bool_opt '-b', '--no-description' }.not_to raise_error }
|
|
11
|
-
it { expect { instance.bool_opt '--opt1', 'A option without short' }.not_to raise_error }
|
|
12
|
-
it { expect { instance.bool_opt '-b', 'A option without long' }.not_to raise_error }
|
|
13
|
-
it { expect { instance.bool_opt 'A option without selectors' }.to raise_error(StandardError) }
|
|
14
|
-
it { expect { instance.options_argument(true) }.not_to raise_error }
|
|
15
|
-
it { expect { instance.pos_arg :pos1 }.not_to raise_error }
|
|
16
|
-
it { expect { instance.pos_arg :pos2, optional: true, repeat: true }.not_to raise_error }
|
|
17
|
-
it { expect { instance.subcommands }.not_to raise_error }
|
|
18
|
-
end
|