Skip to content

Commit

Permalink
Minor tweaks to use_in_file_templates! auto loading
Browse files Browse the repository at this point in the history
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
rtomayko committed Jan 18, 2009
1 parent eec7d21 commit 0324732
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion 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/base'
require 'sinatra/main' require 'sinatra/main'
require 'sinatra/compat' require 'sinatra/compat'
Expand Down
2 changes: 1 addition & 1 deletion lib/sinatra/base.rb
Expand Up @@ -796,14 +796,14 @@ def self.configure(*envs)
end end


def self.call(env) def self.call(env)
$LOADED_FEATURES.delete("sinatra.rb")
reload! if reload? reload! if reload?
super super
end end


def self.reload! def self.reload!
@reloading = true @reloading = true
superclass.send :inherited, self superclass.send :inherited, self
$LOADED_FEATURES.delete("sinatra.rb")
::Kernel.load app_file ::Kernel.load app_file
@reloading = false @reloading = false
end end
Expand Down

0 comments on commit 0324732

Please sign in to comment.