lib/rock_config.rb in rock_config-0.0.0 vs lib/rock_config.rb in rock_config-0.0.1
- old
+ new
@@ -1,18 +1,19 @@
require "rock_config/version"
require "rock_config/environment_detector"
require "rock_config/configuration"
require "rock_config/manager"
+require "rock_config/scanner"
+require "rock_config/yaml_loader"
+require "rock_config/config"
module RockConfig
class ConfigNotFound < Exception; end
class << self
def for(config_name, environment = detect_environment)
- manager.fetch(config_name, environment) do
- raise ConfigNotFound, "Config not found"
- end
+ manager.fetch(config_name, environment)
end
def configure
yield configuration if block_given?
@manager = nil
@@ -26,10 +27,19 @@
detector.detect
end.call
end
def configuration
- @configuration ||= Configuration.new
+ @configuration ||= initialize_configuration
+ end
+
+ def initialize_configuration
+ configuration = Configuration.new
+
+ configuration.scanned_directories << File.join(Dir.pwd, "config")
+ configuration.config_loaders << YamlLoader.new
+
+ configuration
end
def manager
@manager ||= Manager.new(configuration)
end