Sha256: 32ec71c1edd00e7b3a239c8d10a5b60bed53388bcab46b218383d2e7494e8f2e

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

class ListCommand  < Command

  description "Lists all installed rcli programs"
  
  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
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcli-0.1.2 lib/commands/list.rb
rcli-0.1.0 lib/commands/list.rb