Class: ListCommand

Inherits:
Command show all
Defined in:
lib/commands/list.rb

Instance Attribute Summary

Attributes inherited from Command

#description

Instance Method Summary collapse

Methods inherited from Command

#after_init, #before_init, default_cmd, describe, description, get_allowed_commands, #help, #initialize, load, load_all, #run, show_use, usage

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#mainObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/commands/list.rb', line 5

def main()
  
  puts "rcli installed applications"
  puts "---------------------------"
  
  biggest = 0
  Dir[Rcli::RCLI_DOTFOLDER + DS + 'app_info' + DS + '*'].each { |c| biggest = File.basename(c,'.yml').size if biggest < File.basename(c,'.yml').size }

  puts "biggest is #{biggest}" if $verbose
  # commands.sort.each do |name,cmd|
  #   puts "  %-#{biggest}s" % name + "  " + cmd[:instance].description
  # end

  Dir[Rcli::RCLI_DOTFOLDER + DS + 'app_info' + DS + '*'].each { |f|
    puts "loading #{f}..." if $verbose
    app_info = YAML.load_file(f)
    app_config = YAML.load_file(app_info['application_root'] + DS + 'config' + DS + 'application.yml' )
    pp app_info if $verbose
    # puts File.basename(f,'.yml') + " : " + (app_config['global']['description'] || "No description specified in #{File.basename(f,'.yml')}'s application config/application.yml")
    puts "  %-#{biggest}s" % File.basename(f,'.yml') + " : " + (app_config['global']['description'] || "No description specified in #{File.basename(f,'.yml')}'s application config/application.yml")
  }
end