Class: Slideshow::Plugins

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging, PluginHelper
Defined in:
lib/slideshow/commands/plugins.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PluginHelper

#find_plugin_patterns, #find_plugins, #load_plugins

Constructor Details

#initialize(config) ⇒ Plugins

Returns a new instance of Plugins.



12
13
14
# File 'lib/slideshow/commands/plugins.rb', line 12

def initialize( config )
  @config  = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



16
17
18
# File 'lib/slideshow/commands/plugins.rb', line 16

def config
  @config
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/slideshow/commands/plugins.rb', line 18

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

  puts ''
  puts 'Plugin scripts on the load path'
  
  find_plugin_patterns.each_with_index do |pattern,i|
    puts "    [#{i+1}] #{pattern.gsub(home,'~')}"
  end
  puts '  include:'

  plugins = find_plugins
  if plugins.empty?
    puts "    -- none --"
  else
    plugins.each do |plugin|
      ## NB: use full_path - since Ruby 1.9.2 - ./ no longer included in load path for security
      plugin_fullpath = File.expand_path( plugin )
      puts "    #{plugin.gsub(home,'~')} (#{plugin_fullpath})"
    end
  end
end