Class: PureMVCGen::Commands::NewCommand::CreateCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- PureMVCGen::Commands::NewCommand::CreateCommand
- Defined in:
- lib/pure_m_v_c_gen/commands/new_command.rb
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize ⇒ CreateCommand
constructor
A new instance of CreateCommand.
Methods inherited from CmdParse::Command
Constructor Details
#initialize ⇒ CreateCommand
Returns a new instance of CreateCommand.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pure_m_v_c_gen/commands/new_command.rb', line 17 def initialize super('command', false) @type = :simple self.short_desc = "Creates a simple or macro command (defaults to simple)." self.description = " Generates a simple or macro command.\n Generating a simple command is the default behavior, unless the macro switch is passed:\n -m or --macro\n\n If no other switches are passed, the ANT script will prompt for a command name and constant,\n however these may be passed on the command line with the -n (or --name) and -c (or --const) switches.\n EOL\n self.options = default_options do |opt|\n opt.on(\"-m\", \"--macro\", \"Specifies the command is a MacroCommand\") { @type = :macro }\n opt.on(\"-n\", \"--name COMMAND_NAME\", \"Specifies the name for the command\") { |name| @command_name = name }\n opt.on(\"-c\", \"--const COMMAND_CONSTANT\", \"Specifies the constant to use for the command\") { |const| @command_const = const }\n end\nend\n" |
Instance Method Details
#execute(args) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/pure_m_v_c_gen/commands/new_command.rb', line 36 def execute(args) cmd = "" cmd << "-Dcmd.name=#{@command_name} " unless @command_name.nil? cmd << "-Dcmd.const=#{@command_const} " unless @command_const.nil? cmd << "#{@type == :simple ? "create-simple-command" : "create-macro-command"}" call_ant cmd end |