Browse files

Minor tweaks to use_in_file_templates! auto loading

1. Don't add the sinatra lib dir to $: on each reload.
2. Don't remove sinatra.rb from $LOADED_FEATURES unless we're
   reloading.
  • Loading branch information...
1 parent eec7d21 commit 0324732179f8b732abd1790dabce468b3894d756 @rtomayko rtomayko committed Jan 16, 2009
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/sinatra.rb
  2. +1 −1 lib/sinatra/base.rb
View
4 lib/sinatra.rb
@@ -1,4 +1,6 @@
-$LOAD_PATH.unshift File.dirname(__FILE__)
+libdir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
+
require 'sinatra/base'
require 'sinatra/main'
require 'sinatra/compat'
View
2 lib/sinatra/base.rb
@@ -796,14 +796,14 @@ def self.configure(*envs)
end
def self.call(env)
- $LOADED_FEATURES.delete("sinatra.rb")
reload! if reload?
super
end
def self.reload!
@reloading = true
superclass.send :inherited, self
+ $LOADED_FEATURES.delete("sinatra.rb")
::Kernel.load app_file
@reloading = false
end

0 comments on commit 0324732

Please sign in to comment.