Class: GridCLI::PluginCommand

Inherits:
BaseCommand show all
Defined in:
lib/gridcli/commands/plugin.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#cmd, #desc

Instance Method Summary collapse

Methods inherited from BaseCommand

#add_format_option, #add_option, #error, #log, #output_format, #parse_dates, #parse_opts, #pop_arg, #pprint

Constructor Details

#initializePluginCommand

Returns a new instance of PluginCommand.



3
4
5
# File 'lib/gridcli/commands/plugin.rb', line 3

def initialize
  super "plugin", "Install / uninstall plugins"
end

Instance Method Details

#run(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gridcli/commands/plugin.rb', line 11

def run(args)
  if args.length == 0
    puts "The following plugins are installed: "
    puts GridCLI.plugins['enabled'].join(', ')
  elsif args.length == 2 and args.first == "install"
    log "Attempting to install gem grid-plugin-#{args[1]}"
    GridCLI.plugins.install args[1]
  elsif args.length == 2 and args.first == "uninstall"
    log "Attempting to uninstall gem grid-plugin-#{args[1]}"
    GridCLI.plugins.uninstall args[1]
  else
    usage
  end
end

#usageObject



7
8
9
# File 'lib/gridcli/commands/plugin.rb', line 7

def usage
  super "[<install|uninstall> <name>]"
end