270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrkeunless defined?(Rails)
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke require 'pathname'
b27c7f227c8516589a2bd127c0f74338cf56f0b2Julian Kornberger
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke # Set up Rails configuration
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke rails_env = ENV['RAILS_ENV'] || 'production'
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke rails_root = Pathname.new(File.dirname(__FILE__) << '/..')
b27c7f227c8516589a2bd127c0f74338cf56f0b2Julian Kornberger
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke # Load Bundler
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke ENV['BUNDLE_GEMFILE'] = rails_root.join('Gemfile').to_s
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke require 'rubygems'
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke require 'bundler/setup'
435785c59d6d0325778f1e243ed7dc65eb860490Julian Kornberger
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke # Load application settings
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke require rails_root.join('config/initializers/rails_config.rb')
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke # only load basic files, NOT the auxiliaries like hets.yml
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke settings_files = RailsConfig.
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke setting_files(rails_root.join('config'), rails_env)
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke abs_settings_files = settings_files.map { |f| rails_root.join('config', f) }
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke Settings = RailsConfig.load_files(abs_settings_files)
997de9f21fe58b036307d860e9be6e49377da65eTim Reddehase
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke Rails = Struct.new(:env, :root, :logger).new
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke Rails.env = rails_env
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrke Rails.root = rails_root
270a34ef2ffafe5c2d09eaa85555eb37a90eac17Tom Gehrkeend