Class: EacCli::OldConfigsBridge
- Defined in:
- lib/eac_cli/old_configs_bridge.rb
Constant Summary collapse
- ENTRY_KEY =
'core.store_passwords'
Instance Attribute Summary
Attributes inherited from Config
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(configs_key, options = {}) ⇒ OldConfigsBridge
constructor
A new instance of OldConfigsBridge.
- #read_entry(entry_key, options = {}) ⇒ Object
- #read_password(entry_key, options = {}) ⇒ Object
- #store_passwords? ⇒ Boolean
Methods inherited from Config
Constructor Details
#initialize(configs_key, options = {}) ⇒ OldConfigsBridge
Returns a new instance of OldConfigsBridge.
16 17 18 19 20 21 22 23 |
# File 'lib/eac_cli/old_configs_bridge.rb', line 16 def initialize(configs_key, = {}) .assert_argument(::Hash, 'options') envvar_node = ::EacConfig::EnvvarsNode.new file_node = ::EacConfig::YamlFileNode.new(self.class.new_configs_path(configs_key, )) envvar_node.load_path.push(file_node.url) envvar_node.write_node = file_node super(envvar_node) end |
Class Method Details
.new_configs_path(configs_key, options) ⇒ Object
11 12 13 |
# File 'lib/eac_cli/old_configs_bridge.rb', line 11 def new_configs_path(configs_key, ) [:storage_path] || ::File.join(ENV['HOME'], '.config', configs_key, 'settings.yml') end |
Instance Method Details
#read_entry(entry_key, options = {}) ⇒ Object
25 26 27 |
# File 'lib/eac_cli/old_configs_bridge.rb', line 25 def read_entry(entry_key, = {}) entry(entry_key, ).value end |
#read_password(entry_key, options = {}) ⇒ Object
29 30 31 |
# File 'lib/eac_cli/old_configs_bridge.rb', line 29 def read_password(entry_key, = {}) entry(entry_key, .merge(noecho: true, store: store_passwords?)).value end |
#store_passwords? ⇒ Boolean
33 34 35 |
# File 'lib/eac_cli/old_configs_bridge.rb', line 33 def store_passwords? read_entry(ENTRY_KEY, bool: true) end |