Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
bbfd62bc
Commit
bbfd62bc
authored
8 years ago
by
Z.J. van de Weg
Committed by
Alfredo Sumaran
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! override content method
parent
a18df1d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+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
No files found.
lib/api/templates.rb
View file @
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
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/template/base_template.rb
View file @
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
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/template/gitlab_ci_yml.rb
View file @
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'
...
...
This diff is collapsed.
Click to expand it.
lib/tasks/gitlab/update_templates.rake
View file @
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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment