Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
bbfd62bc
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,发现更多精彩内容 >>
提交
bbfd62bc
编写于
6月 17, 2016
作者:
Z
Z.J. van de Weg
提交者:
Alfredo Sumaran
6月 20, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixup! override content method
上级
a18df1d1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
21 deletion
+20
-21
lib/api/templates.rb
lib/api/templates.rb
+1
-5
lib/gitlab/template/base_template.rb
lib/gitlab/template/base_template.rb
+13
-15
lib/gitlab/template/gitlab_ci_yml.rb
lib/gitlab/template/gitlab_ci_yml.rb
+5
-0
lib/tasks/gitlab/update_templates.rake
lib/tasks/gitlab/update_templates.rake
+1
-1
未找到文件。
lib/api/templates.rb
浏览文件 @
bbfd62bc
...
...
@@ -27,11 +27,7 @@ module API
required_attributes!
[
:name
]
new_template
=
klass
.
find
(
params
[
:name
])
not_found!
(
"
#{
template
.
to_s
.
singularize
}
"
)
unless
new_template
if
new_template
.
class
==
Gitlab
::
Template
::
GitlabCiYml
new_template
.
content
=
"# This file is a template, and might need editing before it works on your project.
\n
"
+
new_template
.
content
end
not_found!
(
template
.
to_s
.
singularize
)
unless
new_template
present
new_template
,
with:
Entities
::
Template
end
...
...
lib/gitlab/template/base_template.rb
浏览文件 @
bbfd62bc
module
Gitlab
module
Template
class
BaseTemplate
attr_writer
:content
def
initialize
(
path
)
@path
=
path
end
...
...
@@ -12,19 +10,7 @@ module Gitlab
end
def
content
@content
||=
File
.
read
(
@path
)
end
def
categories
raise
NotImplementedError
end
def
extension
raise
NotImplementedError
end
def
base_dir
raise
NotImplementedError
File
.
read
(
@path
)
end
class
<<
self
...
...
@@ -39,6 +25,18 @@ module Gitlab
directory
?
new
(
File
.
join
(
category_directory
(
directory
),
file_name
))
:
nil
end
def
categories
raise
NotImplementedError
end
def
extension
raise
NotImplementedError
end
def
base_dir
raise
NotImplementedError
end
def
by_category
(
category
)
templates_for_directory
(
category_directory
(
category
))
end
...
...
lib/gitlab/template/gitlab_ci_yml.rb
浏览文件 @
bbfd62bc
module
Gitlab
module
Template
class
GitlabCiYml
<
BaseTemplate
def
content
explanation
=
"# This file is a template, and might need editing before it works on your project."
[
explanation
,
super
].
join
(
"
\n
"
)
end
class
<<
self
def
extension
'.gitlab-ci.yml'
...
...
lib/tasks/gitlab/update_templates.rake
浏览文件 @
bbfd62bc
...
...
@@ -27,7 +27,7 @@ namespace :gitlab do
# - The LICENSE, because we have to
# - The sub dirs so we can organise the file by category
# - The templates themself
# - Dir.ent
ir
es returns also the entries '.' and '..'
# - Dir.ent
ri
es returns also the entries '.' and '..'
def
remove_unneeded_files
(
directory
,
regex
)
Dir
.
foreach
(
directory
)
do
|
file
|
FileUtils
.
rm_rf
(
File
.
join
(
directory
,
file
))
unless
file
=~
regex
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录