eac_ruby_utils 0.49.0 → 0.49.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 950ee0e703e04a530326ce6df19fa23a921061a3cc046d1ec880e1c078fd30fa
|
4
|
+
data.tar.gz: 3e81efb81e7fc9e8e5d23f1e5228eb6767be645a5ed1abefcb1d5551c39dc4b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05690c1726e671c20b7a85e1c0ac44387c085ff2cba3d7381a7ffab7850f056a014f301d2360c8610cd266879ac368af0f27a4c7738ae9a53306442316bbed6
|
7
|
+
data.tar.gz: 256ad147935d38435623279add15c7ae78de97357864cc0d065aaed9b3e2095a4ded3a63ca51ac70c966900f8dff2acc07d887656140cfa65068f5ced27b5eef
|
@@ -1,16 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/common_constructor'
|
4
3
|
require 'eac_ruby_utils/configs'
|
5
|
-
require 'eac_ruby_utils/
|
6
|
-
require 'eac_ruby_utils/options_consumer'
|
7
|
-
require 'eac_ruby_utils/patches/object/asserts'
|
8
|
-
require 'eac_ruby_utils/simple_cache'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
9
5
|
|
10
6
|
module EacRubyUtils
|
11
7
|
module Console
|
12
8
|
class Configs
|
13
|
-
|
9
|
+
require_sub __FILE__
|
10
|
+
enable_console_speaker
|
14
11
|
|
15
12
|
class << self
|
16
13
|
def entry_key_to_envvar_name(entry_key)
|
@@ -34,7 +31,7 @@ module EacRubyUtils
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def read_password(entry_key, options = {})
|
37
|
-
options = options.merge(noecho: true)
|
34
|
+
options = ReadEntryOptions.new(options.merge(noecho: true))
|
38
35
|
if store_passwords?
|
39
36
|
read_entry(entry_key, options)
|
40
37
|
else
|
@@ -101,38 +98,6 @@ module EacRubyUtils
|
|
101
98
|
warn('Entered value is blank') if entry_value.blank?
|
102
99
|
entry_value
|
103
100
|
end
|
104
|
-
|
105
|
-
class ReadEntryOptions
|
106
|
-
include ::EacRubyUtils::SimpleCache
|
107
|
-
::EacRubyUtils::CommonConstructor.new(:options).setup_class(self)
|
108
|
-
|
109
|
-
DEFAULT_VALUES = {
|
110
|
-
before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
|
111
|
-
required: true, validator: nil
|
112
|
-
}.freeze
|
113
|
-
|
114
|
-
def [](key)
|
115
|
-
values.fetch(key.to_sym)
|
116
|
-
end
|
117
|
-
|
118
|
-
def request_input_options
|
119
|
-
values.slice(:bool, :list, :noecho)
|
120
|
-
end
|
121
|
-
|
122
|
-
private
|
123
|
-
|
124
|
-
def values_uncached
|
125
|
-
consumer = ::EacRubyUtils::OptionsConsumer.new(options)
|
126
|
-
r = {}
|
127
|
-
DEFAULT_VALUES.each do |key, default_value|
|
128
|
-
value = consumer.consume(key)
|
129
|
-
value = default_value if value.nil?
|
130
|
-
r[key] = value
|
131
|
-
end
|
132
|
-
consumer.validate
|
133
|
-
r
|
134
|
-
end
|
135
|
-
end
|
136
101
|
end
|
137
102
|
end
|
138
103
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Console
|
7
|
+
class Configs
|
8
|
+
class ReadEntryOptions
|
9
|
+
enable_simple_cache
|
10
|
+
common_constructor :options
|
11
|
+
|
12
|
+
DEFAULT_VALUES = {
|
13
|
+
before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
|
14
|
+
required: true, validator: nil
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
def [](key)
|
18
|
+
values.fetch(key.to_sym)
|
19
|
+
end
|
20
|
+
|
21
|
+
def request_input_options
|
22
|
+
values.slice(:bool, :list, :noecho)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def values_uncached
|
28
|
+
consumer = options.to_options_consumer
|
29
|
+
r = {}
|
30
|
+
DEFAULT_VALUES.each do |key, default_value|
|
31
|
+
value = consumer.consume(key)
|
32
|
+
value = default_value if value.nil?
|
33
|
+
r[key] = value
|
34
|
+
end
|
35
|
+
consumer.validate
|
36
|
+
r
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.49.
|
4
|
+
version: 0.49.1
|
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: 2020-10
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/eac_ruby_utils/configs/file.rb
|
120
120
|
- lib/eac_ruby_utils/console.rb
|
121
121
|
- lib/eac_ruby_utils/console/configs.rb
|
122
|
+
- lib/eac_ruby_utils/console/configs/read_entry_options.rb
|
122
123
|
- lib/eac_ruby_utils/console/docopt_runner.rb
|
123
124
|
- lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb
|
124
125
|
- lib/eac_ruby_utils/console/docopt_runner/_doc.rb
|