Created
April 21, 2010 17:32
-
-
Save knzai/374139 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
use Rack::Bug | |
map '/my_sweet_rack_app' | |
run MySweetRackApp.new | |
end | |
map '/' | |
DenyAccessAndRecordRetinaApp.new | |
end |
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
def app | |
eval "Rack::Builder.new {( " + File.read(File.dirname(__FILE__) + '/../config.ru') + "\n )}" | |
end |
Yeah, good idea. In this usage I was handling all my dirname stuff within the app, but not a bad precaution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of Using File.dirname, it is better to change into the directory where config.ru, otherwise if you used File.dirname in the rackup file, it will get the load paths confused: