Class: Slideshow::GenTemplates

Inherits:
Object
  • Object
show all
Defined in:
lib/slideshow/cli/commands/gen_templates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, opts, config) ⇒ GenTemplates

fix: remove opts, use config (wrapped!!)



8
9
10
11
12
# File 'lib/slideshow/cli/commands/gen_templates.rb', line 8

def initialize( logger, opts, config )
  @logger  = logger
  @opts    = opts
  @config  = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



14
15
16
# File 'lib/slideshow/cli/commands/gen_templates.rb', line 14

def config
  @config
end

#loggerObject (readonly)

Returns the value of attribute logger.



14
15
16
# File 'lib/slideshow/cli/commands/gen_templates.rb', line 14

def logger
  @logger
end

#optsObject (readonly)

Returns the value of attribute opts.



14
15
16
# File 'lib/slideshow/cli/commands/gen_templates.rb', line 14

def opts
  @opts
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/slideshow/cli/commands/gen_templates.rb', line 16

def run
  manifest_name = opts.manifest
  manifest_name = manifest_name.downcase.gsub( '.txt', '' )  # remove (optional) .txt ending
  logger.debug "manifest=#{manifest_name}"
  
  # check for builtin generator manifests
  manifests = installed_generator_manifests.select { |m| m[0] == manifest_name+'.txt.gen' }
  
  if manifests.empty?
    puts "*** error: unknown generator template pack '#{manifest_name}'"
    # todo: list installed manifests
    exit 2
  end
      
  manifestsrc = manifests[0][1]
  pakpath     = opts.output_path

  logger.debug( "manifestsrc=>#{manifestsrc}<, pakpath=>#{pakpath}<" )
  
  Pakman::Copier.new( logger ).copy_pak( manifestsrc, pakpath )
end