2016-06-02 16:20:08 +00:00
|
|
|
module Gitlab
|
|
|
|
module Template
|
2016-06-24 19:43:46 +00:00
|
|
|
class GitlabCiYmlTemplate < BaseTemplate
|
2016-06-17 06:37:19 +00:00
|
|
|
def content
|
|
|
|
explanation = "# This file is a template, and might need editing before it works on your project."
|
|
|
|
[explanation, super].join("\n")
|
|
|
|
end
|
|
|
|
|
2016-06-02 16:20:08 +00:00
|
|
|
class << self
|
|
|
|
def extension
|
|
|
|
'.gitlab-ci.yml'
|
|
|
|
end
|
|
|
|
|
|
|
|
def categories
|
|
|
|
{
|
2016-12-21 15:21:55 +00:00
|
|
|
'General' => '',
|
|
|
|
'Pages' => 'Pages',
|
2016-12-23 10:08:09 +00:00
|
|
|
'Auto deploy' => 'autodeploy'
|
2016-06-02 16:20:08 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def base_dir
|
|
|
|
Rails.root.join('vendor/gitlab-ci-yml')
|
|
|
|
end
|
2016-06-24 19:43:46 +00:00
|
|
|
|
|
|
|
def finder(project = nil)
|
|
|
|
Gitlab::Template::Finders::GlobalTemplateFinder.new(self.base_dir, self.extension, self.categories)
|
|
|
|
end
|
2016-12-21 15:21:55 +00:00
|
|
|
|
|
|
|
def dropdown_names(context)
|
2017-02-22 17:46:57 +00:00
|
|
|
categories = context == 'autodeploy' ? ['Auto deploy'] : %w(General Pages)
|
2016-12-21 15:21:55 +00:00
|
|
|
super().slice(*categories)
|
|
|
|
end
|
2016-06-02 16:20:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|