Class: Slideshow::GenTemplates

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, config) ⇒ GenTemplates

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



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

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#optsObject (readonly)

Returns the value of attribute opts.



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

def opts
  @opts
end

Instance Method Details

#runObject



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

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