Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
Provide App.with_local_files
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Feb 24, 2012
1 parent a828fc4 commit 9c3a6e0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/schnitzelpress/app.rb
@@ -1,13 +1,13 @@
module SchnitzelPress
class App < Sinatra::Base
STATIC_PATHS = ["/favicon.ico", "/img", "/js", '/moo.txt']

set :views, ['./views/', File.expand_path('../../views/', __FILE__)]
set :public_folder, File.expand_path('../../public/', __FILE__)

# use SchnitzelPress::Static
use Rack::ShowExceptions
use Rack::Cache
use Rack::StaticCache,
:urls => ["/favicon.ico", "/img", "/js"],
:urls => STATIC_PATHS,
:root => File.expand_path('../../public/', __FILE__)
use Rack::MethodOverride
use Rack::Session::Cookie
Expand Down Expand Up @@ -42,5 +42,12 @@ def cache_for(time)
not_found do
haml :"404"
end

def self.with_local_files
Rack::Cascade.new([
Rack::StaticCache.new(self, :urls => STATIC_PATHS, :root => './public'),
self
])
end
end
end

0 comments on commit 9c3a6e0

Please sign in to comment.