Sha256: 17a9a909491531799f697a3a48146148328b4a7fa842af0238d886fec8766187
Contents?: true
Size: 997 Bytes
Versions: 2
Compression:
Stored size: 997 Bytes
Contents
module Oci8Simple ## # Config will look in three places for your database.yml file. Here is the order: # Dir.pwd + database.yml # Dir.pwd + config/database.yml # ~/.oci8_simple/database.yml # class Config USER_DIR = File.join(ENV["HOME"], ".oci8_simple") def [](key) @raw_config[key] end def initialize load_yaml end def database_yaml_path path = File.join(Dir.pwd, "database.yml") return path if File.exists?(path) path = File.join(Dir.pwd, "config", "database.yml") return path if File.exists?(path) File.join(USER_DIR, "database.yml") end def load_yaml file = database_yaml_path begin @raw_config = YAML.load_file(file) rescue Errno::ENOENT => e raise ConfigError.new <<-ERR File #{file} doesn't exist - use the following template: environment: database: 192.168.1.3:1521/sid username: foo_user password: foobar ERR end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oci8_simple-1.0.1 | lib/oci8_simple/config.rb |
oci8_simple-1.0.0 | lib/oci8_simple/config.rb |