Method: Amp::Command#initialize
- Defined in:
- lib/amp/commands/command.rb
#initialize(name, require_new = false) {|The| ... } ⇒ Command
Creates a command in the Amp system. Simply instantiating a new command will make it available to the Amp executable. You configure the command by filling out a block in the command’s initializer.
the command
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/amp/commands/command.rb', line 175 def initialize(name, require_new = false) # so that you can do additions to commands, just like ammending rake tasks full_name = (self.class.current_namespaces + [name]).join(":") name = full_name.to_sym if self.class.all_commands[name] yield self.class.all_commands[name] if block_given? return self.class.all_commands[name] end @name = name @help = "" = [] self.class.all_commands[name] = self @before = [] @after = [] @workflows = [] @synonyms = [] yield(self) if block_given? workflow :all if @workflows.empty? += GLOBAL_OPTIONS end |