Added initial command line parsing to puremvc-gen binary

Using CmdParse to handle command line arguments.

Fixed a few templates
This commit is contained in:
Greg Jastrab 2008-12-05 11:10:22 -05:00
parent 70b9d91930
commit 33bab6c024
4 changed files with 50 additions and 7 deletions

View File

@ -1,6 +1,46 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'cmdparse'
puts "About to run the ant script"
BUILDFILE = File.join(File.dirname(__FILE__), '..', 'conf', 'build.xml')
path = File.join(File.dirname(__FILE__), '..', 'conf', 'build.xml')
system "ant -f #{path}"
def call_ant(args='')
system "ant -f #{BUILDFILE} -Dbasedir=#{Dir.pwd} #{args}"
end
class CheckCommand < CmdParse::Command
def initialize
super('check', false)
self.short_desc = "Validates that all required property settings are current detected"
end
def execute(args)
call_ant "validate-properties"
end
end
class InitializeCommand < CmdParse::Command
def initialize
super('init', false)
self.short_desc = "Initializes the current working directory with a new PureMVC project"
end
def execute(args)
call_ant "new-pmvc"
end
end
cmd = CmdParse::CommandParser.new(true, true)
cmd.program_name = "puremvc-gen"
cmd.version = [0, 0, 1]
cmd.add_command(CmdParse::HelpCommand.new)
cmd.add_command(CmdParse::VersionCommand.new)
cmd.add_command(CheckCommand.new)
cmd.add_command(InitializeCommand.new)
cmd.parse

View File

@ -182,7 +182,7 @@
<echo>Creating PureMVC directories in ${core.dir}</echo>
<mkdir dir="${core.dir}/${model.dir}" />
<mkdir dir="${core.dir}/${view.dir}" />
<mkdir dir="${core.dir}/${controller.dir}" />
<mkdir dir="${core.dir}/${controller.dir}/components" />
<mkdir dir="${core.dir}/${events.dir}" />
</target>
@ -248,6 +248,7 @@
<replacevalue><![CDATA[registerCommand(/* CONST FOR COMMAND */, PMVCGenCommand);
//pmvcgen:register commands]]></replacevalue>
<replacefilter token="PMVCGenCommand" value="${cmd.name}Command" />
<replacefilter token="/* CONST FOR COMMAND */" value="${cmd.const}" />
</replace>
</target>
@ -293,9 +294,10 @@
<echo>${log.gen.startup.command}</echo>
<antcall target="create-macro-command">
<param name="cmd.name" value="Startup" />
<param name="cmd.const" value="STARTUP" />
</antcall>
<replace file="${core.dir}/${app.prefix}Facade.as"
token="/* CONST FOR COMMAND */" value="STARTUP" />
<!--replace file="${core.dir}/${app.prefix}Facade.as"
token="/* CONST FOR COMMAND */" value="STARTUP" /-->
</target>
<target name="create-prepare-actors-command" depends="init" description="Creates the PrepareActorsCommand">

View File

@ -2,6 +2,7 @@ package @namespace@.@view@ {
import @namespace@.@facade@;
import org.puremvc.as3.interfaces.INotification;
import org.puremvc.as3.patterns.mediator.Mediator;
/**

View File

@ -41,7 +41,7 @@ package @namespace@.@model@ {
/* --- Public Accessors --- */
public function get data():Object { return data; }
public function get dataObject():Object { return data; }
/* === Public Accessors === */