Skip to content
Snippets Groups Projects

Expand instance-level templates to cover .gitlab-ci.yml, .gitignore and Dockerfile

Merged Nick Thomas requested to merge (removed):5306-more-custom-templates into master
1 unresolved thread
4 files
+ 75
19
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 27
0
 
class TemplateFinder
 
VENDORED_TEMPLATES = {
 
dockerfiles: ::Gitlab::Template::DockerfileTemplate,
 
gitignores: ::Gitlab::Template::GitignoreTemplate,
 
gitlab_ci_ymls: ::Gitlab::Template::GitlabCiYmlTemplate
 
}.freeze
 
 
attr_reader :type, :params
 
 
attr_reader :vendored_templates
 
private :vendored_templates
 
 
def initialize(type, params = {})
 
@type = type
 
@params = params
 
 
@vendored_templates = VENDORED_TEMPLATES.fetch(type)
 
end
 
 
def execute
 
if params[:name]
 
vendored_templates.find(params[:name])
 
else
 
vendored_templates.all
 
end
 
end
 
end
Loading