gitlab-org--gitlab-foss/lib/gitlab/template/gitlab_ci_yml_template.rb

38 lines
937 B
Ruby
Raw Normal View History

module Gitlab
module Template
class GitlabCiYmlTemplate < BaseTemplate
2016-06-17 02:37:19 -04:00
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'
end
def categories
{
'General' => '',
'Pages' => 'Pages',
2016-12-23 05:08:09 -05:00
'Auto deploy' => 'autodeploy'
}
end
def base_dir
Rails.root.join('vendor/gitlab-ci-yml')
end
def finder(project = nil)
Gitlab::Template::Finders::GlobalTemplateFinder.new(self.base_dir, self.extension, self.categories)
end
def dropdown_names(context)
2017-02-22 12:46:57 -05:00
categories = context == 'autodeploy' ? ['Auto deploy'] : %w(General Pages)
super().slice(*categories)
end
end
end
end
end