summaryrefslogtreecommitdiff
path: root/lib/api/templates.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-02 16:41:32 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2016-11-08 13:54:58 +0000
commit6970c1f331e1f56424ff90fe43113d9f512bce95 (patch)
tree3e32aef0ea97787c2dbe53c26d6c8c1e6f204477 /lib/api/templates.rb
parent35142a097865b1083ddea95c8507aab07e52a4ed (diff)
downloadgitlab-ce-6970c1f331e1f56424ff90fe43113d9f512bce95.tar.gz
Allow to use Dockerfile templates
Diffstat (limited to 'lib/api/templates.rb')
-rw-r--r--lib/api/templates.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/api/templates.rb b/lib/api/templates.rb
index 8a53d9c0095..442fef1a848 100644
--- a/lib/api/templates.rb
+++ b/lib/api/templates.rb
@@ -8,7 +8,8 @@ module API
gitlab_ci_ymls: {
klass: Gitlab::Template::GitlabCiYmlTemplate,
gitlab_version: 8.9
- }
+ },
+ dockerfiles: Gitlab::Template::DockerfileTemplate
}.freeze
PROJECT_TEMPLATE_REGEX =
/[\<\{\[]
@@ -51,7 +52,7 @@ module API
end
params do
optional :popular, type: Boolean, desc: 'If passed, returns only popular licenses'
- end
+ end
get route do
options = {
featured: declared(params).popular.present? ? true : nil
@@ -69,7 +70,7 @@ module API
end
params do
requires :name, type: String, desc: 'The name of the template'
- end
+ end
get route, requirements: { name: /[\w\.-]+/ } do
not_found!('License') unless Licensee::License.find(declared(params).name)
@@ -78,7 +79,7 @@ module API
present template, with: Entities::RepoLicense
end
end
-
+
GLOBAL_TEMPLATE_TYPES.each do |template_type, properties|
klass = properties[:klass]
gitlab_version = properties[:gitlab_version]
@@ -104,7 +105,7 @@ module API
end
params do
requires :name, type: String, desc: 'The name of the template'
- end
+ end
get route do
new_template = klass.find(declared(params).name)