Module: Avm::Sources::Base::Configuration
- Defined in:
- lib/avm/sources/base/configuration.rb
Constant Summary collapse
- PARENT_CONFIGURATION_SUFFIX =
%w[subs at].freeze
- CONFIGURATION_FILENAMES =
%w[.avm.yml .avm.yaml].freeze
Instance Method Summary collapse
- #configuration_entry(*entry_args) ⇒ EacConfig::NodeEntry
-
#configuration_paths ⇒ Array<Pathname>
The possible absolute paths for configuration files.
- #configuration_value_to_env_command(value) ⇒ EacRubyUtils::Envs::Command?
- #configuration_value_to_shell_words(value) ⇒ Array<String>?
-
#read_configuration_as_env_command(key) ⇒ EacRubyUtils::Envs::Command
Utility to read a configuration as a [EacRubyUtils::Envs::Command].
- #read_configuration_as_shell_words(key) ⇒ Array<String>?
Instance Method Details
#configuration_entry(*entry_args) ⇒ EacConfig::NodeEntry
13 14 15 16 17 18 19 20 |
# File 'lib/avm/sources/base/configuration.rb', line 13 def configuration_entry(*entry_args) parent_configuration.if_present do |v| parent_entry = v.entry(*entry_args) return parent_entry if parent_entry.found? end configuration.entry(*entry_args) end |
#configuration_paths ⇒ Array<Pathname>
The possible absolute paths for configuration files.
25 26 27 |
# File 'lib/avm/sources/base/configuration.rb', line 25 def configuration_paths CONFIGURATION_FILENAMES.map { |filename| path.join(filename) } end |
#configuration_value_to_env_command(value) ⇒ EacRubyUtils::Envs::Command?
30 31 32 33 34 |
# File 'lib/avm/sources/base/configuration.rb', line 30 def configuration_value_to_env_command(value) return value if value.is_a?(::EacRubyUtils::Envs::Command) configuration_value_to_shell_words(value).if_present { |v| env.command(v).chdir(path) } end |
#configuration_value_to_shell_words(value) ⇒ Array<String>?
37 38 39 40 41 |
# File 'lib/avm/sources/base/configuration.rb', line 37 def configuration_value_to_shell_words(value) return nil if value.blank? value.is_a?(::Enumerable) ? value.map(&:to_s) : ::Shellwords.split(value.to_s) end |
#read_configuration_as_env_command(key) ⇒ EacRubyUtils::Envs::Command
Utility to read a configuration as a [EacRubyUtils::Envs::Command].
50 51 52 |
# File 'lib/avm/sources/base/configuration.rb', line 50 def read_configuration_as_env_command(key) configuration_value_to_env_command(configuration_entry(key).value) end |
#read_configuration_as_shell_words(key) ⇒ Array<String>?
44 45 46 |
# File 'lib/avm/sources/base/configuration.rb', line 44 def read_configuration_as_shell_words(key) configuration_value_to_shell_words(configuration_entry(key).value) end |