Permalink
Browse files

Use .watchr mtime to determine changes

  • Loading branch information...
Robert Pankowecki (Gavdi)
Robert Pankowecki (Gavdi) committed Apr 18, 2011
1 parent f96ad0d commit 9d1b49b1d409d8320dd537a407f42d7af27172fc
Showing with 12 additions and 4 deletions.
  1. +12 −4 railties/lib/rails/application/bootstrap.rb
@@ -55,9 +55,17 @@ module Bootstrap
initializer :set_clear_dependencies_hook do
unless config.cache_classes
ActionDispatch::Callbacks.after do
ActiveSupport::DescendantsTracker.clear
ActiveSupport::Dependencies.clear
changed_at = Proc.new{ File.new(File.join(Rails.root, '.watchr')).mtime }
last_change = changed_at.call
ActionDispatch::Callbacks.before do
change = changed_at.call
if change > last_change
Rails.logger.info("DETECTED CHANGES")
last_change = change
ActiveSupport::DescendantsTracker.clear
ActiveSupport::Dependencies.clear
end
end
end
end
@@ -73,4 +81,4 @@ module Bootstrap
end
end
end
end
end

0 comments on commit 9d1b49b

Please sign in to comment.