2012-09-27 12:26:50 +02:00
|
|
|
require "rubygems"
|
2013-10-13 01:53:19 +02:00
|
|
|
|
2013-10-15 15:03:48 +02:00
|
|
|
require "rack/rewrite"
|
2013-10-17 05:46:28 +02:00
|
|
|
require "rack/contrib/not_found"
|
|
|
|
require "rack/contrib/try_static"
|
2013-10-13 21:42:08 +02:00
|
|
|
|
2013-10-15 15:03:48 +02:00
|
|
|
use Rack::Rewrite do
|
|
|
|
r301 %r{/docs/yardoc/(.*)}, '/documentation/$1'
|
|
|
|
r301 '/tutorial.html', '/guide'
|
|
|
|
r301 '/download.html', '/install'
|
|
|
|
r301 '/documentation', '/documentation/'
|
|
|
|
r301 '/documentation/_index.html', '/documentation/'
|
2013-10-15 22:53:50 +02:00
|
|
|
r301 '/try', 'http://sassmeister.com'
|
2013-10-15 21:08:20 +02:00
|
|
|
r301 '/try.html', 'http://sassmeister.com'
|
2013-10-25 02:44:23 +02:00
|
|
|
r301 '/about', '/'
|
|
|
|
r301 '/about.html', '/'
|
2013-10-15 15:03:48 +02:00
|
|
|
end
|
2013-10-13 21:42:08 +02:00
|
|
|
|
2013-10-17 05:51:08 +02:00
|
|
|
use Rack::Deflater
|
|
|
|
|
2013-10-15 15:03:48 +02:00
|
|
|
if ENV["HEROKU"].nil? || ENV["HEROKU"] == 'false'
|
|
|
|
require "middleman"
|
2013-10-17 05:46:28 +02:00
|
|
|
|
|
|
|
server = Middleman.server
|
|
|
|
run Rack::Cascade.new([
|
|
|
|
server,
|
|
|
|
lambda {|env| server.call(env.merge!('PATH_INFO' => '/404'))}
|
|
|
|
])
|
2013-10-15 15:03:48 +02:00
|
|
|
else
|
2013-10-17 05:46:28 +02:00
|
|
|
use Rack::TryStatic,
|
|
|
|
:urls => ["/"], :root => 'build', :index => 'index.html',
|
|
|
|
:try => ['.html', '/index.html']
|
2013-10-13 21:42:08 +02:00
|
|
|
|
2013-10-17 05:46:28 +02:00
|
|
|
run Rack::NotFound.new("build/404/index.html")
|
2013-10-13 21:42:08 +02:00
|
|
|
end
|