Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-10-15 16:59:00 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-10-26 09:27:05 +0300
commit1581f75fb511fed171e8105c1a0811561a2f2dcc (patch)
tree0bf87a3d3731017554446a3b02b7ba534f4d5395 /lib/gitlab/patch
parent679c0048a8f679aad456c02e30486150bbd0d93d (diff)
Put EE routes in EE files under EE directories
Diffstat (limited to 'lib/gitlab/patch')
-rw-r--r--lib/gitlab/patch/draw_route.rb21
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