Sha256: 1e89d6f29c0011add8978d09770a83a6d97119ea2126a725fda162622eb0ca18
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
module Capucine class Settings require 'rubygems' require 'yaml' attr_accessor :current_dir attr_accessor :working_dir attr_accessor :external_config attr_accessor :project_name attr_accessor :root_dir attr_accessor :content_dir attr_accessor :user_config_file attr_accessor :conf def initialize self.working_dir = File.expand_path(Dir.getwd) self.project_name = 'capucine' self.root_dir = File.expand_path('../..', __FILE__) self.content_dir = File.expand_path('../../content', __FILE__) self.set_user_config_file return self end def set_user_config_file(file = nil, silent = false) if not file file = File.join self.working_dir, 'capucine.yaml' end if File.exist?(file) self.user_config_file = File.expand_path(file) end self.get_conf return self end def get_conf default = File.join self.content_dir, "default.yaml" self.conf = YAML::load_file(default) if self.user_config_file additional = YAML::load_file(self.user_config_file) end if additional additional.each do |k, v| self.conf[k] = v end end return self end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
capucine-0.2.3 | lib/settings.rb |
capucine-0.2.2 | lib/settings.rb |
capucine-0.2.1 | lib/settings.rb |
capucine-0.2.0 | lib/settings.rb |