module Autoproj::Jenkins

Constants

VERSION

Public Class Methods

has_template?(template_name) click to toggle source

Test if a template with the given basename exists

# File lib/autoproj/jenkins/render_template.rb, line 71
def self.has_template?(template_name)
    (template_path + "#{template_name}.erb").exist?
end
render_template(template_name, allow_unused: false, template_path: self.template_path, **parameters) click to toggle source

Create a template rendering context for the given parameters

@param [String] template_name the name of the template to be rendered,

without the .erb extension

@param [Hash<Symbol,Object>] parameters the template parameters @param [Pathname] template_path where the templates are located on disk @return [String]

# File lib/autoproj/jenkins/render_template.rb, line 82
def self.render_template(template_name, allow_unused: false, template_path: self.template_path, **parameters)
    context = TemplateRenderingContext.new(template_path, allow_unused: allow_unused, **parameters)
    template_path = template_path + "#{template_name}.erb"
    template = ERB.new(template_path.read)
    template.filename = template_path.to_s
    b = context.instance_eval { Kernel.binding }
    result = template.result(b)
    context.__verify
    result
end
template_path() click to toggle source

The path to autoproj-jenkins templates

# File lib/autoproj/jenkins/render_template.rb, line 66
def self.template_path
    Pathname.new(__dir__) + "templates"
end
vcs_supported?(vcs) click to toggle source

Returns true if the given VCS type is supported

@param [#to_s] vcs the VCS type (e.g. ‘git’)

# File lib/autoproj/jenkins/updater.rb, line 5
def self.vcs_supported?(vcs)
    Autoproj::Jenkins.has_template?("import-#{vcs}.pipeline")
end