ehbrs-tools 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/core_ext.rb +4 -0
  3. data/lib/ehbrs/music/album.rb +2 -0
  4. data/{vendor/eac_cli/lib/eac_cli/patches/module.rb → lib/ehbrs/patches.rb} +1 -1
  5. data/lib/ehbrs/runner/fs/selected.rb +79 -0
  6. data/lib/ehbrs/runner/fs/used_space.rb +1 -2
  7. data/lib/ehbrs/runner/music/selected.rb +9 -46
  8. data/lib/ehbrs/tools/version.rb +1 -1
  9. data/lib/ehbrs/videos/unsupported/check_support.rb +12 -8
  10. data/vendor/avm-apps/Gemfile +5 -0
  11. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  12. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  13. data/vendor/avm-apps/lib/avm/apps/config.rb +19 -0
  14. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  15. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  16. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  17. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
  18. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
  19. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
  20. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
  21. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  22. data/vendor/avm-apps/spec/rubocop_spec.rb +3 -0
  23. data/vendor/avm-apps/spec/spec_helper.rb +103 -0
  24. data/vendor/eac_cli/eac_cli.gemspec +1 -2
  25. data/vendor/eac_cli/lib/eac_cli/config.rb +16 -0
  26. data/vendor/eac_cli/lib/eac_cli/config/entry.rb +48 -0
  27. data/vendor/eac_cli/lib/eac_cli/config/entry/options.rb +57 -0
  28. data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
  29. data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +3 -2
  30. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +6 -1
  31. data/vendor/eac_cli/lib/eac_cli/old_configs.rb +0 -1
  32. data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +2 -2
  33. data/vendor/eac_cli/lib/eac_cli/old_configs_bridge.rb +39 -0
  34. data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -2
  35. data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +20 -3
  36. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +5 -1
  37. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +9 -4
  38. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +73 -0
  39. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +56 -0
  40. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -4
  41. data/vendor/eac_cli/lib/eac_cli/speaker.rb +15 -19
  42. data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +1 -1
  43. data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +1 -1
  44. data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
  45. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  46. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -1
  47. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +0 -1
  48. data/vendor/eac_cli/spec/lib/eac_cli/speaker_spec.rb +5 -9
  49. data/vendor/eac_config/Gemfile +5 -0
  50. data/vendor/eac_config/eac_config.gemspec +19 -0
  51. data/vendor/eac_config/lib/eac_config.rb +7 -0
  52. data/vendor/eac_config/lib/eac_config/entry.rb +49 -0
  53. data/vendor/eac_config/lib/eac_config/entry_path.rb +41 -0
  54. data/vendor/eac_config/lib/eac_config/envvars_node.rb +25 -0
  55. data/vendor/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
  56. data/vendor/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
  57. data/vendor/eac_config/lib/eac_config/load_path.rb +28 -0
  58. data/vendor/eac_config/lib/eac_config/node.rb +67 -0
  59. data/vendor/eac_config/lib/eac_config/node_entry.rb +18 -0
  60. data/vendor/eac_config/lib/eac_config/node_uri.rb +38 -0
  61. data/vendor/eac_config/lib/eac_config/old_configs.rb +75 -0
  62. data/vendor/eac_config/lib/eac_config/old_configs/base.rb +43 -0
  63. data/vendor/eac_config/lib/eac_config/old_configs/file.rb +47 -0
  64. data/vendor/eac_config/lib/eac_config/paths_hash.rb +56 -0
  65. data/vendor/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +8 -0
  66. data/vendor/eac_config/lib/eac_config/paths_hash/node.rb +67 -0
  67. data/vendor/eac_config/lib/eac_config/paths_hash/path_search.rb +39 -0
  68. data/vendor/eac_config/lib/eac_config/version.rb +5 -0
  69. data/vendor/eac_config/lib/eac_config/yaml_file_node.rb +48 -0
  70. data/vendor/eac_config/lib/eac_config/yaml_file_node/entry.rb +37 -0
  71. data/vendor/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
  72. data/vendor/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
  73. data/vendor/eac_config/spec/lib/eac_config/envvars_node_spec.rb +40 -0
  74. data/vendor/eac_config/spec/lib/eac_config/old_configs_spec.rb +46 -0
  75. data/vendor/eac_config/spec/lib/eac_config/paths_hash_spec.rb +88 -0
  76. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +52 -0
  77. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +6 -0
  78. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
  79. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +4 -0
  80. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
  81. data/vendor/eac_config/spec/rubocop_spec.rb +3 -0
  82. data/vendor/eac_config/spec/spec_helper.rb +17 -0
  83. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
  84. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +23 -9
  85. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +34 -0
  86. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +2 -2
  87. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +19 -7
  88. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +8 -1
  89. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/context.rb +31 -0
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +12 -7
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +10 -2
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  99. data/vendor/{eac_cli/spec/lib → eac_ruby_utils/spec/lib/eac_ruby_utils/patches}/module/speaker_spec.rb +2 -2
  100. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +18 -0
  101. metadata +69 -18
  102. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +0 -71
  103. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +0 -50
  104. data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +0 -15
  105. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +0 -51
  106. data/vendor/eac_cli/lib/eac_cli/docopt_runner.rb +0 -43
  107. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_class_methods.rb +0 -16
  108. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_doc.rb +0 -23
  109. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_settings.rb +0 -17
  110. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_subcommands.rb +0 -152
  111. data/vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb +0 -10
  112. data/vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb +0 -37
  113. data/vendor/eac_cli/lib/eac_cli/speaker/node.rb +0 -24
  114. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +0 -35
  115. data/vendor/eac_cli/spec/lib/eac_cli/docopt_runner_spec.rb +0 -136
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches/eac_ruby_gems_utils/gem'
4
+ require 'i18n'
5
+
6
+ module Avm
7
+ module Apps
8
+ module Sources
9
+ class Configuration < ::EacConfig::OldConfigs
10
+ LOCALE_KEY = :locale
11
+
12
+ def locale
13
+ read_entry(LOCALE_KEY) || ::I18n.default_locale
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Apps
5
+ module Sources
6
+ class Configuration < ::EacConfig::OldConfigs
7
+ RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
8
+ RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
9
+
10
+ def rubocop_command
11
+ read_command(RUBOCOP_COMMAND_KEY)
12
+ end
13
+
14
+ def rubocop_gemfile
15
+ gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
16
+ return nil if gemfile_path.blank?
17
+
18
+ gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
19
+ return gemfile_path if gemfile_path.file?
20
+
21
+ raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches/eac_ruby_gems_utils/gem'
4
+
5
+ module Avm
6
+ module Apps
7
+ module Sources
8
+ class Configuration < ::EacConfig::OldConfigs
9
+ BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
10
+ TEST_COMMAND_KEY = 'test.command'
11
+
12
+ def any_test_command
13
+ bundle_test_command || test_command
14
+ end
15
+
16
+ def test_command
17
+ read_command(TEST_COMMAND_KEY)
18
+ end
19
+
20
+ def bundle_test_command
21
+ read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
22
+ args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
23
+ ::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Apps
5
+ VERSION = '0.4.0'
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ # # This allows you to limit a spec run to individual examples or groups
52
+ # # you care about by tagging them with `:focus` metadata. When nothing
53
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
54
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
55
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
56
+ # config.filter_run_when_matching :focus
57
+ #
58
+ # # Allows RSpec to persist some state between runs in order to support
59
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
60
+ # # you configure your source control system to ignore this file.
61
+ # config.example_status_persistence_file_path = "spec/examples.txt"
62
+ #
63
+ # # Limits the available syntax to the non-monkey patched syntax that is
64
+ # # recommended. For more details, see:
65
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
66
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
68
+ # config.disable_monkey_patching!
69
+ #
70
+ # # This setting enables warnings. It's recommended, but in some cases may
71
+ # # be too noisy due to issues in dependencies.
72
+ # config.warnings = true
73
+ #
74
+ # # Many RSpec users commonly either run the entire suite or an individual
75
+ # # file, and it's useful to allow more verbose output when running an
76
+ # # individual spec file.
77
+ # if config.files_to_run.one?
78
+ # # Use the documentation formatter for detailed output,
79
+ # # unless a formatter has already been configured
80
+ # # (e.g. via a command-line flag).
81
+ # config.default_formatter = "doc"
82
+ # end
83
+ #
84
+ # # Print the 10 slowest examples and example groups at the
85
+ # # end of the spec run, to help surface which specs are running
86
+ # # particularly slow.
87
+ # config.profile_examples = 10
88
+ #
89
+ # # Run specs in random order to surface order dependencies. If you find an
90
+ # # order dependency and want to debug it, you can fix the order by providing
91
+ # # the seed, which is printed after each run.
92
+ # # --seed 1234
93
+ # config.order = :random
94
+ #
95
+ # # Seed global randomization in this process using the `--seed` CLI option.
96
+ # # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # # test failures related to randomization by passing the same `--seed` value
98
+ # # as the one that triggered the failure.
99
+ # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
103
+ end
@@ -13,9 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*', 'Gemfile']
14
14
 
15
15
  s.add_dependency 'colorize', '~> 0.8.1'
16
- s.add_dependency 'docopt', '~> 0.6.1'
17
16
  s.add_dependency 'eac_config', '~> 0.3'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.64'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.67'
19
18
 
20
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
21
20
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Config
5
+ require_sub __FILE__
6
+ attr_reader :sub
7
+
8
+ def initialize(sub_node)
9
+ @sub = sub_node
10
+ end
11
+
12
+ def entry(path, options = {})
13
+ ::EacCli::Config::Entry.new(self, path, options)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/speaker'
4
+ require 'eac_config/entry_path'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module EacCli
8
+ class Config
9
+ class Entry
10
+ require_sub __FILE__, include_modules: true
11
+ enable_listable
12
+ enable_simple_cache
13
+ enable_speaker
14
+
15
+ common_constructor :config, :path, :options do
16
+ self.path = ::EacConfig::EntryPath.assert(path)
17
+ self.options = ::EacCli::Config::Entry::Options.new(options)
18
+ end
19
+
20
+ def value
21
+ return sub_value_to_return if sub_entry.found?
22
+ return nil unless options.required?
23
+
24
+ puts "|#{sub_entry.path}|"
25
+
26
+ input_value
27
+ end
28
+
29
+ delegate :value=, to: :sub_entry
30
+
31
+ private
32
+
33
+ def sub_value_to_return
34
+ sub_entry.value.presence || ::EacRubyUtils::BlankNotBlank.instance
35
+ end
36
+
37
+ def sub_entry_uncached
38
+ config.sub.entry(path)
39
+ end
40
+
41
+ def input_value_uncached
42
+ r = send("#{options.type}_value")
43
+ sub_entry.value = r if options.store?
44
+ r
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ class Config
7
+ class Entry
8
+ class Options
9
+ enable_simple_cache
10
+ enable_listable
11
+
12
+ lists.add_symbol :type, :undefined
13
+
14
+ DEFAULT_VALUES = {
15
+ before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
16
+ required: true, store: true, type: TYPE_UNDEFINED, validator: nil
17
+ }.freeze
18
+
19
+ lists.add_symbol :option, *DEFAULT_VALUES.keys
20
+
21
+ common_constructor :options do
22
+ self.options = self.class.lists.option.hash_keys_validate!(options)
23
+ end
24
+
25
+ delegate :to_h, to: :options
26
+
27
+ def [](key)
28
+ values.fetch(key.to_sym)
29
+ end
30
+
31
+ def request_input_options
32
+ values.slice(:bool, :list, :noecho)
33
+ end
34
+
35
+ DEFAULT_VALUES.each do |attr, default_value|
36
+ define_method(attr.to_s + ([true, false].include?(default_value) ? '?' : '')) do
37
+ self[attr]
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def values_uncached
44
+ consumer = options.to_options_consumer
45
+ r = {}
46
+ DEFAULT_VALUES.each do |key, default_value|
47
+ value = consumer.consume(key)
48
+ value = default_value if value.nil?
49
+ r[key] = value
50
+ end
51
+ consumer.validate
52
+ r
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ class Config
7
+ class Entry
8
+ module Undefined
9
+ private
10
+
11
+ def undefined_value
12
+ loop do
13
+ entry_value = undefined_value_no_loop
14
+ next unless options[:validator].if_present(true) { |v| v.call(entry_value) }
15
+
16
+ return entry_value
17
+ end
18
+ end
19
+
20
+ def undefined_value_no_loop
21
+ input("Value for entry \"#{path}\"", options.request_input_options)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -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
- ::EacCli::DocoptRunner::SUBCOMMANDS_MACRO
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
- [::EacCli::DocoptRunner::PROGRAM_MACRO] +
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,9 +6,10 @@ 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
@@ -51,6 +52,10 @@ module EacCli
51
52
  def to_s
52
53
  "#{self.class.name.demodulize}[#{identifier}]"
53
54
  end
55
+
56
+ def visible?
57
+ options.key?(OPTION_VISIBLE) ? options.fetch(OPTION_VISIBLE) : DEFAULT_VISIBLE
58
+ end
54
59
  end
55
60
  end
56
61
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'eac_cli/patches/module/speaker'
5
4
 
6
5
  module EacCli
7
6
  class OldConfigs
@@ -70,8 +70,8 @@ module EacCli
70
70
  end
71
71
 
72
72
  def entry_value_from_input(entry_key, options)
73
- entry_value = request_input("Value for entry \"#{entry_key}\"",
74
- options.request_input_options)
73
+ entry_value = input("Value for entry \"#{entry_key}\"",
74
+ options.request_input_options)
75
75
  warn('Entered value is blank') if entry_value.blank?
76
76
  entry_value
77
77
  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