Sha256: c94a6b72310b299e3ddf2b80cbcf35ed17e094f757910ecccae6c12bd9b8b4b3
Contents?: true
Size: 1.27 KB
Versions: 9
Compression:
Stored size: 1.27 KB
Contents
# # Helper library for rails/init.rb. # module Bulldog module Rails class << self def init(config_path, rails) config = read_config(config_path, rails.env) set_logger(config, rails.logger) set_attribute config, :default_path_template set_attribute config, :default_url_template set_attribute config, :convert_path set_attribute config, :identify_path set_attribute config, :ffmpeg_path define_interpolations(rails) end def read_config(path, environment) File.exist?(path) or return {} YAML.load_file(path)[environment] end def set_logger(config, default_logger) case (log_path = config['log_path']) when false Bulldog.logger = nil when nil Bulldog.logger = default_logger else Bulldog.logger = Logger.new(log_path) end end def set_attribute(config, name) value = config[name.to_s] and Bulldog.send("#{name}=", value) end def define_interpolations(rails) Bulldog.to_interpolate(:rails_root){rails.root} Bulldog.to_interpolate(:rails_env){rails.env} Bulldog.to_interpolate(:public_path){rails.public_path} end end end end
Version data entries
9 entries across 9 versions & 1 rubygems