debian-mirror-gitlab/lib/gitlab/template/gitlab_ci_yml_template.rb

38 lines
937 B
Ruby
Raw Normal View History

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