module Vominator
Constants
- LOGGER
- VERSION
Public Class Methods
get_config(file='~/.vominator.yaml')
click to toggle source
# File lib/vominator/vominator.rb, line 7 def self.get_config(file='~/.vominator.yaml') config_file = ENV['VOMINATOR_CONFIG'] || File.expand_path(file) if File.exist?(config_file) vominator_config = YAML.load(File.read(config_file)) return vominator_config if vominator_config.kind_of?(Hash) else LOGGER.fatal("Unable to load vominator configuration file from #{config_file}") return false end end
get_key_pair(vominator_config)
click to toggle source
# File lib/vominator/vominator.rb, line 35 def self.get_key_pair(vominator_config) return vominator_config['key_pair_name'] end
get_puke_config(puke_dir)
click to toggle source
# File lib/vominator/vominator.rb, line 18 def self.get_puke_config(puke_dir) if File.exist?(puke_dir) config_file = "#{puke_dir}/config.yaml" puke_config = nil if File.exist?(config_file) puke_config = YAML.load(File.read(config_file)) end else raise("Unable to open puke directory at #{puke_dir}") end if puke_config.kind_of?(Hash) return puke_config else return {} end end
get_puke_variables(environment)
click to toggle source
# File lib/vominator/vominator.rb, line 39 def self.get_puke_variables(environment) if environment data = PUKE_CONFIG[environment] return data else return nil end end
yesno?(prompt: 'Continue?', default: true)
click to toggle source
# File lib/vominator/vominator.rb, line 48 def self.yesno?(prompt: 'Continue?', default: true) a = '' s = default ? '[Y/n]' : '[y/N]' d = default ? 'y' : 'n' until %w[y n].include? a a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase } a = d if a.length == 0 end a == 'y' end