Created
August 22, 2012 16:47
-
-
Save abriening/3427366 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# :: is required for ruby 1.9.1 | |
# require_relative will fail in ruby 1.9.2 | |
require ::File.dirname(__FILE__) + '/lib/all' | |
trap("USR2") do | |
puts "Stopping due to timeout..." | |
puts caller | |
exit! 1 | |
end | |
app = Rack::Builder.new do | |
use Heroku::DateHeader | |
map "/_heroku/console" do | |
run Heroku::ConsoleHandler.new | |
end | |
map "/" do | |
use Heroku::LastAccess, "#{Dir.pwd}/tmp" | |
use Heroku::StaticAssetsMiddleware | |
if ::File.exists?('config.ru') | |
eval(::File.read('config.ru'), binding, 'config.ru') | |
elsif ::File.exists?('config/rackup.ru') | |
# NOTE config/rackup.ru is deprecated. use config.ru instead. | |
Dir.chdir('config') | |
eval(::File.read('rackup.ru'), binding, 'rackup.ru') | |
else | |
run Rack::Adapter::Rails.new(:environment => ENV['RAILS_ENV']) | |
end | |
end | |
end | |
run app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment