Class: Sle2Docker::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/sle2docker/template.rb

Class Method Summary collapse

Class Method Details

.listObject



5
6
7
8
9
# File 'lib/sle2docker/template.rb', line 5

def self.list
  Dir[File.expand_path('../../templates/*', __FILE__)].map do |dir|
    File.basename(dir)
  end
end

.template_dir(template_name) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/sle2docker/template.rb', line 11

def self.template_dir(template_name)
  dir = File.expand_path("../../templates/#{template_name.upcase}", __FILE__)
  if !File.exists?(dir)
    raise TemplateNotFoundError.new("Cannot find template with name #{template_name}")
  end
  dir
end