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

40 lines
971 B
Ruby
Raw Normal View History

2019-02-13 22:33:31 +05:30
# frozen_string_literal: true
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
2018-12-05 23:21:45 +05:30
Rails.root.join('lib/gitlab/ci/templates')
2016-06-22 15:30:34 +05:30
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