public
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatrarb.com
Clone URL: git://github.com/cschneid/sinatra.git
Kernel.load $0 breaks when $0 is not the file with sinatra routes, add an 
:app_file option to define which file to reload
cschneid (author)
Sun May 18 10:18:42 -0700 2008
commit  174d9c8a25b80eef9b92dd4054579ed5788e81e1
tree    eff1649540cee477ebd44f22e692f24f85660efe
parent  3588b55bc17f1e8ab359241aa5a532dd25cc869b
0
lib/sinatra.rb 100644 →
...
848
849
850
851
 
 
852
853
854
...
932
933
934
935
 
936
937
938
...
848
849
850
 
851
852
853
854
855
...
933
934
935
 
936
937
938
939
0
@@ -848,7 +848,8 @@ module Sinatra
0
         :views => root + '/views',
0
         :public => root + '/public',
0
         :sessions => false,
0
- :logging => true
0
+ :logging => true,
0
+ :app_file => $0
0
       }
0
     end
0
     
0
@@ -932,7 +933,7 @@ module Sinatra
0
       @reloading = true
0
       clearables.each(&:clear)
0
       load_default_events!
0
- Kernel.load $0
0
+ Kernel.load Sinatra.options.app_file
0
       @reloading = false
0
       Environment.setup!
0
     end

Comments

  • How does this affect the the options that need root? Maybe we can consider a new way/time to load options. The problem with the way we do it now is that tests don’t pickup options until after the app is loaded. This mean the :test env doesn’t know it’s in test unless you require sinatra/test/spec then your app which is a nasty hack. could you investigate a little more? I would really appreciate that.

  • _;;;; I ran into this exact problem. Haha, wow took half a day to get a simple test running.