Class: Commands::About

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/plugin/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_command) ⇒ About

Returns a new instance of About.



520
521
522
# File 'lib/commands/plugin/commands.rb', line 520

def initialize(base_command)
  @base_command = base_command
end

Instance Method Details

#optionsObject



524
525
526
527
528
529
530
# File 'lib/commands/plugin/commands.rb', line 524

def options
  OptionParser.new do |o|
    o.set_summary_indent('  ')
    o.banner =    "Usage: #{@base_command.script_name} about name [name]..."
    o.define_head "Shows plugin info at {url}/about.yml."
  end
end

#parse!(args) ⇒ Object



532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/commands/plugin/commands.rb', line 532

def parse!(args)
  options.parse!(args)
  args.each do |name|
    if plugin = ::Plugin.find(name)
      if about_hash = plugin.about
        puts about_hash.to_yaml + "\n"
        next
      end
    end
    
    puts "Plugin #{name} could not be found in the known repositories."
    puts
  end
end