Module: Avm::Sources::Base::Configuration

Defined in:
lib/avm/sources/base/configuration.rb

Constant Summary collapse

CONFIGURATION_FILENAMES =
%w[.avm.yml .avm.yaml].freeze

Instance Method Summary collapse

Instance Method Details

#read_configuration_as_env_command(key) ⇒ EacRubyUtils::Envs::Command

Utility to read a configuration as a [EacRubyUtils::Envs::Command].

Returns:

  • (EacRubyUtils::Envs::Command)


23
24
25
26
27
# File 'lib/avm/sources/base/configuration.rb', line 23

def read_configuration_as_env_command(key)
  read_configuration_as_shell_words(key).if_present do |v|
    env.command(v).chdir(path)
  end
end

#read_configuration_as_shell_words(key) ⇒ Array<String>?

Returns:

  • (Array<String>, nil)


15
16
17
18
19
# File 'lib/avm/sources/base/configuration.rb', line 15

def read_configuration_as_shell_words(key)
  configuration.entry(key).value.if_present do |v|
    v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
  end
end