-
Notifications
You must be signed in to change notification settings - Fork 27
/
config.ru
40 lines (32 loc) · 1015 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#\ -p 4000
gem 'activesupport'
gem 'serve'
require 'serve'
require 'serve/rack'
require 'sass/plugin/rack'
require 'compass'
# The project root directory
root = ::File.dirname(__FILE__)
# Compass
Compass.add_project_configuration(root + '/config.rb')
Compass.configure_sass_plugin!
# Rack Middleware
use Rack::ShowStatus # Nice looking 404s and other messages
use Rack::ShowExceptions # Nice looking errors
# Because Heroku doesn't allow you to write to the file system,
# if you're not using Heroku in production this condition won't be needed
if ENV['RACK_ENV'] != "production"
use Sass::Plugin::Rack # Compile Sass on the fly
end
# Rack Application
if ENV['SERVER_SOFTWARE'] =~ /passenger/i
# Passendger only needs the adapter
run Serve::RackAdapter.new(root + '/views')
else
# We use Rack::Cascade and Rack::Directory on other platforms to handle static
# assets
run Rack::Cascade.new([
Serve::RackAdapter.new(root + '/views'),
Rack::Directory.new(root + '/public')
])
end