diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-10-15 16:59:00 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-10-26 09:27:05 +0300 |
commit | 1581f75fb511fed171e8105c1a0811561a2f2dcc (patch) | |
tree | 0bf87a3d3731017554446a3b02b7ba534f4d5395 /lib | |
parent | 679c0048a8f679aad456c02e30486150bbd0d93d (diff) |
Put EE routes in EE files under EE directories
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/patch/draw_route.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gitlab/patch/draw_route.rb b/lib/gitlab/patch/draw_route.rb new file mode 100644 index 00000000000..4396e811a8c --- /dev/null +++ b/lib/gitlab/patch/draw_route.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# We're patching `ActionDispatch::Routing::Mapper` in +# config/initializers/routing_draw.rb +module Gitlab + module Patch + module DrawRoute + def draw(routes_name) + instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) + + draw_ee(routes_name) + end + + def draw_ee(routes_name) + path = Rails.root.join("ee/config/routes/#{routes_name}.rb") + + instance_eval(File.read(path)) if File.exist?(path) + end + end + end +end |