Created
January 28, 2010 01:06
-
-
Save jpr5/288331 to your computer and use it in GitHub Desktop.
Script demonstrating that latest Sinatra doesn't invoke before hooks on static files
This file contains 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
`git clone git://github.com/sinatra/sinatra.git` unless File.exists?('sinatra') | |
`mkdir -p public` | |
`touch public/favicon.ico` | |
$: << 'sinatra/lib' | |
require 'rack' | |
require 'sinatra/base' | |
class Server < ::Sinatra::Base | |
set :public, Dir.pwd + '/public'; enable :static | |
get "/" do "hi" end | |
before { puts "dongs" } | |
after { puts "balls" } | |
end | |
run Server |
This file contains 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
$ rackup -p 9000 | |
dongs | |
balls | |
127.0.0.1 - - [27/Jan/2010 17:33:21] "GET / HTTP/1.1" 200 2 0.0021 | |
balls | |
127.0.0.1 - - [27/Jan/2010 17:33:21] "GET /favicon.ico HTTP/1.1" 200 - 0.0023 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment