Class: Gitlab::Template::GitlabCiYmlTemplate

Inherits:
BaseTemplate show all
Extended by:
Utils::StrongMemoize
Defined in:
lib/gitlab/template/gitlab_ci_yml_template.rb

Constant Summary collapse

BASE_EXCLUDED_PATTERNS =
[%r{\.latest$}].freeze

Instance Attribute Summary

Attributes inherited from BaseTemplate

#category

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

clear_memoization, strong_memoize, strong_memoized?

Methods inherited from BaseTemplate

#<=>, all, by_category, category_directory, dropdown_names, find, #full_name, #initialize, #name, #resolve!, #to_json

Constructor Details

This class inherits a constructor from Gitlab::Template::BaseTemplate

Class Method Details

.additional_excluded_patternsObject


35
36
37
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 35

def additional_excluded_patterns
  [%r{Verify/Browser-Performance}]
end

.base_dirObject


39
40
41
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 39

def base_dir
  Rails.root.join('lib/gitlab/ci/templates')
end

.categoriesObject


20
21
22
23
24
25
26
27
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 20

def categories
  {
    'General' => '',
    'Pages' => 'Pages',
    'Verify' => 'Verify',
    'Auto deploy' => 'autodeploy'
  }
end

.excluded_patternsObject


29
30
31
32
33
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 29

def excluded_patterns
  strong_memoize(:excluded_patterns) do
    BASE_EXCLUDED_PATTERNS + additional_excluded_patterns
  end
end

.extensionObject


16
17
18
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 16

def extension
  '.gitlab-ci.yml'
end

.finder(project = nil) ⇒ Object


43
44
45
46
47
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 43

def finder(project = nil)
  Gitlab::Template::Finders::GlobalTemplateFinder.new(
    self.base_dir, self.extension, self.categories, excluded_patterns: self.excluded_patterns
  )
end

Instance Method Details

#contentObject


8
9
10
11
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 8

def content
  explanation = "# This file is a template, and might need editing before it works on your project."
  [explanation, super].join("\n")
end