module Regentanz::Cli::Common

Private Instance Methods

find_config(path) click to toggle source
# File lib/regentanz/cli/common.rb, line 23
        def find_config(path)
  candidates = Dir[File.join(path, '.regentanz.{yaml,yml,json}')]
  if candidates.first
    candidates.first
  elsif path != '/'
    find_config(File.expand_path(File.join(path, '..')))
  else
    nil
  end
end
load_config() click to toggle source
# File lib/regentanz/cli/common.rb, line 6
        def load_config
  if (path = find_config('.'))
    config = YAML.load_file(path)
    Array(config['load_path']).each do |extra_load_path|
      if extra_load_path.start_with?('/')
        $LOAD_PATH << extra_load_path
      else
        $LOAD_PATH << File.absolute_path(extra_load_path, File.dirname(path))
      end
    end
    if config['default_region'].nil? && (region = ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'])
      config['default_region'] = region
    end
    config
  end
end