Fix bug where our fake AC::Routing::Routes was stomping on the real one.
This commit is contained in:
parent
8370c86b03
commit
28b809bc01
|
@ -1,6 +1,27 @@
|
||||||
# TODO: Fix formatting on member/collection methods
|
# TODO: Fix formatting on member/collection methods
|
||||||
|
|
||||||
module Rails
|
module Rails
|
||||||
module Upgrading
|
module Upgrading
|
||||||
|
module FakeRouter
|
||||||
|
module ActionController
|
||||||
|
module Routing
|
||||||
|
class Routes
|
||||||
|
def self.setup
|
||||||
|
@redrawer = Rails::Upgrading::RouteRedrawer.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.redrawer
|
||||||
|
@redrawer
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.draw
|
||||||
|
yield @redrawer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class RoutesUpgrader
|
class RoutesUpgrader
|
||||||
def generate_new_routes
|
def generate_new_routes
|
||||||
if has_routes_file?
|
if has_routes_file?
|
||||||
|
@ -19,14 +40,14 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def upgrade_routes
|
def upgrade_routes
|
||||||
ActionController::Routing::Routes.setup
|
FakeRouter::ActionController::Routing::Routes.setup
|
||||||
|
|
||||||
# Read and eval the file; our fake route mapper will capture
|
# Read and eval the file; our fake route mapper will capture
|
||||||
# the calls to draw routes and generate new route code
|
# the calls to draw routes and generate new route code
|
||||||
eval(routes_code)
|
FakeRouter.module_eval(routes_code)
|
||||||
|
|
||||||
# Give the route set to the code generator and get its output
|
# Give the route set to the code generator and get its output
|
||||||
generator = RouteGenerator.new(ActionController::Routing::Routes.redrawer.routes)
|
generator = RouteGenerator.new(FakeRouter::ActionController::Routing::Routes.redrawer.routes)
|
||||||
generator.generate
|
generator.generate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -316,21 +337,3 @@ module Rails
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ActionController
|
|
||||||
module Routing
|
|
||||||
class Routes
|
|
||||||
def self.setup
|
|
||||||
@redrawer = Rails::Upgrading::RouteRedrawer.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.redrawer
|
|
||||||
@redrawer
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.draw
|
|
||||||
yield @redrawer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue