diff options
author | Yehuda Katz <wycats@gmail.com> | 2012-04-25 22:45:56 -0500 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2012-04-25 22:45:56 -0500 |
commit | 363a06f351e2d52d3717ea3334c174665ac72103 (patch) | |
tree | 9057780a8144f64ec08b43b6a26dd165e2a80200 /railties/lib/rails/application | |
parent | 568ae222afa855402b94744112434833313f44fd (diff) | |
download | rails-363a06f351e2d52d3717ea3334c174665ac72103.tar.gz rails-363a06f351e2d52d3717ea3334c174665ac72103.tar.bz2 rails-363a06f351e2d52d3717ea3334c174665ac72103.zip |
Routes reloader knows how to reload external files
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/routes_reloader.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index 6f9a200aa9..7f9190b01a 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -3,12 +3,13 @@ require "active_support/core_ext/module/delegation" module Rails class Application class RoutesReloader - attr_reader :route_sets, :paths + attr_reader :route_sets, :paths, :external_routes delegate :execute_if_updated, :execute, :updated?, :to => :updater def initialize - @paths = [] - @route_sets = [] + @paths = [] + @route_sets = [] + @external_routes = [] end def reload! @@ -23,7 +24,12 @@ module Rails def updater @updater ||= begin - updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! } + dirs = @external_routes.inject({}) do |hash, dir| + hash.merge(dir.to_s => ["rb"]) + end + + updater = ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! } + updater.execute updater end |