Sha256: 2cd4bc0da27062242669427a4da9d76c59741e5aacb4624fd6c22da189cb21ae
Contents?: true
Size: 919 Bytes
Versions: 21
Compression:
Stored size: 919 Bytes
Contents
require 'yaml' module Torpedo module Config @@configs=nil def self.load_configs return @@configs if not @@configs.nil? config_file=ENV['TORPEDO_CONFIG_FILE'] if config_file.nil? then config_file=ENV['HOME']+File::SEPARATOR+".torpedo.conf" if not File.exists?(config_file) then config_file="/etc/torpedo.conf" end end if File.exists?(config_file) then configs = YAML.load_file(config_file) || {} @@configs = configs else raise "Failed to load torpedo config file. Please configure /etc/torpedo.conf or create a .torpedo.conf config file in your HOME directory." end @@configs end def self.raise_if_nil_or_empty(options, key) if not options or options[key].nil? or options[key].empty? then raise "Please specify a valid #{key.to_s} parameter." end end end end
Version data entries
21 entries across 21 versions & 1 rubygems