ehbrs-tools 0.19.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs/cooking_book/project.rb +8 -2
- data/lib/ehbrs/core_ext.rb +4 -0
- data/lib/ehbrs/music.rb +9 -0
- data/lib/ehbrs/music/album.rb +44 -0
- data/lib/ehbrs/observers/base.rb +1 -1
- data/lib/ehbrs/observers/with_persistence.rb +1 -1
- data/lib/ehbrs/patches.rb +4 -0
- data/lib/ehbrs/patches/object/template.rb +2 -2
- data/lib/ehbrs/runner/cooking_book/build.rb +20 -2
- data/lib/ehbrs/runner/fs/selected.rb +79 -0
- data/lib/ehbrs/runner/fs/used_space.rb +2 -3
- data/lib/ehbrs/runner/music.rb +16 -0
- data/lib/ehbrs/runner/music/selected.rb +26 -0
- data/lib/ehbrs/runner/videos/probe.rb +2 -2
- data/lib/ehbrs/runner/web_utils/videos/upload.rb +1 -1
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/vg/wii/game_file.rb +10 -0
- data/lib/ehbrs/videos/convert_job.rb +1 -1
- data/lib/ehbrs/videos/series/rename/line_result.rb +1 -1
- data/lib/ehbrs/videos/unsupported/check_support.rb +12 -7
- data/lib/ehbrs/videos/unsupported/search.rb +1 -1
- data/lib/ehbrs/videos/unsupported/track.rb +1 -1
- data/vendor/aranha-parsers/aranha-parsers.gemspec +1 -1
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/aranha-parsers/spec/lib/rubocop_check_spec.rb +1 -5
- data/vendor/aranha-parsers/spec/spec_helper.rb +3 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/base.rb +8 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/chrome.rb +10 -5
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox.rb +25 -11
- data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
- data/vendor/eac_cli/eac_cli.gemspec +4 -2
- data/vendor/eac_cli/lib/eac_cli/config.rb +18 -0
- data/vendor/eac_cli/lib/eac_cli/config/entry.rb +48 -0
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb → eac_cli/lib/eac_cli/config/entry/options.rb} +20 -9
- data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -10
- data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +3 -2
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +18 -1
- data/vendor/eac_cli/lib/eac_cli/old_configs.rb +35 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +80 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +16 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +44 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +25 -0
- data/vendor/eac_cli/lib/eac_cli/old_configs_bridge.rb +39 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +3 -2
- data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -50
- data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +46 -0
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +42 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +9 -4
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +73 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +56 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +11 -5
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/speaker.rb +127 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +61 -0
- data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console/configs_spec.rb → eac_cli/spec/lib/eac_cli/old_configs_spec.rb} +2 -2
- data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -4
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console → eac_cli/spec/lib/eac_cli}/speaker_spec.rb +7 -11
- data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_cli/spec/spec_helper.rb +3 -0
- data/vendor/eac_config/Gemfile +5 -0
- data/vendor/eac_config/eac_config.gemspec +19 -0
- data/vendor/eac_config/lib/eac_config.rb +7 -0
- data/vendor/eac_config/lib/eac_config/entry.rb +49 -0
- data/vendor/eac_config/lib/eac_config/entry_path.rb +41 -0
- data/vendor/eac_config/lib/eac_config/envvars_node.rb +25 -0
- data/vendor/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
- data/vendor/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
- data/vendor/eac_config/lib/eac_config/load_path.rb +28 -0
- data/vendor/eac_config/lib/eac_config/node.rb +67 -0
- data/vendor/eac_config/lib/eac_config/node_entry.rb +18 -0
- data/vendor/eac_config/lib/eac_config/node_uri.rb +38 -0
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs.rb → eac_config/lib/eac_config/old_configs.rb} +6 -5
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs → eac_config/lib/eac_config/old_configs}/base.rb +5 -5
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs → eac_config/lib/eac_config/old_configs}/file.rb +4 -4
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash.rb +8 -8
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/entry_key_error.rb +1 -1
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/node.rb +2 -2
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/path_search.rb +4 -4
- data/vendor/eac_config/lib/eac_config/version.rb +5 -0
- data/vendor/eac_config/lib/eac_config/yaml_file_node.rb +48 -0
- data/vendor/eac_config/lib/eac_config/yaml_file_node/entry.rb +37 -0
- data/vendor/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
- data/vendor/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
- data/vendor/eac_config/spec/lib/eac_config/envvars_node_spec.rb +40 -0
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb → eac_config/spec/lib/eac_config/old_configs_spec.rb} +2 -2
- data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils → eac_config/spec/lib/eac_config}/paths_hash_spec.rb +6 -6
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +52 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +6 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +4 -0
- data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
- data/vendor/eac_config/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_config/spec/spec_helper.rb +17 -0
- data/vendor/eac_docker/eac_docker.gemspec +3 -2
- data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +1 -0
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +2 -1
- data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_docker/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +23 -9
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +34 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +22 -12
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +43 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/context.rb +31 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +12 -7
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +10 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +12 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +0 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +1 -4
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +26 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/speaker_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb +33 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +27 -0
- data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +1 -1
- metadata +118 -67
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +0 -55
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +0 -50
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +0 -15
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +0 -51
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +0 -35
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console.rb +0 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +0 -38
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +0 -81
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +0 -18
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +0 -27
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +0 -45
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +0 -18
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_doc.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_settings.rb +0 -19
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +0 -154
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +0 -133
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_class_methods.rb +0 -39
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_constants.rb +0 -14
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/list.rb +0 -63
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/node.rb +0 -26
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb +0 -10
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +0 -10
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +0 -110
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +0 -50
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/searcher.rb +0 -55
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_not_found_error.rb +0 -7
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/base.rb +0 -23
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/generic.rb +0 -25
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb +0 -29
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/docopt_runner_spec.rb +0 -136
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/console_speaker_spec.rb +0 -13
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +0 -23
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +0 -35
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/expected_content +0 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/source.template +0 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +0 -30
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file1.template +0 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file2 +0 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path2/subdir1/file3.template +0 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/runner_with/help/builder/alternative'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EacCli
|
@@ -27,7 +28,7 @@ module EacCli
|
|
27
28
|
|
28
29
|
def positional_argument(positional)
|
29
30
|
if positional.subcommand?
|
30
|
-
::
|
31
|
+
::EacCli::RunnerWith::Help::Builder::Alternative::SUBCOMMANDS_MACRO
|
31
32
|
else
|
32
33
|
r = "<#{positional.name}>"
|
33
34
|
r += '...' if positional.repeat?
|
@@ -52,7 +53,7 @@ module EacCli
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def self_usage_arguments
|
55
|
-
[::
|
56
|
+
[::EacCli::RunnerWith::Help::Builder::Alternative::PROGRAM_MACRO] +
|
56
57
|
definition.options_argument.if_present([]) { |_v| ['[options]'] } +
|
57
58
|
self_usage_arguments_options +
|
58
59
|
self_usage_arguments_positional
|
@@ -6,13 +6,26 @@ module EacCli
|
|
6
6
|
class Definition
|
7
7
|
class PositionalArgument
|
8
8
|
DEFAULT_REQUIRED = true
|
9
|
+
DEFAULT_VISIBLE = true
|
9
10
|
|
10
11
|
enable_listable
|
11
|
-
lists.add_symbol :option, :optional, :repeat, :required, :subcommand
|
12
|
+
lists.add_symbol :option, :optional, :repeat, :required, :subcommand, :visible
|
12
13
|
common_constructor :name, :options, default: [{}] do
|
13
14
|
options.assert_valid_keys(self.class.lists.option.values)
|
14
15
|
end
|
15
16
|
|
17
|
+
def build_value(new_value, previous_value)
|
18
|
+
if previous_value.is_a?(::Array)
|
19
|
+
previous_value + [new_value]
|
20
|
+
else
|
21
|
+
new_value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def default_value
|
26
|
+
repeat? ? [] : nil
|
27
|
+
end
|
28
|
+
|
16
29
|
def identifier
|
17
30
|
name.to_s.variableize.to_sym
|
18
31
|
end
|
@@ -39,6 +52,10 @@ module EacCli
|
|
39
52
|
def to_s
|
40
53
|
"#{self.class.name.demodulize}[#{identifier}]"
|
41
54
|
end
|
55
|
+
|
56
|
+
def visible?
|
57
|
+
options.key?(OPTION_VISIBLE) ? options.fetch(OPTION_VISIBLE) : DEFAULT_VISIBLE
|
58
|
+
end
|
42
59
|
end
|
43
60
|
end
|
44
61
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
class OldConfigs
|
7
|
+
require_sub __FILE__
|
8
|
+
enable_speaker
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def entry_key_to_envvar_name(entry_key)
|
12
|
+
::EacCli::OldConfigs::EntryReader.entry_key_to_envvar_name(entry_key)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :configs
|
17
|
+
|
18
|
+
def initialize(configs_key, options = {})
|
19
|
+
options.assert_argument(::Hash, 'options')
|
20
|
+
@configs = ::EacConfig::OldConfigs.new(configs_key, options.merge(autosave: true))
|
21
|
+
end
|
22
|
+
|
23
|
+
def read_password(entry_key, options = {})
|
24
|
+
::EacCli::OldConfigs::PasswordEntryReader.new(self, entry_key, options).read
|
25
|
+
end
|
26
|
+
|
27
|
+
def read_entry(entry_key, options = {})
|
28
|
+
::EacCli::OldConfigs::EntryReader.new(self, entry_key, options).read
|
29
|
+
end
|
30
|
+
|
31
|
+
def store_passwords?
|
32
|
+
::EacCli::OldConfigs::StorePasswordsEntryReader.new(self) == 'yes'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/old_configs/read_entry_options'
|
4
|
+
require 'eac_config/paths_hash'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
class OldConfigs
|
9
|
+
class EntryReader
|
10
|
+
enable_speaker
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def entry_key_to_envvar_name(entry_key)
|
14
|
+
path = if entry_key.is_a?(::Array)
|
15
|
+
entry_key
|
16
|
+
else
|
17
|
+
::EacConfig::PathsHash.parse_entry_key(entry_key)
|
18
|
+
end
|
19
|
+
path.join('_').gsub(/[^a-z0-9_]/i, '').gsub(/\A_+/, '').gsub(/_+\z/, '')
|
20
|
+
.gsub(/_{2,}/, '_').upcase
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
common_constructor :console_configs, :entry_key, :options do
|
25
|
+
self.options = ::EacCli::OldConfigs::ReadEntryOptions.new(options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def read
|
29
|
+
%w[envvars storage console].each do |suffix|
|
30
|
+
value = send("read_from_#{suffix}")
|
31
|
+
return value if value.present?
|
32
|
+
end
|
33
|
+
return nil unless options[:required]
|
34
|
+
|
35
|
+
raise "No value found for entry \"#{entry_key}\""
|
36
|
+
end
|
37
|
+
|
38
|
+
def read_from_storage
|
39
|
+
console_configs.configs.read_entry(entry_key)
|
40
|
+
end
|
41
|
+
|
42
|
+
def read_from_envvars
|
43
|
+
return if options[:noenv]
|
44
|
+
|
45
|
+
env_entry_key = self.class.entry_key_to_envvar_name(entry_key)
|
46
|
+
return unless ENV.key?(env_entry_key)
|
47
|
+
|
48
|
+
ENV.fetch(env_entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
|
49
|
+
end
|
50
|
+
|
51
|
+
def read_from_console
|
52
|
+
return if options[:noinput]
|
53
|
+
|
54
|
+
options[:before_input].if_present(&:call)
|
55
|
+
entry_value = looped_entry_value_from_input
|
56
|
+
console_configs.configs.write_entry(entry_key, entry_value) if options[:store]
|
57
|
+
entry_value
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def looped_entry_value_from_input
|
63
|
+
loop do
|
64
|
+
entry_value = entry_value_from_input(entry_key, options)
|
65
|
+
next if entry_value.blank?
|
66
|
+
next if options[:validator] && !options[:validator].call(entry_value)
|
67
|
+
|
68
|
+
return entry_value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def entry_value_from_input(entry_key, options)
|
73
|
+
entry_value = input("Value for entry \"#{entry_key}\"",
|
74
|
+
options.request_input_options)
|
75
|
+
warn('Entered value is blank') if entry_value.blank?
|
76
|
+
entry_value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/old_configs/entry_reader'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
class OldConfigs
|
7
|
+
class PasswordEntryReader < ::EacCli::OldConfigs::EntryReader
|
8
|
+
ENTRY_KEY = 'core.store_passwords'
|
9
|
+
|
10
|
+
def initialize(console_configs, entry_key, options = {})
|
11
|
+
super(console_configs, entry_key, options.merge(noecho: true,
|
12
|
+
store: console_configs.store_passwords?))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
class OldConfigs
|
7
|
+
class ReadEntryOptions
|
8
|
+
enable_simple_cache
|
9
|
+
common_constructor :options do
|
10
|
+
self.options = options.to_h.symbolize_keys
|
11
|
+
.assert_valid_keys(DEFAULT_VALUES.keys).freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
DEFAULT_VALUES = {
|
15
|
+
before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
|
16
|
+
required: true, store: true, validator: nil
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
delegate :to_h, to: :options
|
20
|
+
|
21
|
+
def [](key)
|
22
|
+
values.fetch(key.to_sym)
|
23
|
+
end
|
24
|
+
|
25
|
+
def request_input_options
|
26
|
+
values.slice(:bool, :list, :noecho)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def values_uncached
|
32
|
+
consumer = options.to_options_consumer
|
33
|
+
r = {}
|
34
|
+
DEFAULT_VALUES.each do |key, default_value|
|
35
|
+
value = consumer.consume(key)
|
36
|
+
value = default_value if value.nil?
|
37
|
+
r[key] = value
|
38
|
+
end
|
39
|
+
consumer.validate
|
40
|
+
r
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/old_configs/entry_reader'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
class OldConfigs
|
7
|
+
class StorePasswordsEntryReader < ::EacCli::OldConfigs::EntryReader
|
8
|
+
ENTRY_KEY = 'core.store_passwords'
|
9
|
+
|
10
|
+
def initialize(console_configs)
|
11
|
+
super(console_configs, ENTRY_KEY,
|
12
|
+
before_input: -> { banner },
|
13
|
+
validator: ->(entry_value) { %w[yes no].include?(entry_value) }
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def banner
|
18
|
+
infom 'Do you wanna to store passwords?'
|
19
|
+
infom 'Warning: the passwords will be store in clear text in ' \
|
20
|
+
"\"#{console_configs.configs.storage_path}\""
|
21
|
+
infom 'Enter "yes" or "no"'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/config'
|
4
|
+
require 'eac_config/envvars_node'
|
5
|
+
require 'eac_config/yaml_file_node'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
|
8
|
+
module EacCli
|
9
|
+
class OldConfigsBridge < ::EacCli::Config
|
10
|
+
ENTRY_KEY = 'core.store_passwords'
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def new_configs_path(configs_key, options)
|
14
|
+
options[:storage_path] || ::File.join(ENV['HOME'], '.config', configs_key, 'settings.yml')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(configs_key, options = {})
|
19
|
+
options.assert_argument(::Hash, 'options')
|
20
|
+
envvar_node = ::EacConfig::EnvvarsNode.new
|
21
|
+
file_node = ::EacConfig::YamlFileNode.new(self.class.new_configs_path(configs_key, options))
|
22
|
+
envvar_node.load_path.push(file_node.url)
|
23
|
+
envvar_node.write_node = file_node
|
24
|
+
super(envvar_node)
|
25
|
+
end
|
26
|
+
|
27
|
+
def read_entry(entry_key, options = {})
|
28
|
+
entry(entry_key, options).value
|
29
|
+
end
|
30
|
+
|
31
|
+
def read_password(entry_key, options = {})
|
32
|
+
entry(entry_key, options.merge(noecho: true, store: store_passwords?)).value
|
33
|
+
end
|
34
|
+
|
35
|
+
def store_passwords?
|
36
|
+
read_entry(ENTRY_KEY, bool: true)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -14,7 +14,9 @@ module EacCli
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_short_option(char)
|
17
|
-
alternative.options.find
|
17
|
+
alternative.options.find do |option|
|
18
|
+
short_without_prefix(option.short).if_present(false) { |v| v == char }
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def short_option_collect_argv_value
|
@@ -37,7 +39,7 @@ module EacCli
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def short_without_prefix(short)
|
40
|
-
short.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
42
|
+
short.to_s.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -24,11 +24,7 @@ module EacCli
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def collect(option, value)
|
27
|
-
|
28
|
-
data[option] << value
|
29
|
-
else
|
30
|
-
data[option] = value
|
31
|
-
end
|
27
|
+
data[option] = option.build_value(value, data[option])
|
32
28
|
end
|
33
29
|
|
34
30
|
def supplied?(option)
|
@@ -42,18 +38,8 @@ module EacCli
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def default_values
|
45
|
-
definition.options.each { |option| data[option] =
|
46
|
-
definition.positional.each
|
47
|
-
data[positional] = positional_default_value(positional)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def option_default_value(option)
|
52
|
-
option.argument? ? nil : false
|
53
|
-
end
|
54
|
-
|
55
|
-
def positional_default_value(positional)
|
56
|
-
positional.repeat? ? [] : nil
|
41
|
+
definition.options.each { |option| data[option] = option.default_value }
|
42
|
+
definition.positional.each { |positional| data[positional] = positional.default_value }
|
57
43
|
end
|
58
44
|
end
|
59
45
|
end
|
@@ -3,14 +3,15 @@
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'eac_cli/runner'
|
5
5
|
require 'eac_cli/runner_with'
|
6
|
+
require 'eac_cli/runner_with_set'
|
6
7
|
|
7
8
|
class Object
|
8
9
|
def runner_with(*runners, &block)
|
9
10
|
include ::EacCli::Runner
|
10
11
|
enable_simple_cache
|
11
|
-
|
12
|
+
enable_speaker
|
12
13
|
runners.each do |runner|
|
13
|
-
include
|
14
|
+
include ::EacCli::RunnerWithSet.default.item_to_module(runner)
|
14
15
|
end
|
15
16
|
runner_definition(&block) if block
|
16
17
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/definition'
|
4
|
-
require 'eac_cli/docopt/runner_extension'
|
5
4
|
require 'eac_cli/parser'
|
6
5
|
require 'eac_ruby_utils/core_ext'
|
7
6
|
|
@@ -43,57 +42,8 @@ module EacCli
|
|
43
42
|
|
44
43
|
extend AfterClassMethods
|
45
44
|
include InstanceMethods
|
46
|
-
::EacCli::Docopt::RunnerExtension.check(self)
|
47
45
|
include ActiveSupport::Callbacks
|
48
46
|
define_callbacks :run
|
49
47
|
end
|
50
|
-
|
51
|
-
module AfterClassMethods
|
52
|
-
def create(*runner_context_args)
|
53
|
-
r = new
|
54
|
-
r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
|
55
|
-
r
|
56
|
-
end
|
57
|
-
|
58
|
-
def run(*runner_context_args)
|
59
|
-
r = create(*runner_context_args)
|
60
|
-
r.run_run
|
61
|
-
r
|
62
|
-
end
|
63
|
-
|
64
|
-
def runner_definition(&block)
|
65
|
-
@runner_definition ||= super_runner_definition
|
66
|
-
@runner_definition.instance_eval(&block) if block
|
67
|
-
@runner_definition
|
68
|
-
end
|
69
|
-
|
70
|
-
def super_runner_definition
|
71
|
-
superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
module InstanceMethods
|
76
|
-
def run_run
|
77
|
-
parsed
|
78
|
-
run_callbacks(:run) { run }
|
79
|
-
rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
|
80
|
-
# Do nothing
|
81
|
-
end
|
82
|
-
|
83
|
-
def runner_context
|
84
|
-
return @runner_context if @runner_context
|
85
|
-
|
86
|
-
raise 'Context was required, but was not set yet'
|
87
|
-
end
|
88
|
-
|
89
|
-
def runner_context=(new_runner_context)
|
90
|
-
@runner_context = new_runner_context
|
91
|
-
@parsed = nil
|
92
|
-
end
|
93
|
-
|
94
|
-
def parsed
|
95
|
-
@parsed ||= ::EacCli::Parser.new(self.class.runner_definition, runner_context.argv).parsed
|
96
|
-
end
|
97
|
-
end
|
98
48
|
end
|
99
49
|
end
|