Module: Gitlab::Client::Templates

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/templates.rb

Overview

Defines methods related to templates.

Instance Method Summary collapse

Instance Method Details

#dockerfile_template(key) ⇒ Gitlab::ObjectifiedHash

Get a single Dockerfile template.

Examples:

Gitlab.dockerfile_template('Binary')

Parameters:

  • key (String)

    The key of the Dockerfile template

Returns:


27
28
29
# File 'lib/gitlab/client/templates.rb', line 27

def dockerfile_template(key)
  get("/templates/dockerfiles/#{key}")
end

#dockerfile_templatesArray<Gitlab::ObjectifiedHash>

Get all Dockerfile templates.

Examples:

Gitlab.dockerfile_templates

Returns:


16
17
18
# File 'lib/gitlab/client/templates.rb', line 16

def dockerfile_templates
  get('/templates/dockerfiles')
end

#gitignore_template(key) ⇒ Gitlab::ObjectifiedHash

Get a single gitignore template.

Examples:

Gitlab.gitignore_template('Ruby')

Parameters:

  • key (String)

    The key of the gitignore template

Returns:


48
49
50
# File 'lib/gitlab/client/templates.rb', line 48

def gitignore_template(key)
  get("/templates/gitignores/#{key}")
end

#gitignore_templatesArray<Gitlab::ObjectifiedHash>

Get all gitignore templates.

Examples:

Gitlab.gitignore_templates

Returns:


37
38
39
# File 'lib/gitlab/client/templates.rb', line 37

def gitignore_templates
  get('/templates/gitignores')
end

#gitlab_ci_yml_template(key) ⇒ Gitlab::ObjectifiedHash

Get a single `gitlab_ci.yml` template.

Examples:

Gitlab.gitlab_ci_yml_template('Ruby')

Parameters:

  • key (String)

    The key of the gitlab_ci_yml template

Returns:


69
70
71
# File 'lib/gitlab/client/templates.rb', line 69

def gitlab_ci_yml_template(key)
  get("/templates/gitlab_ci_ymls/#{key}")
end

#gitlab_ci_yml_templatesArray<Gitlab::ObjectifiedHash>

Get all `gitlab_ci.yml` templates.

Examples:

Gitlab.gitlab_ci_yml_templates

Returns:


58
59
60
# File 'lib/gitlab/client/templates.rb', line 58

def gitlab_ci_yml_templates
  get('/templates/gitlab_ci_ymls')
end

#license_template(key, options = {}) ⇒ Gitlab::ObjectifiedHash

Get a single license template. You can pass parameters to replace the license placeholder.

Examples:

Gitlab.license_template('Ruby')

Parameters:

  • key (String)

    The key of the license template

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • project(optional) (String)

    The copyrighted project name.

  • fullname(optional) (String)

    The full-name of the copyright holder

Returns:


96
97
98
# File 'lib/gitlab/client/templates.rb', line 96

def license_template(key, options = {})
  get("/templates/licenses/#{key}", query: options)
end

#license_templates(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Get all license templates.

Examples:

Gitlab.license_templates
Gitlab.license_templates(popular: true)

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • popular(optional) (Boolean)

    If passed, returns only popular licenses.

Returns:


82
83
84
# File 'lib/gitlab/client/templates.rb', line 82

def license_templates(options = {})
  get('/templates/licenses', query: options)
end