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:
parent
70b9d91930
commit
33bab6c024
|
@ -1,6 +1,46 @@
|
||||||
#!/usr/bin/env ruby
|
#!/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')
|
def call_ant(args='')
|
||||||
system "ant -f #{path}"
|
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
|
||||||
|
|
|
@ -182,7 +182,7 @@
|
||||||
<echo>Creating PureMVC directories in ${core.dir}</echo>
|
<echo>Creating PureMVC directories in ${core.dir}</echo>
|
||||||
<mkdir dir="${core.dir}/${model.dir}" />
|
<mkdir dir="${core.dir}/${model.dir}" />
|
||||||
<mkdir dir="${core.dir}/${view.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}" />
|
<mkdir dir="${core.dir}/${events.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -248,6 +248,7 @@
|
||||||
<replacevalue><![CDATA[registerCommand(/* CONST FOR COMMAND */, PMVCGenCommand);
|
<replacevalue><![CDATA[registerCommand(/* CONST FOR COMMAND */, PMVCGenCommand);
|
||||||
//pmvcgen:register commands]]></replacevalue>
|
//pmvcgen:register commands]]></replacevalue>
|
||||||
<replacefilter token="PMVCGenCommand" value="${cmd.name}Command" />
|
<replacefilter token="PMVCGenCommand" value="${cmd.name}Command" />
|
||||||
|
<replacefilter token="/* CONST FOR COMMAND */" value="${cmd.const}" />
|
||||||
</replace>
|
</replace>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -293,9 +294,10 @@
|
||||||
<echo>${log.gen.startup.command}</echo>
|
<echo>${log.gen.startup.command}</echo>
|
||||||
<antcall target="create-macro-command">
|
<antcall target="create-macro-command">
|
||||||
<param name="cmd.name" value="Startup" />
|
<param name="cmd.name" value="Startup" />
|
||||||
|
<param name="cmd.const" value="STARTUP" />
|
||||||
</antcall>
|
</antcall>
|
||||||
<replace file="${core.dir}/${app.prefix}Facade.as"
|
<!--replace file="${core.dir}/${app.prefix}Facade.as"
|
||||||
token="/* CONST FOR COMMAND */" value="STARTUP" />
|
token="/* CONST FOR COMMAND */" value="STARTUP" /-->
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="create-prepare-actors-command" depends="init" description="Creates the PrepareActorsCommand">
|
<target name="create-prepare-actors-command" depends="init" description="Creates the PrepareActorsCommand">
|
||||||
|
|
|
@ -2,6 +2,7 @@ package @namespace@.@view@ {
|
||||||
|
|
||||||
import @namespace@.@facade@;
|
import @namespace@.@facade@;
|
||||||
|
|
||||||
|
import org.puremvc.as3.interfaces.INotification;
|
||||||
import org.puremvc.as3.patterns.mediator.Mediator;
|
import org.puremvc.as3.patterns.mediator.Mediator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ package @namespace@.@model@ {
|
||||||
|
|
||||||
/* --- Public Accessors --- */
|
/* --- Public Accessors --- */
|
||||||
|
|
||||||
public function get data():Object { return data; }
|
public function get dataObject():Object { return data; }
|
||||||
|
|
||||||
/* === Public Accessors === */
|
/* === Public Accessors === */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue