Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6a541c79
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 搜索 >>
提交
6a541c79
编写于
4月 26, 2017
作者:
M
Maxim Rydkin
提交者:
Rémy Coutable
4月 26, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Decrease ABC threshold to 57.08
上级
04fcf3fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
17 deletion
+24
-17
.rubocop.yml
.rubocop.yml
+1
-1
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
+4
-0
lib/backup/manager.rb
lib/backup/manager.rb
+19
-16
未找到文件。
.rubocop.yml
浏览文件 @
6a541c79
...
...
@@ -543,7 +543,7 @@ Style/Proc:
# branches, and conditions.
Metrics/AbcSize
:
Enabled
:
true
Max
:
60
Max
:
57.08
# This cop checks if the length of a block exceeds some maximum value.
Metrics/BlockLength
:
...
...
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
0 → 100644
浏览文件 @
6a541c79
---
title
:
Decrease ABC threshold to
57.08
merge_request
:
10724
author
:
Rydkin Maxim
lib/backup/manager.rb
浏览文件 @
6a541c79
...
...
@@ -17,9 +17,8 @@ module Backup
s
[
:skipped
]
=
ENV
[
"SKIP"
]
tar_file
=
"
#{
s
[
:backup_created_at
].
strftime
(
'%s_%Y_%m_%d'
)
}#{
FILE_NAME_SUFFIX
}
"
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
do
File
.
open
(
"
#{
Gitlab
.
config
.
backup
.
path
}
/backup_information.yml"
,
"w+"
)
do
|
file
|
Dir
.
chdir
(
backup_path
)
do
File
.
open
(
"
#{
backup_path
}
/backup_information.yml"
,
"w+"
)
do
|
file
|
file
<<
s
.
to_yaml
.
gsub
(
/^---\n/
,
''
)
end
...
...
@@ -64,9 +63,9 @@ module Backup
$progress
.
print
"Deleting tmp directories ... "
backup_contents
.
each
do
|
dir
|
next
unless
File
.
exist?
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
dir
))
next
unless
File
.
exist?
(
File
.
join
(
backup_
path
,
dir
))
if
FileUtils
.
rm_rf
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
dir
))
if
FileUtils
.
rm_rf
(
File
.
join
(
backup_
path
,
dir
))
$progress
.
puts
"done"
.
color
(
:green
)
else
puts
"deleting tmp directory '
#{
dir
}
' failed"
.
color
(
:red
)
...
...
@@ -83,8 +82,8 @@ module Backup
if
keep_time
>
0
removed
=
0
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
do
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
.
each
do
|
file
|
Dir
.
chdir
(
backup_
path
)
do
backup_file_list
.
each
do
|
file
|
next
unless
file
=~
/(\d+)(?:_\d{4}_\d{2}_\d{2})?_gitlab_backup\.tar/
timestamp
=
$1
.
to_i
...
...
@@ -107,18 +106,14 @@ module Backup
end
def
unpack
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
Dir
.
chdir
(
backup_
path
)
# check for existing backups in the backup dir
file_list
=
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
if
file_list
.
count
==
0
$progress
.
puts
"No backups found in
#{
Gitlab
.
config
.
backup
.
path
}
"
if
backup_file_list
.
empty?
$progress
.
puts
"No backups found in
#{
backup_path
}
"
$progress
.
puts
"Please make sure that file name ends with
#{
FILE_NAME_SUFFIX
}
"
exit
1
end
if
file_list
.
count
>
1
&&
ENV
[
"BACKUP"
].
nil?
elsif
backup_file_list
.
many?
&&
ENV
[
"BACKUP"
].
nil?
$progress
.
puts
'Found more than one backup, please specify which one you want to restore:'
$progress
.
puts
'rake gitlab:backup:restore BACKUP=timestamp_of_backup'
exit
1
...
...
@@ -127,7 +122,7 @@ module Backup
tar_file
=
if
ENV
[
'BACKUP'
].
present?
"
#{
ENV
[
'BACKUP'
]
}#{
FILE_NAME_SUFFIX
}
"
else
file_list
.
first
backup_
file_list
.
first
end
unless
File
.
exist?
(
tar_file
)
...
...
@@ -169,6 +164,14 @@ module Backup
private
def
backup_path
Gitlab
.
config
.
backup
.
path
end
def
backup_file_list
@backup_file_list
||=
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
end
def
connect_to_remote_directory
(
connection_settings
)
connection
=
::
Fog
::
Storage
.
new
(
connection_settings
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录