summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-10-23 20:48:02 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-10-26 14:27:05 +0800
commitd045df3da882fa8bcd0424df096cec0c61b1eaff (patch)
tree77f3328b73d4174f7d810f43ff036e6991c9a70b
parent52fa309e86d1bafc6b8a986d8bd74fd906b1ebc9 (diff)
downloadgitlab-ce-d045df3da882fa8bcd0424df096cec0c61b1eaff.tar.gz
Allow CE do nothing if route doesn't exist7864-ee-routes
-rw-r--r--doc/development/ee_features.md9
-rw-r--r--lib/gitlab/patch/draw_route.rb4
-rw-r--r--spec/fast_spec_helper.rb1
3 files changed, 8 insertions, 6 deletions
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md
index bad9909ed43..b6f053ff0e9 100644
--- a/doc/development/ee_features.md
+++ b/doc/development/ee_features.md
@@ -338,13 +338,14 @@ When we add `draw :admin` in `config/routes.rb`, the application will try to
load the file located in `config/routes/admin.rb`, and also try to load the
file located in `ee/config/routes/admin.rb`.
-It should at least load one file, at most two files. If it cannot find any
-files, an error will be raised.
+In EE, it should at least load one file, at most two files. If it cannot find
+any files, an error will be raised. In CE, since we don't know if there will
+be an EE route, it will not raise any errors even if it cannot find anything.
This means if we want to extend a particular CE route file, just add the same
file located in `ee/config/routes`. If we want to add an EE only route, we
-could still use `draw :ee_only` and add `ee/config/routes/ee_only.rb` without
-adding `config/routes/ee_only.rb`.
+could still put `draw :ee_only` in both CE and EE, and add
+`ee/config/routes/ee_only.rb` in EE, similar to `render_if_exists`.
### Code in `app/controllers/`
diff --git a/lib/gitlab/patch/draw_route.rb b/lib/gitlab/patch/draw_route.rb
index c7a0b49a948..1192274cafa 100644
--- a/lib/gitlab/patch/draw_route.rb
+++ b/lib/gitlab/patch/draw_route.rb
@@ -16,8 +16,8 @@ module Gitlab
draw_route(route_path("config/routes/#{routes_name}.rb"))
end
- def draw_ee(routes_name)
- draw_route(route_path("ee/config/routes/#{routes_name}.rb"))
+ def draw_ee(_)
+ true
end
def route_path(routes_name)
diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb
index 134eb25e4b1..fe475e1f7a0 100644
--- a/spec/fast_spec_helper.rb
+++ b/spec/fast_spec_helper.rb
@@ -8,3 +8,4 @@ require_relative 'support/rspec'
require 'active_support/all'
ActiveSupport::Dependencies.autoload_paths << 'lib'
+ActiveSupport::Dependencies.autoload_paths << 'ee/lib'