Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1581f75f
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1581f75f
编写于
10月 15, 2018
作者:
L
Lin Jen-Shin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Put EE routes in EE files under EE directories
上级
679c0048
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
13 deletion
+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
未找到文件。
.rubocop.yml
浏览文件 @
1581f75f
...
...
@@ -76,6 +76,7 @@ Naming/FileName:
-
'
qa/qa/specs/**/*'
-
'
qa/bin/*'
-
'
config/**/*'
-
'
ee/config/**/*'
-
'
lib/generators/**/*'
-
'
locale/unfound_translations.rb'
-
'
ee/locale/unfound_translations.rb'
...
...
config/initializers/routing_draw.rb
浏览文件 @
1581f75f
# Adds draw method into Rails routing
# It allows us to keep routing splitted into files
class
ActionDispatch::Routing::Mapper
def
draw
(
routes_name
)
instance_eval
(
File
.
read
(
Rails
.
root
.
join
(
"config/routes/
#{
routes_name
}
.rb"
)))
end
end
# It allows us to keep routing split into files
ActionDispatch
::
Routing
::
Mapper
.
prepend
Gitlab
::
Patch
::
DrawRoute
config/routes/admin.rb
浏览文件 @
1581f75f
...
...
@@ -71,6 +71,7 @@ namespace :admin do
resource
:logs
,
only:
[
:show
]
resource
:health_check
,
controller:
'health_check'
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resource
:system_info
,
controller:
'system_info'
,
only:
[
:show
]
resources
:requests_profiles
,
only:
[
:index
,
:show
],
param: :name
,
constraints:
{
name:
/.+\.html/
}
...
...
@@ -104,6 +105,7 @@ namespace :admin do
resource
:application_settings
,
only:
[
:show
,
:update
]
do
resources
:services
,
only:
[
:index
,
:edit
,
:update
]
get
:usage_data
put
:reset_registration_token
put
:reset_health_check_token
...
...
config/routes/group.rb
浏览文件 @
1581f75f
# frozen_string_literal: true
resources
:groups
,
only:
[
:index
,
:new
,
:create
]
do
post
:preview_markdown
end
...
...
@@ -63,7 +65,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
end
end
# On CE only index and show actions are needed
resources
:boards
,
only:
[
:index
,
:show
]
resources
:runners
,
only:
[
:index
,
:edit
,
:update
,
:destroy
,
:show
]
do
...
...
doc/development/ee_features.md
浏览文件 @
1581f75f
...
...
@@ -171,7 +171,7 @@ There are a few gotchas with it:
class Base
def execute
return unless enabled?
# ...
# ...
end
...
...
@@ -185,12 +185,12 @@ There are a few gotchas with it:
class Base
def execute
return unless enabled?
do_something
end
private
def do_something
# ...
# ...
...
...
@@ -204,14 +204,14 @@ There are a few gotchas with it:
```ruby
module EE::Base
extend ::Gitlab::Utils::Override
override :do_something
def do_something
# Follow the above pattern to call super and extend it
end
end
```
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
...
...
@@ -332,6 +332,15 @@ full implementation details.
[
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
### 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/`
In controllers, the most common type of conflict is with
`before_action`
that
...
...
lib/gitlab/patch/draw_route.rb
0 → 100644
浏览文件 @
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录