Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
1581f75f
Commit
1581f75f
authored
Oct 15, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put EE routes in EE files under EE directories
parent
679c0048
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
13 deletions
+43
-13
.rubocop.yml
.rubocop.yml
+1
-0
config/initializers/routing_draw.rb
config/initializers/routing_draw.rb
+2
-6
config/routes/admin.rb
config/routes/admin.rb
+2
-0
config/routes/group.rb
config/routes/group.rb
+2
-1
doc/development/ee_features.md
doc/development/ee_features.md
+15
-6
lib/gitlab/patch/draw_route.rb
lib/gitlab/patch/draw_route.rb
+21
-0
No files found.
.rubocop.yml
View file @
1581f75f
...
@@ -76,6 +76,7 @@ Naming/FileName:
...
@@ -76,6 +76,7 @@ Naming/FileName:
-
'
qa/qa/specs/**/*'
-
'
qa/qa/specs/**/*'
-
'
qa/bin/*'
-
'
qa/bin/*'
-
'
config/**/*'
-
'
config/**/*'
-
'
ee/config/**/*'
-
'
lib/generators/**/*'
-
'
lib/generators/**/*'
-
'
locale/unfound_translations.rb'
-
'
locale/unfound_translations.rb'
-
'
ee/locale/unfound_translations.rb'
-
'
ee/locale/unfound_translations.rb'
...
...
config/initializers/routing_draw.rb
View file @
1581f75f
# Adds draw method into Rails routing
# Adds draw method into Rails routing
# It allows us to keep routing splitted into files
# It allows us to keep routing split into files
class
ActionDispatch::Routing::Mapper
ActionDispatch
::
Routing
::
Mapper
.
prepend
Gitlab
::
Patch
::
DrawRoute
def
draw
(
routes_name
)
instance_eval
(
File
.
read
(
Rails
.
root
.
join
(
"config/routes/
#{
routes_name
}
.rb"
)))
end
end
config/routes/admin.rb
View file @
1581f75f
...
@@ -71,6 +71,7 @@ namespace :admin do
...
@@ -71,6 +71,7 @@ namespace :admin do
resource
:logs
,
only:
[
:show
]
resource
:logs
,
only:
[
:show
]
resource
:health_check
,
controller:
'health_check'
,
only:
[
:show
]
resource
:health_check
,
controller:
'health_check'
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resource
:system_info
,
controller:
'system_info'
,
only:
[
:show
]
resource
:system_info
,
controller:
'system_info'
,
only:
[
:show
]
resources
:requests_profiles
,
only:
[
:index
,
:show
],
param: :name
,
constraints:
{
name:
/.+\.html/
}
resources
:requests_profiles
,
only:
[
:index
,
:show
],
param: :name
,
constraints:
{
name:
/.+\.html/
}
...
@@ -104,6 +105,7 @@ namespace :admin do
...
@@ -104,6 +105,7 @@ namespace :admin do
resource
:application_settings
,
only:
[
:show
,
:update
]
do
resource
:application_settings
,
only:
[
:show
,
:update
]
do
resources
:services
,
only:
[
:index
,
:edit
,
:update
]
resources
:services
,
only:
[
:index
,
:edit
,
:update
]
get
:usage_data
get
:usage_data
put
:reset_registration_token
put
:reset_registration_token
put
:reset_health_check_token
put
:reset_health_check_token
...
...
config/routes/group.rb
View file @
1581f75f
# frozen_string_literal: true
resources
:groups
,
only:
[
:index
,
:new
,
:create
]
do
resources
:groups
,
only:
[
:index
,
:new
,
:create
]
do
post
:preview_markdown
post
:preview_markdown
end
end
...
@@ -63,7 +65,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
...
@@ -63,7 +65,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
end
end
end
end
# On CE only index and show actions are needed
resources
:boards
,
only:
[
:index
,
:show
]
resources
:boards
,
only:
[
:index
,
:show
]
resources
:runners
,
only:
[
:index
,
:edit
,
:update
,
:destroy
,
:show
]
do
resources
:runners
,
only:
[
:index
,
:edit
,
:update
,
:destroy
,
:show
]
do
...
...
doc/development/ee_features.md
View file @
1581f75f
...
@@ -171,7 +171,7 @@ There are a few gotchas with it:
...
@@ -171,7 +171,7 @@ There are a few gotchas with it:
class Base
class Base
def execute
def execute
return unless enabled?
return unless enabled?
# ...
# ...
# ...
# ...
end
end
...
@@ -185,12 +185,12 @@ There are a few gotchas with it:
...
@@ -185,12 +185,12 @@ There are a few gotchas with it:
class Base
class Base
def execute
def execute
return unless enabled?
return unless enabled?
do_something
do_something
end
end
private
private
def do_something
def do_something
# ...
# ...
# ...
# ...
...
@@ -204,14 +204,14 @@ There are a few gotchas with it:
...
@@ -204,14 +204,14 @@ There are a few gotchas with it:
```ruby
```ruby
module EE::Base
module EE::Base
extend ::Gitlab::Utils::Override
extend ::Gitlab::Utils::Override
override :do_something
override :do_something
def do_something
def do_something
# Follow the above pattern to call super and extend it
# Follow the above pattern to call super and extend it
end
end
end
end
```
```
This would require updating CE first, or make sure this is back ported to CE.
This would require updating CE first, or make sure this is back ported to CE.
When prepending, place them in the
`ee/`
specific sub-directory, and
When prepending, place them in the
`ee/`
specific sub-directory, and
...
@@ -332,6 +332,15 @@ full implementation details.
...
@@ -332,6 +332,15 @@ full implementation details.
[
ce-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12373
[
ce-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12373
[
ee-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2199
[
ee-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2199
### Code in `config/routes`
When we add
`draw :admin`
in
`config/routes.rb`
, the application will also
load the file located in
`config/routes/admin.rb`
, and also
`ee/config/routes/admin.rb`
if the file exists.
So if we want to extend a particular route file, just add the same file
located in
`ee/config/routes`
.
### Code in `app/controllers/`
### Code in `app/controllers/`
In controllers, the most common type of conflict is with
`before_action`
that
In controllers, the most common type of conflict is with
`before_action`
that
...
...
lib/gitlab/patch/draw_route.rb
0 → 100644
View file @
1581f75f
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment