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
iv
gitlab-ce
Commits
bbfd62bc
Commit
bbfd62bc
authored
Jun 17, 2016
by
Z.J. van de Weg
Committed by
Alfredo Sumaran
Jun 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! override content method
parent
a18df1d1
Changes
4
Show 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
...
@@ -27,11 +27,7 @@ module API
required_attributes!
[
:name
]
required_attributes!
[
:name
]
new_template
=
klass
.
find
(
params
[
:name
])
new_template
=
klass
.
find
(
params
[
:name
])
not_found!
(
"
#{
template
.
to_s
.
singularize
}
"
)
unless
new_template
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
present
new_template
,
with:
Entities
::
Template
present
new_template
,
with:
Entities
::
Template
end
end
...
...
lib/gitlab/template/base_template.rb
View file @
bbfd62bc
module
Gitlab
module
Gitlab
module
Template
module
Template
class
BaseTemplate
class
BaseTemplate
attr_writer
:content
def
initialize
(
path
)
def
initialize
(
path
)
@path
=
path
@path
=
path
end
end
...
@@ -12,19 +10,7 @@ module Gitlab
...
@@ -12,19 +10,7 @@ module Gitlab
end
end
def
content
def
content
@content
||=
File
.
read
(
@path
)
File
.
read
(
@path
)
end
def
categories
raise
NotImplementedError
end
def
extension
raise
NotImplementedError
end
def
base_dir
raise
NotImplementedError
end
end
class
<<
self
class
<<
self
...
@@ -39,6 +25,18 @@ module Gitlab
...
@@ -39,6 +25,18 @@ module Gitlab
directory
?
new
(
File
.
join
(
category_directory
(
directory
),
file_name
))
:
nil
directory
?
new
(
File
.
join
(
category_directory
(
directory
),
file_name
))
:
nil
end
end
def
categories
raise
NotImplementedError
end
def
extension
raise
NotImplementedError
end
def
base_dir
raise
NotImplementedError
end
def
by_category
(
category
)
def
by_category
(
category
)
templates_for_directory
(
category_directory
(
category
))
templates_for_directory
(
category_directory
(
category
))
end
end
...
...
lib/gitlab/template/gitlab_ci_yml.rb
View file @
bbfd62bc
module
Gitlab
module
Gitlab
module
Template
module
Template
class
GitlabCiYml
<
BaseTemplate
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
class
<<
self
def
extension
def
extension
'.gitlab-ci.yml'
'.gitlab-ci.yml'
...
...
lib/tasks/gitlab/update_templates.rake
View file @
bbfd62bc
...
@@ -27,7 +27,7 @@ namespace :gitlab do
...
@@ -27,7 +27,7 @@ namespace :gitlab do
# - The LICENSE, because we have to
# - The LICENSE, because we have to
# - The sub dirs so we can organise the file by category
# - The sub dirs so we can organise the file by category
# - The templates themself
# - 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
)
def
remove_unneeded_files
(
directory
,
regex
)
Dir
.
foreach
(
directory
)
do
|
file
|
Dir
.
foreach
(
directory
)
do
|
file
|
FileUtils
.
rm_rf
(
File
.
join
(
directory
,
file
))
unless
file
=~
regex
FileUtils
.
rm_rf
(
File
.
join
(
directory
,
file
))
unless
file
=~
regex
...
...
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