Skip to content

Commit

Permalink
Sometimes require "foo" returns nils also if the file was loaded corr…
Browse files Browse the repository at this point in the history
…ectly without exceptions or any thing. So is necessary to prevent a false negative #567
  • Loading branch information
DAddYE committed Jun 7, 2011
1 parent 7c2cb57 commit 55a5945
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rdoc
Expand Up @@ -15,7 +15,7 @@
* Change move Padrino.current_controller in public apis
* Enhancement, now Padrino::Reloader works without ActiveSupport::Dependency or with it disabled #567 [Thanks Bernerdschaefer]
* Cleanup padrino-core dependencies now we have less less ActiveSupport dependencies, we are very very thin finally!
* Fix bundler gem dependency mismatch #556
* Fix bundler gem dependency mismatch #553

== 0.9.29

Expand Down
9 changes: 4 additions & 5 deletions padrino-core/lib/padrino-core/reloader.rb
Expand Up @@ -138,20 +138,19 @@ def safe_load(file, options={})
logger.debug "Reloading #{file}" if reload
$LOADED_FEATURES.delete(file)
verbosity_was, $-v = $-v, nil
loaded = require(file)
loaded = false
require(file)
loaded = true
MTIMES[file] = File.mtime(file)
rescue SyntaxError => e
logger.error "Cannot require #{file} because of syntax error: #{e.message}"
ensure
$-v = verbosity_was

new_constants = (ObjectSpace.classes - klasses).uniq

if loaded
# Store the file details
LOADED_CLASSES[file] = new_constants
LOADED_FILES[file] = ($LOADED_FEATURES - files - [file]).uniq

# Track only features in our Padrino.root
LOADED_FILES[file].delete_if { |feature| !in_root?(feature) }
else
Expand Down Expand Up @@ -245,4 +244,4 @@ def call(env)
end
end
end # Reloader
end # Padrino
end # Padrino

0 comments on commit 55a5945

Please sign in to comment.