Class Command
In: lib/fastcst/command.rb
Parent: Object

A Command pattern implementation used to create the set of command available to the user from the fcst script. The script uses objects which implement this interface to do the user’s bidding.

To implement a Command you must do the following:

  1.  Subclass Command and create an initialize message that does not take an opt argument.
  2.  After you create your own OptionParser, you pass it to the super() method.
  3.  Implement a validate function that returns a true/false depending on whether the command
      is configured properly.
  4.  By default the help function just wraps OptionParser#help.
  5.  Implement your run function to do the actual work based on the arguments parsed in argv.

Methods

Included Modules

PluginFactory

Attributes

done_validating  [R] 
valid  [R] 

Public Class methods

Tells the PluginFactory where to look for additional commands. We solve the problem of locating new commands by using the Repository object to get the .fastcst directory, and then use the plugins directory there.

Called by the subclass to setup the command and parse the argv arguments. The call is destructive on argv since it uses the OptionParser#parse! function.

Public Instance methods

Returns a help message. Defaults to OptionParser#help which should be good.

Runs the command doing it’s job. You should implement this otherwise it will throw a NotImplementedError as a reminder.

Returns true/false depending on whether the command is configured properly.

[Validate]