Method: Command::CommandSet.require_commands

Defined in:
lib/command-set/command-set.rb

.require_commands(mod, file = nil, cmd_path = []) ⇒ Object

In driver code, it’s often quickest to yank in commands from a file. To do that, create a code file with a module in it. The module needs a method of the form

def self.define_commands()

define_commands should return a CommandSet. Then, pass the require path and module name to require_commands, and it’ll take care of creating the command set. You can even call DSL::CommandSetDefinition#define_commands on the set that’s returned in order to add one-off commands or fold in other command sets.



203
204
205
206
207
# File 'lib/command-set/command-set.rb', line 203

def require_commands(mod, file=nil, cmd_path=[])
  set = self.new
  set.require_commands(mod, file, cmd_path)
  return set
end