respond to any unknown requests with index.html

This commit is contained in:
Konstantin Haase 2012-09-14 21:47:00 +02:00
parent 16a6118920
commit 50de5c85d5
2 changed files with 7 additions and 4 deletions

View File

@ -39,7 +39,7 @@ GIT
GIT GIT
remote: git://github.com/travis-ci/travis-core.git remote: git://github.com/travis-ci/travis-core.git
revision: 7b0da75b0a1d4ffd385ffe488dcf1a621aa73905 revision: 73679d7263ded28620dac7815e4aed253a8191d3
specs: specs:
travis-core (0.0.1) travis-core (0.0.1)
actionmailer (~> 3.2.3) actionmailer (~> 3.2.3)

View File

@ -44,6 +44,10 @@ end
use Rack::Deflater if deflate and deflate != '0' use Rack::Deflater if deflate and deflate != '0'
app = proc do |env|
Rack::File.new(nil).tap { |f| f.path = 'public/index.html' }.serving(env)
end
if run_api and run_api != '0' if run_api and run_api != '0'
map api_endpoint.gsub(/:\d+/, '') do map api_endpoint.gsub(/:\d+/, '') do
run Travis::Api::App.new run Travis::Api::App.new
@ -57,9 +61,8 @@ map client_endpoint do
require 'rake-pipeline' require 'rake-pipeline'
require 'rake-pipeline/middleware' require 'rake-pipeline/middleware'
use Rake::Pipeline::Middleware, 'AssetFile' use Rake::Pipeline::Middleware, 'AssetFile'
run app
else else
use Rack::Static, urls: [""], root: 'public', index: 'index.html' run Rack::Cascade.new([Rack::File.new('public'), app])
end end
run proc { |e| Rack::File.new(nil).tap { |f| f.path = 'public/index.html' }.serving(env) }
end end