Class: Nucleon::Action::Plugin::List

Inherits:
Object
  • Object
show all
Defined in:
lib/nucleon/action/plugin/list.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.describeObject


Info



10
11
12
# File 'lib/nucleon/action/plugin/list.rb', line 10

def self.describe
  super(:plugin, :list, 15)
end

Instance Method Details

#argumentsObject




25
26
27
# File 'lib/nucleon/action/plugin/list.rb', line 25

def arguments
  []
end

#configureObject


Settings



17
18
19
20
21
# File 'lib/nucleon/action/plugin/list.rb', line 17

def configure
  super do
    
  end
end

#executeObject


Operations



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/nucleon/action/plugin/list.rb', line 32

def execute
  super do |node|
    ensure_network do
      last_namespace   = nil
      last_plugin_type = nil
      
      Nucleon.loaded_plugins.each do |namespace, plugins|
        info('------------------------------------------------------', { :i18n => false, :prefix => false })
        prefixed_message(:info, ' ', 'namespace', { :namespace => purple(namespace), :prefix => false })
        info("\n", { :i18n => false, :prefix => false })
        
        provider_info = {}
        max_width     = 10
                  
        plugins.each do |type, providers|
          prefixed_message(:info, '    ', 'plugin_type', { :type => blue(type), :prefix => false })
          prefixed_message(:info, '      ', 'providers', { :prefix => false })
          
          providers.keys.each do |name|
            width     = name.to_s.size
            max_width = width if width > max_width
          end
          
          providers.each do |provider, plugin_info|
            info("        #{sprintf("%-#{max_width + 10}s", green(provider))}  -  #{yellow(plugin_info[:file])}", { :i18n => false, :prefix => false }) 
          end
          info("\n", { :i18n => false, :prefix => false })
          last_plugin_type = type
        end
        last_namespace = namespace
      end     
    end
  end
end