Module: ForemanGitTemplates::Renderer

Defined in:
app/lib/foreman_git_templates/renderer.rb,
app/lib/foreman_git_templates/renderer/source/repository.rb

Defined Under Namespace

Modules: Source

Constant Summary collapse

REPOSITORY_SOURCE_CLASS =
ForemanGitTemplates::Renderer::Source::Repository

Instance Method Summary collapse

Instance Method Details

#get_source(klass: nil, template:, **args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/lib/foreman_git_templates/renderer.rb', line 7

def get_source(klass: nil, template:, **args)
  return super if klass && klass != REPOSITORY_SOURCE_CLASS

  repository_path = repository_path(args[:host])
  if repository_path
    REPOSITORY_SOURCE_CLASS.new(template, repository_path)
  elsif !repository_path && Gem::Version.new(SETTINGS[:version].version) < Gem::Version.new('1.23')
    super(klass: klass || Foreman::Renderer::Source::Database, template: template, **args)
  else
    super
  end
end