Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
62521f20
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 搜索 >>
提交
62521f20
编写于
4月 04, 2017
作者:
A
Ahmad Sherif
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add rake task that prints TOML storage configuration
Closes gitaly#173
上级
5efd6794
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
0 deletion
+52
-0
Gemfile
Gemfile
+2
-0
Gemfile.lock
Gemfile.lock
+4
-0
lib/tasks/gitlab/gitaly.rake
lib/tasks/gitlab/gitaly.rake
+14
-0
spec/tasks/gitlab/gitaly_rake_spec.rb
spec/tasks/gitlab/gitaly_rake_spec.rb
+32
-0
未找到文件。
Gemfile
浏览文件 @
62521f20
...
...
@@ -353,3 +353,5 @@ gem 'sys-filesystem', '~> 1.1.6'
# Gitaly GRPC client
gem
'
gitaly
'
,
'~> 0.5.0'
gem
'
toml-rb
'
,
'~> 0.3.15'
,
require:
false
Gemfile.lock
浏览文件 @
62521f20
...
...
@@ -117,6 +117,7 @@ GEM
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
chunky_png (1.3.5)
citrus (3.0.2)
cliver (0.3.2)
coderay (1.1.1)
coercible (1.0.0)
...
...
@@ -784,6 +785,8 @@ GEM
tilt (2.0.6)
timecop (0.8.1)
timfel-krb5-auth (0.8.3)
toml-rb (0.3.15)
citrus (~> 3.0, > 3.0)
tool (0.2.3)
truncato (0.7.8)
htmlentities (~> 4.3.1)
...
...
@@ -1014,6 +1017,7 @@ DEPENDENCIES
test_after_commit (~> 1.1)
thin (~> 1.7.0)
timecop (~> 0.8.0)
toml-rb (~> 0.3.15)
truncato (~> 0.7.8)
u2f (~> 0.2.1)
uglifier (~> 2.7.2)
...
...
lib/tasks/gitlab/gitaly.rake
浏览文件 @
62521f20
...
...
@@ -19,5 +19,19 @@ namespace :gitlab do
run_command!
([
command
])
end
end
desc
"GitLab | Print storage configuration in TOML format"
task
storage_config: :environment
do
require
'toml'
puts
"# Gitaly storage configuration generated from
#{
Gitlab
.
config
.
source
}
on
#{
Time
.
current
.
to_s
(
:long
)
}
"
puts
"# This is in TOML format suitable for use in Gitaly's config.toml file."
config
=
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
key
,
val
|
{
name:
key
,
path:
val
[
'path'
]
}
end
puts
TOML
.
dump
(
storage:
config
)
end
end
end
spec/tasks/gitlab/gitaly_rake_spec.rb
浏览文件 @
62521f20
...
...
@@ -75,4 +75,36 @@ describe 'gitlab:gitaly namespace rake task' do
end
end
end
describe
'storage_config'
do
it
'prints storage configuration in a TOML format'
do
config
=
{
'default'
=>
{
'path'
=>
'/path/to/default'
},
'nfs_01'
=>
{
'path'
=>
'/path/to/nfs_01'
},
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
config
)
orig_stdout
=
$stdout
$stdout
=
StringIO
.
new
header
=
''
Timecop
.
freeze
do
header
=
<<~
TOML
# Gitaly storage configuration generated from
#{
Gitlab
.
config
.
source
}
on
#{
Time
.
current
.
to_s
(
:long
)
}
# This is in TOML format suitable for use in Gitaly's config.toml file.
TOML
run_rake_task
(
'gitlab:gitaly:storage_config'
)
end
output
=
$stdout
.
string
$stdout
=
orig_stdout
expect
(
output
).
to
include
(
header
)
parsed_output
=
TOML
.
parse
(
output
)
config
.
each
do
|
name
,
params
|
expect
(
parsed_output
[
'storage'
]).
to
include
({
'name'
=>
name
,
'path'
=>
params
[
'path'
]
})
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录