eac_cli 0.29.0 → 0.30.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10a1aee26ed2a25555ea82dd01ad541399bb81c022bc9c5485c9745b2bac64ab
4
- data.tar.gz: 6a84576f580b79b3ff347c69a81651896c8a11ad2817e6448e9d7367173afca5
3
+ metadata.gz: 1c6c9d3ac7f26ac1fdc4cbb83a5c7c6b36bd9b293429b17ca63b25b3945d562e
4
+ data.tar.gz: a887a446a8f97edc9c2d4d093a22251a2e51cf47c5656c661c47530d3d3a0c51
5
5
  SHA512:
6
- metadata.gz: 276eb8f31597ed422c7afe949097b7f9ec9991f8d8c4b65a4f0b4662db5903db6e82b5d34a50ee012ae4ba7303dce69e244f4380df1a806977bc7175bedf9506
7
- data.tar.gz: 536d37085cfd346718ac5b583f1112406037bae03de277aa38b2f08a63a7f097fde980c7b02bdb5b6ea7ea48a84c0b1720e6386c8c38b147bb61cb0de3ffd2bc
6
+ metadata.gz: 371e1ab8cb6b93c36ad658168212c344c2c14e92ee783d91fc7d6251b21c85122284e800f1c1797b130df8bee6701e262e50e0894c018108bc55dfc91ba8cada
7
+ data.tar.gz: 7361269780fce5f667541fee9fe3ebbb1248b9335e59f1529f9099872fd0985635197b3c41cfc25f232a921b02c29067e28393983c6e55aba121129343d21ddc
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_config/node_entry'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module EacCli
6
7
  class Config < ::SimpleDelegator
7
- class Entry
8
+ class Entry < ::EacConfig::NodeEntry
8
9
  class Options
9
10
  enable_simple_cache
10
11
  enable_listable
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_cli/speaker/input_requested'
4
+ require 'eac_config/entry/not_found_error'
5
+ require 'eac_config/node_entry'
3
6
  require 'eac_ruby_utils/core_ext'
4
7
 
5
8
  module EacCli
6
9
  class Config < ::SimpleDelegator
7
- class Entry
10
+ class Entry < ::EacConfig::NodeEntry
8
11
  module Undefined
9
12
  private
10
13
 
@@ -19,6 +22,8 @@ module EacCli
19
22
 
20
23
  def undefined_value_no_loop
21
24
  input("Value for entry \"#{path}\"", options.request_input_options)
25
+ rescue ::EacCli::Speaker::InputRequested
26
+ raise ::EacConfig::Entry::NotFoundError, self
22
27
  end
23
28
  end
24
29
  end
@@ -2,21 +2,26 @@
2
2
 
3
3
  require 'eac_cli/speaker'
4
4
  require 'eac_config/entry_path'
5
+ require 'eac_config/node_entry'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
7
8
  module EacCli
8
9
  class Config < ::SimpleDelegator
9
- class Entry
10
+ class Entry < ::EacConfig::NodeEntry
10
11
  require_sub __FILE__, include_modules: true
11
12
  enable_listable
12
13
  enable_simple_cache
13
14
  enable_speaker
14
15
 
15
- common_constructor :config, :path, :options do
16
- self.path = ::EacConfig::EntryPath.assert(path)
16
+ common_constructor :root_node, :path, :options, super_args: -> { [root_node, path] } do
17
17
  self.options = ::EacCli::Config::Entry::Options.new(options)
18
18
  end
19
19
 
20
+ # @return [EacCli::Config]
21
+ def config
22
+ root_node
23
+ end
24
+
20
25
  def value
21
26
  value!
22
27
  end
@@ -18,33 +18,19 @@ module EacCli
18
18
  end
19
19
 
20
20
  def run
21
- on_asserted_speaker do
22
- r = create
23
- begin
24
- r.run_run
25
- rescue ::EacCli::Parser::Error => e
26
- run_parser_error(r, e)
27
- end
28
- r
21
+ r = create
22
+ begin
23
+ r.run_run
24
+ rescue ::EacCli::Parser::Error => e
25
+ run_parser_error(r, e)
29
26
  end
27
+ r
30
28
  end
31
29
 
32
30
  def run_parser_error(runner_instance, error)
33
31
  $stderr.write("#{runner_instance.program_name}: #{error}\n")
34
32
  ::Kernel.exit(PARSER_ERROR_EXIT_CODE)
35
33
  end
36
-
37
- private
38
-
39
- def on_asserted_speaker
40
- if ::EacRubyUtils::Speaker.context.optional_current
41
- yield
42
- else
43
- ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
44
- yield
45
- end
46
- end
47
- end
48
34
  end
49
35
  end
50
36
  end
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Speaker
5
+ class InputRequested < ::RuntimeError
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.29.0'
4
+ VERSION = '0.30.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -51,6 +51,9 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0.107'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.107.1
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +61,9 @@ dependencies:
58
61
  - - "~>"
59
62
  - !ruby/object:Gem::Version
60
63
  version: '0.107'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.107.1
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: eac_ruby_gem_support
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +136,8 @@ files:
130
136
  - lib/eac_cli/runner_with_set.rb
131
137
  - lib/eac_cli/speaker.rb
132
138
  - lib/eac_cli/speaker/constants.rb
139
+ - lib/eac_cli/speaker/input_blocked.rb
140
+ - lib/eac_cli/speaker/input_requested.rb
133
141
  - lib/eac_cli/speaker/list.rb
134
142
  - lib/eac_cli/speaker/options.rb
135
143
  - lib/eac_cli/version.rb