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
15 16 17 18 19 20 21 22 |
# File 'lib/avm/sources/base/configuration.rb', line 15 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.
27 28 29 |
# File 'lib/avm/sources/base/configuration.rb', line 27 def configuration_paths CONFIGURATION_FILENAMES.map { |filename| path.join(filename) } end |
#configuration_value_to_env_command(value) ⇒ EacRubyUtils::Envs::Command?
32 33 34 35 36 |
# File 'lib/avm/sources/base/configuration.rb', line 32 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>?
39 40 41 42 43 |
# File 'lib/avm/sources/base/configuration.rb', line 39 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].
52 53 54 |
# File 'lib/avm/sources/base/configuration.rb', line 52 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>?
46 47 48 |
# File 'lib/avm/sources/base/configuration.rb', line 46 def read_configuration_as_shell_words(key) configuration_value_to_shell_words(configuration_entry(key).value) end |