Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1b42c847
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 搜索 >>
提交
1b42c847
编写于
9月 07, 2018
作者:
J
Jan Provaznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix rails 5 deprecation warnings
Fixes rails 5 deprecation warnings in `config/` files
上级
b21625a9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
13 deletion
+21
-13
config/application.rb
config/application.rb
+3
-2
config/environments/test.rb
config/environments/test.rb
+2
-2
config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
...tive_record_avoid_type_casting_in_uniqueness_validator.rb
+0
-2
config/initializers/static_files.rb
config/initializers/static_files.rb
+16
-7
未找到文件。
config/application.rb
浏览文件 @
1b42c847
...
...
@@ -19,6 +19,7 @@ module Gitlab
require_dependency
Rails
.
root
.
join
(
'lib/gitlab/request_context'
)
require_dependency
Rails
.
root
.
join
(
'lib/gitlab/current_settings'
)
require_dependency
Rails
.
root
.
join
(
'lib/gitlab/middleware/read_only'
)
require_dependency
Rails
.
root
.
join
(
'lib/gitlab/middleware/basic_health_check'
)
# This needs to be loaded before DB connection is made
# to make sure that all connections have NO_ZERO_DATE
...
...
@@ -159,7 +160,7 @@ module Gitlab
# This middleware needs to precede ActiveRecord::QueryCache and other middlewares that
# connect to the database.
config
.
middleware
.
insert_after
"Rails::Rack::Logger"
,
"Gitlab::Middleware::BasicHealthCheck"
config
.
middleware
.
insert_after
Rails
::
Rack
::
Logger
,
::
Gitlab
::
Middleware
::
BasicHealthCheck
config
.
middleware
.
insert_after
Warden
::
Manager
,
Rack
::
Attack
...
...
@@ -196,7 +197,7 @@ module Gitlab
config
.
cache_store
=
:redis_store
,
caching_config_hash
config
.
active_record
.
raise_in_transactional_callbacks
=
true
config
.
active_record
.
raise_in_transactional_callbacks
=
true
unless
rails5?
config
.
active_job
.
queue_adapter
=
:sidekiq
...
...
config/environments/test.rb
浏览文件 @
1b42c847
...
...
@@ -21,12 +21,12 @@ Rails.application.configure do
if
Gitlab
.
rails5?
config
.
public_file_server
.
enabled
=
true
config
.
public_file_server
.
headers
=
{
'Cache-Control'
=>
'public, max-age=3600'
}
else
config
.
serve_static_files
=
true
config
.
static_cache_control
=
"public, max-age=3600"
end
config
.
static_cache_control
=
"public, max-age=3600"
# Show full error reports and disable caching
config
.
consider_all_requests_local
=
true
config
.
action_controller
.
perform_caching
=
false
...
...
config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
浏览文件 @
1b42c847
...
...
@@ -21,8 +21,6 @@
# This bug was fixed in Rails 5.1 by https://github.com/rails/rails/pull/24745/commits/aa062318c451512035c10898a1af95943b1a3803
if
Gitlab
.
rails5?
ActiveSupport
::
Deprecation
.
warn
(
"
#{
__FILE__
}
is a monkey patch which must be removed when upgrading to Rails 5.1"
)
if
Rails
.
version
.
start_with?
(
"5.1"
)
raise
"Remove this monkey patch:
#{
__FILE__
}
"
end
...
...
config/initializers/static_files.rb
浏览文件 @
1b42c847
app
=
Rails
.
application
if
app
.
config
.
serve_static_files
if
(
Gitlab
.
rails5?
&&
app
.
config
.
public_file_server
.
enabled
)
||
app
.
config
.
serve_static_files
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
# We're replacing it with our `Gitlab::Middleware::Static` that does the same,
# except ignoring `/uploads`, letting those go through to the GitLab Rails app.
app
.
config
.
middleware
.
swap
(
ActionDispatch
::
Static
,
Gitlab
::
Middleware
::
Static
,
app
.
paths
[
"public"
].
first
,
app
.
config
.
static_cache_control
)
if
Gitlab
.
rails5?
app
.
config
.
middleware
.
swap
(
ActionDispatch
::
Static
,
Gitlab
::
Middleware
::
Static
,
app
.
paths
[
"public"
].
first
,
headers:
app
.
config
.
public_file_server
.
headers
)
else
app
.
config
.
middleware
.
swap
(
ActionDispatch
::
Static
,
Gitlab
::
Middleware
::
Static
,
app
.
paths
[
"public"
].
first
,
app
.
config
.
static_cache_control
)
end
# If webpack-dev-server is configured, proxy webpack's public directory
# instead of looking for static assets
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录