diff options
author | José Valim <jose.valim@gmail.com> | 2012-06-29 17:39:50 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-06-29 17:44:10 +0200 |
commit | 5e7d6bba79393de0279917f93b82f3b7b176f4b5 (patch) | |
tree | 1e9c6c8c183ba326efa33087d9b590c9196acec3 /railties/lib | |
parent | 50b6110106a6e467f5e5f6303700522cebc60a9c (diff) | |
download | rails-5e7d6bba79393de0279917f93b82f3b7b176f4b5.tar.gz rails-5e7d6bba79393de0279917f93b82f3b7b176f4b5.tar.bz2 rails-5e7d6bba79393de0279917f93b82f3b7b176f4b5.zip |
Revert "Allow loading external route files from the router"
This reverts commit 6acebb38bc0637bc05c19d87f8767f16ce79189b.
Usage of this feature did not reveal any improvement in existing apps.
Conflicts:
actionpack/lib/action_dispatch/routing/mapper.rb
guides/source/routing.textile
railties/lib/rails/engine.rb
railties/lib/rails/paths.rb
railties/test/paths_test.rb
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application/routes_reloader.rb | 13 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 7 | ||||
-rw-r--r-- | railties/lib/rails/engine/configuration.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/paths.rb | 10 |
4 files changed, 6 insertions, 25 deletions
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index 19f616ec50..6f9a200aa9 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -3,13 +3,12 @@ require "active_support/core_ext/module/delegation" module Rails class Application class RoutesReloader - attr_reader :route_sets, :paths, :external_routes + attr_reader :route_sets, :paths delegate :execute_if_updated, :execute, :updated?, :to => :updater def initialize - @paths = [] - @route_sets = [] - @external_routes = [] + @paths = [] + @route_sets = [] end def reload! @@ -24,11 +23,7 @@ module Rails def updater @updater ||= begin - dirs = @external_routes.each_with_object({}) do |dir, hash| - hash[dir.to_s] = %w(rb) - end - - updater = ActiveSupport::FileUpdateChecker.new(paths, dirs) { reload! } + updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! } updater.execute updater end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 309d265477..383c159d3d 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -508,10 +508,7 @@ module Rails # Defines the routes for this engine. If a block is given to # routes, it is appended to the engine. def routes - @routes ||= ActionDispatch::Routing::RouteSet.new.tap do |routes| - routes.draw_paths.concat paths["config/routes"].paths - end - + @routes ||= ActionDispatch::Routing::RouteSet.new @routes.append(&Proc.new) if block_given? @routes end @@ -555,12 +552,10 @@ module Rails initializer :add_routing_paths do |app| paths = self.paths["config/routes.rb"].existent - external_paths = self.paths["config/routes"].paths if routes? || paths.any? app.routes_reloader.paths.unshift(*paths) app.routes_reloader.route_sets << routes - app.routes_reloader.external_routes.unshift(*external_paths) end end diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index e31df807a6..6b18b1e249 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -53,7 +53,6 @@ module Rails paths.add "config/initializers", :glob => "**/*.rb" paths.add "config/locales", :glob => "*.{rb,yml}" paths.add "config/routes.rb" - paths.add "config/routes", :glob => "**/*.rb" paths.add "db" paths.add "db/migrate" paths.add "db/seeds.rb" diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 6cd9c7bc95..9b4a69f19f 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -114,7 +114,7 @@ module Rails class Path include Enumerable - attr_reader :path, :root + attr_reader :path attr_accessor :glob def initialize(root, current, paths, options = {}) @@ -180,14 +180,6 @@ module Rails @paths end - def paths - raise "You need to set a path root" unless @root.path - - map do |p| - File.join @root.path, p - end - end - # Expands all paths against the root and return all unique values. def expanded raise "You need to set a path root" unless @root.path |