Class: Pluto::Lister

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging, ManifestHelper
Defined in:
lib/pluto/lister.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManifestHelper

#installed_template_manifest_patterns, #installed_template_manifests

Constructor Details

#initialize(opts) ⇒ Lister

Returns a new instance of Lister.



9
10
11
# File 'lib/pluto/lister.rb', line 9

def initialize( opts )
  @opts    = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



13
14
15
# File 'lib/pluto/lister.rb', line 13

def opts
  @opts
end

Instance Method Details

#listObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pluto/lister.rb', line 15

def list
  home = Env.home
  ## replace home w/ ~ (to make out more readable (shorter))
  ## e.g. use gsub( home, '~' )

  puts ''
  puts 'Installed template packs in search path'
  
  installed_template_manifest_patterns.each_with_index do |pattern,i|
    puts "    [#{i+1}] #{pattern.gsub(home,'~')}"
  end
  puts '  include:'
  
  manifests = installed_template_manifests
  if manifests.empty?
    puts "    -- none --"
  else
    manifests.each do |manifest|
      pakname      = manifest[0].gsub('.txt','')
      manifestpath = manifest[1].gsub(home,'~')
      puts "%16s (%s)" % [pakname,manifestpath]
    end
  end
end