Module: Mongrel::UploadProgressConfig

Defined in:
lib/haikulearning_mongrel_upload_progress/init.rb

Defined Under Namespace

Classes: NoConfigSpecified

Class Method Summary collapse

Class Method Details

.options(root_dir) ⇒ Object

Raises:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/haikulearning_mongrel_upload_progress/init.rb', line 95

def options(root_dir)
  opts = YAML.load_file(File.join(root_dir, 'mongrel_upload_progress.yml')) rescue nil
  raise NoConfigSpecified.new("No config file exists at #{File.join(root_dir, 'config/mongrel_upload_progress.yml').inspect}") if opts.nil? || opts.empty?
  
  begin
    ::RAILS_ENV
  rescue
    raise NoConfigSpecified.new("The ::RAILS_ENV constant must be set (Sorry, no Rails 3 support yet.)")
  end
  
  opts = opts[::RAILS_ENV] rescue nil
  raise NoConfigSpecified.new("No config information exists for the #{::RAILS_ENV} environment.") if opts.nil? || opts.empty?
  
  opts
end