Module: Rpub::Commander

Extended by:
Commander
Included in:
Commander
Defined in:
lib/rpub/commander.rb

Overview

The +Commander+ module is responsible for invoking Command objects. This is the internal part of the library that is used by the CLI.

The +Commander+ takes a list of arguments, which would typically come from the CLI, and tries to look up a +Command+ class. If it cannot find anything, it will invoke the Rpub::Commands::Main command.

Instance Method Summary collapse

Instance Method Details

#invoke(args = []) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/rpub/commander.rb', line 12

def invoke(args = [])
  subcommand, *options = args
  Commands::Base.matching(subcommand).new(options).invoke
rescue SubclassTracker::NoSuchSubclass
  Commands::Main.new(args).invoke
rescue NoConfiguration
  abort 'The current directory does not look like an rpub project.'
end