Class: Rails::MongrelServer::RailsConfigurator

Inherits:
Mongrel::Configurator
  • Object
show all
Defined in:
lib/rails/mongrel_server/commands.rb

Instance Method Summary collapse

Instance Method Details

#mount_rails(prefix) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/rails/mongrel_server/commands.rb', line 40

def mount_rails(prefix)
  ENV['RAILS_ENV'] = defaults[:environment]
  ::RAILS_ENV.replace(defaults[:environment]) if defined?(::RAILS_ENV)

  env_location = "#{defaults[:cwd]}/config/environment"
  require env_location

  ActionController::AbstractRequest.relative_url_root = defaults[:prefix]
  uri prefix, :handler => Rails::MongrelServer::RailsHandler.new
end

#setup_mime_typesObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/rails/mongrel_server/commands.rb', line 29

def setup_mime_types
  mime = {}

  if defaults[:mime_map]
    Mongrel.log("Loading additional MIME types from #{defaults[:mime_map]}")
    mime = load_mime_map(defaults[:mime_map], mime)
  end

  mime.each {|k,v| Mongrel::DirHandler::add_mime_type(k,v) }
end