Initial PureMVCGen gem code in place.
This commit is contained in:
commit
70b9d91930
6
History.txt
Normal file
6
History.txt
Normal file
@ -0,0 +1,6 @@
|
||||
=== 1.0.0 / 2008-12-02
|
||||
|
||||
* 1 major enhancement
|
||||
|
||||
* Birthday!
|
||||
|
21
Manifest.txt
Normal file
21
Manifest.txt
Normal file
@ -0,0 +1,21 @@
|
||||
History.txt
|
||||
Manifest.txt
|
||||
README.txt
|
||||
Rakefile
|
||||
bin/puremvc-gen
|
||||
conf/build.xml
|
||||
conf/config/pmvcgen.log.properties
|
||||
conf/config/pmvcgen.properties
|
||||
conf/example/author.properties
|
||||
conf/example/proj.properties
|
||||
conf/templates/.DS_Store
|
||||
conf/templates/Event.tpl
|
||||
conf/templates/standard/Application.tpl
|
||||
conf/templates/standard/Facade.tpl
|
||||
conf/templates/standard/MacroCommand.tpl
|
||||
conf/templates/standard/Mediator.tpl
|
||||
conf/templates/standard/Proxy.tpl
|
||||
conf/templates/standard/SimpleCommand.tpl
|
||||
lib/pure_m_v_c_gen.rb
|
||||
lib/pure_m_v_c_gen/version.rb
|
||||
test/test_pure_m_v_c_gen.rb
|
48
README.txt
Normal file
48
README.txt
Normal file
@ -0,0 +1,48 @@
|
||||
= PureMVCGen
|
||||
|
||||
* FIX (url)
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
FIX (describe your package)
|
||||
|
||||
== FEATURES/PROBLEMS:
|
||||
|
||||
* FIX (list of features or problems)
|
||||
|
||||
== SYNOPSIS:
|
||||
|
||||
FIX (code sample of usage)
|
||||
|
||||
== REQUIREMENTS:
|
||||
|
||||
* FIX (list of requirements)
|
||||
|
||||
== INSTALL:
|
||||
|
||||
* FIX (sudo gem install, anything else)
|
||||
|
||||
== LICENSE:
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2008 FIX
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
32
Rakefile
Normal file
32
Rakefile
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- ruby -*-
|
||||
|
||||
require 'rubygems'
|
||||
require 'hoe'
|
||||
require './lib/pure_m_v_c_gen/version.rb'
|
||||
|
||||
PKG_NAME = "puremvc-gen"
|
||||
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
||||
version = PureMVCGen::Version::STRING.dup
|
||||
if ENV['SNAPSHOT'].to_i == 1
|
||||
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
|
||||
end
|
||||
PKG_VERSION = version
|
||||
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
||||
|
||||
Hoe.new(PKG_NAME, PKG_VERSION) do |p|
|
||||
p.rubyforge_name = 'gjastrab' # if different than lowercase project name
|
||||
p.developer('Greg Jastrab', 'gjastrab.dev@gmail.com')
|
||||
p.name = PKG_NAME
|
||||
p.version = PKG_VERSION
|
||||
#p.platform = Gem::Platform::RUBY
|
||||
p.author = "Greg Jastrab"
|
||||
p.email = "gjastrab.dev@gmail.com"
|
||||
p.description = %q(An ANT-based PureMVC generator.)
|
||||
p.summary = p.description # More details later??
|
||||
p.remote_rdoc_dir = PKG_NAME # Release to /PKG_NAME
|
||||
# p.changes = p.paragraphs_of('CHANGELOG', 0..1).join("\n\n")
|
||||
p.need_zip = true
|
||||
p.need_tar = false
|
||||
end
|
||||
|
||||
# vim: syntax=Ruby
|
6
bin/puremvc-gen
Normal file
6
bin/puremvc-gen
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
puts "About to run the ant script"
|
||||
|
||||
path = File.join(File.dirname(__FILE__), '..', 'conf', 'build.xml')
|
||||
system "ant -f #{path}"
|
367
conf/build.xml
Normal file
367
conf/build.xml
Normal file
@ -0,0 +1,367 @@
|
||||
<?xml version="1.0"?>
|
||||
<project default="info">
|
||||
|
||||
<property environment="env" />
|
||||
|
||||
<!-- ********************** PROPERTY INITIALIZATION TASKS ********************** -->
|
||||
|
||||
<target name="set-pmvc-gen-conditions">
|
||||
<condition property="pmvcgen.home.set">
|
||||
<isset property="env.PMVC_GEN_HOME" />
|
||||
</condition>
|
||||
<condition property="pmvcgen.dir.set">
|
||||
<isset property="pmvcgen.dir" />
|
||||
</condition>
|
||||
<condition property="in.pmvcgen.dir">
|
||||
<and>
|
||||
<available file="config" />
|
||||
<available file="config/pmvcgen.properties" />
|
||||
<available file="config/pmvcgen.log.properties" />
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="set-project-conditions">
|
||||
<condition property="proj.dir.set">
|
||||
<isset property="proj.dir" />
|
||||
</condition>
|
||||
<condition property="proj.properties.available">
|
||||
<available file="proj.properties" />
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="read-properties" description="Reads in property files in at least an obtrusive way as possible."
|
||||
depends="set-pmvc-gen-conditions,pmvc-gen-properties,set-project-conditions,project-properties">
|
||||
<echo>Read in PureMVCGen and project properties.</echo>
|
||||
</target>
|
||||
|
||||
<target name="pmvc-gen-properties" description="Determines PureMVCGen properties."
|
||||
depends="pmvc-gen-properties-from-env-home,pmvc-gen-properties-from-pmvcgen-dir,pmvc-gen-properties-from-within-pmvcgen-dir">
|
||||
<echo>PureMVCGen Properties have been set.</echo>
|
||||
</target>
|
||||
|
||||
<target name="pmvc-gen-properties-from-env-home" if="pmvcgen.home.set">
|
||||
<condition property="pmvcgen.home.valid">
|
||||
<and>
|
||||
<available file="${env.PMVC_GEN_HOME}" />
|
||||
<available file="${env.PMVC_GEN_HOME}/config" />
|
||||
<available file="${env.PMVC_GEN_HOME}/config/pmvcgen.properties" />
|
||||
<available file="${env.PMVC_GEN_HOME}/config/pmvcgen.log.properties" />
|
||||
</and>
|
||||
</condition>
|
||||
<fail message="PMVC_GEN_HOME is not set to a valid directory." unless="pmvcgen.home.valid" />
|
||||
<property file="${env.PMVC_GEN_HOME}/config/pmvcgen.properties" />
|
||||
<property file="${env.PMVC_GEN_HOME}/config/pmvcgen.log.properties" />
|
||||
<property name="pmvcgen.dir" value="${env.PMVC_GEN_HOME}" />
|
||||
</target>
|
||||
|
||||
<target name="pmvc-gen-properties-from-pmvcgen-dir" if="pmvcgen.dir.set">
|
||||
<condition property="pmvcgen.dir.valid">
|
||||
<and>
|
||||
<available file="${pmvcgen.dir}" />
|
||||
<available file="${pmvcgen.dir}/config" />
|
||||
<available file="${pmvcgen.dir}/config/pmvcgen.properties" />
|
||||
<available file="${pmvcgen.dir}/config/pmvcgen.log.properties" />
|
||||
</and>
|
||||
</condition>
|
||||
<fail message="The pmvcgen.dir is not pointing to a valid PureMVCGen directory." unless="pmvcgen.dir.valid" />
|
||||
<property file="${pmvcgen.dir}/config/pmvcgen.properties" />
|
||||
<property file="${pmvcgen.dir}/config/pmvcgen.log.properties" />
|
||||
</target>
|
||||
|
||||
<target name="pmvc-gen-properties-from-within-pmvcgen-dir" if="in.pmvcgen.dir">
|
||||
<property file="config/pmvcgen.properties" />
|
||||
<property file="config/pmvcgen.log.properties" />
|
||||
</target>
|
||||
|
||||
<target name="project-properties" description="Determines project properties."
|
||||
depends="project-properties-from-project-dir,project-properties-from-basedir">
|
||||
</target>
|
||||
|
||||
<target name="project-properties-from-project-dir" if="proj.dir.set">
|
||||
<condition property="proj.dir.valid">
|
||||
<and>
|
||||
<available file="${proj.dir}" />
|
||||
<available file="${proj.dir}/proj.properties" />
|
||||
</and>
|
||||
</condition>
|
||||
<fail message="The proj.dir (${proj.dir}) either doesn't exist or it doesn't contain a proj.properties file!"
|
||||
unless="proj.dir.valid" />
|
||||
<property file="${proj.dir}/proj.properties" />
|
||||
<property file="${proj.dir}/author.properties" />
|
||||
</target>
|
||||
|
||||
<target name="project-properties-from-basedir" if="proj.properties.available">
|
||||
<property file="proj.properties" />
|
||||
<property file="${proj.dir}/author.properties" />
|
||||
</target>
|
||||
|
||||
<target name="validate-properties" description="Ensures all required properties have been set"
|
||||
depends="read-properties">
|
||||
<!-- Validate PureMVCGen Properties -->
|
||||
<condition property="pmvcgen.properties.are.set">
|
||||
<and>
|
||||
<isset property="model.dir" />
|
||||
<isset property="view.dir" />
|
||||
<isset property="controller.dir" />
|
||||
<isset property="events.dir" />
|
||||
<isset property="templates.dir" />
|
||||
</and>
|
||||
</condition>
|
||||
<fail unless="pmvcgen.properties.are.set">
|
||||
<![CDATA[ERROR:
|
||||
All required PureMVCGen properties have not been set.
|
||||
Please verify you are either:
|
||||
1. Setting the PMVC_GEN_HOME environment variable to point to the PureMVCGen directory
|
||||
2. Setting the pmvcgen.dir property
|
||||
3. Running this build file from within the PureMVCGen directory
|
||||
Required PureMVCGen properties are:
|
||||
-model.dir => name for the model directory ("model" by default)
|
||||
-view.dir => name for the view directory ("view" by default)
|
||||
-controller.dir => name for the controller directory ("controller" by default)
|
||||
-events.dir => name for the events directory ("events" by default)]]>
|
||||
</fail>
|
||||
<!-- Validate Project Properties -->
|
||||
<condition property="project.properties.are.set">
|
||||
<and>
|
||||
<isset property="app.prefix" />
|
||||
<isset property="project.name" />
|
||||
<isset property="core.namespace" />
|
||||
<isset property="core.dir" />
|
||||
<isset property="pmvc.flavor" />
|
||||
</and>
|
||||
</condition>
|
||||
<fail unless="project.properties.are.set">
|
||||
<![CDATA[ERROR:
|
||||
All required project properties have not been set.
|
||||
Please verify you are including the necessary .properties files.
|
||||
Required project properties are:
|
||||
-app.prefix => Prefix you'd like prepended to your Facade and Application Mediator
|
||||
-project.name => Name of the project which will be used to create the main MXML file
|
||||
-core.namespace => Core package structure (where PureMVC directories and Facade will be placed)
|
||||
Example: com.slslabs.puremvc.generator
|
||||
-core.dir => Directory location of core package structure. This should just be the core.namespace with the .'s replaced with /'s
|
||||
Example: com/slslabs/puremvc/generator
|
||||
-pmvc.flavor => standard / multicore]]>
|
||||
</fail>
|
||||
<property name="all.properties.valid" value="true" />
|
||||
<echo>All properties have been read in and verified.</echo>
|
||||
</target>
|
||||
|
||||
<target name="init" description="Initializes project environment."
|
||||
depends="validate-properties">
|
||||
<!-- determine standard vs multicore -->
|
||||
<property name="event.template" value="${pmvcgen.dir}/${templates.dir}/Event.tpl" />
|
||||
<property name="app.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Application.tpl" />
|
||||
<property name="facade.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Facade.tpl" />
|
||||
<property name="macro.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/MacroCommand.tpl" />
|
||||
<property name="mediator.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Mediator.tpl" />
|
||||
<property name="proxy.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Proxy.tpl" />
|
||||
<property name="simple.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/SimpleCommand.tpl" />
|
||||
|
||||
<tstamp>
|
||||
<format property="today" pattern="MM/dd/yyyy" />
|
||||
</tstamp>
|
||||
</target>
|
||||
|
||||
<target name="info" description="Outputs the current PureMVC classes in the project.">
|
||||
<echo>Basedir is: ${basedir}</echo>
|
||||
</target>
|
||||
|
||||
<target name="strip-comments" description="Strips the //pmvcgen: comments from all files."
|
||||
depends="init">
|
||||
</target>
|
||||
|
||||
<target name="new-pmvc" description="Creates the core project directories, generates the Facade, StartupCommand, and main MXML file."
|
||||
depends="init,create-dirs,create-main-mxml,create-facade,create-startup-command,create-prepare-actors-command,create-application-mediator">
|
||||
</target>
|
||||
|
||||
<target name="create-dirs" description="Creates the core project directories.">
|
||||
<echo>Creating PureMVC Core project directory: ${core.dir}</echo>
|
||||
<mkdir dir="${core.dir}" />
|
||||
<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}/${events.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="set-filters">
|
||||
<filterset id="common.filters">
|
||||
<filter token="app.prefix" value="${app.prefix}" />
|
||||
<filter token="project.name" value="${project.name}" />
|
||||
<filter token="namespace" value="${core.namespace}" />
|
||||
<filter token="model" value="${model.dir}" />
|
||||
<filter token="view" value="${view.dir}" />
|
||||
<filter token="ctrls" value="${controller.dir}" />
|
||||
<filter token="author.name" value="${author.name}" />
|
||||
<filter token="author.email" value=" <${author.email}>" />
|
||||
<filter token="version" value="${version}" />
|
||||
<filter token="today" value="${today}" />
|
||||
</filterset>
|
||||
</target>
|
||||
|
||||
<!-- ********************** GENERATION TASKS ********************** -->
|
||||
|
||||
<target name="create-main-mxml" depends="init,set-filters"
|
||||
description="Creates the main MXML class, initializing the Facade and sending the startup command.">
|
||||
<echo>Creating main MXML for PureMVC project.</echo>
|
||||
<copy file="${app.template}"
|
||||
toFile="${project.name}.mxml">
|
||||
<filterset refid="common.filters" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-event" depends="init,set-filters"
|
||||
description="Creates a new event class.">
|
||||
<echo>${log.gen.event}</echo>
|
||||
<input message="Specify the name of the new event class you wish to create:" addproperty="event.class.name" />
|
||||
<copy file="${event.template}"
|
||||
toFile="${core.dir}/${events.dir}/${event.class.name}.as">
|
||||
<filterset refid="common.filters" />
|
||||
<filterset>
|
||||
<filter token="event.name" value="${event.class.name}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-facade" depends="init,set-filters" description="Creates the facade class.">
|
||||
<echo>${log.gen.facade}</echo>
|
||||
<copy file="${facade.template}"
|
||||
toFile="${core.dir}/${app.prefix}Facade.as">
|
||||
<filterset refid="common.filters" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-macro-command" depends="init,prompt-command-name,set-filters"
|
||||
description="Creates a MacroCommand">
|
||||
<echo>${log.gen.macro.command}</echo>
|
||||
<copy file="${macro.template}"
|
||||
toFile="${core.dir}/${controller.dir}/${cmd.name}Command.as">
|
||||
<filterset refid="common.filters" />
|
||||
<filterset>
|
||||
<filter token="command.name" value="${cmd.name}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
<replace file="${core.dir}/${app.prefix}Facade.as"
|
||||
token="//pmvcgen:register commands">
|
||||
<replacevalue><![CDATA[registerCommand(/* CONST FOR COMMAND */, PMVCGenCommand);
|
||||
//pmvcgen:register commands]]></replacevalue>
|
||||
<replacefilter token="PMVCGenCommand" value="${cmd.name}Command" />
|
||||
</replace>
|
||||
</target>
|
||||
|
||||
<target name="create-simple-command" depends="init,prompt-command-name,set-filters"
|
||||
description="Creates a SimpleCommand">
|
||||
<echo>${log.gen.simple.command}</echo>
|
||||
<copy file="${simple.template}"
|
||||
toFile="${core.dir}/${controller.dir}/${cmd.name}Command.as">
|
||||
<filterset refid="common.filters" />
|
||||
<filterset>
|
||||
<filter token="command.name" value="${cmd.name}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-mediator" depends="init,prompt-mediator-name,set-filters"
|
||||
description="Creates a Mediator">
|
||||
<echo>${log.gen.mediator}</echo>
|
||||
<copy file="${mediator.template}"
|
||||
toFile="${core.dir}/${view.dir}/${mediator.name}Mediator.as">
|
||||
<filterset refid="common.filters" />
|
||||
<filterset>
|
||||
<filter token="facade" value="${app.prefix}Facade" />
|
||||
<filter token="mediator.name" value="${mediator.name}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-proxy" depends="init,prompt-proxy-name,set-filters"
|
||||
description="Creates a Proxy">
|
||||
<echo>${log.gen.proxy}</echo>
|
||||
<copy file="${proxy.template}"
|
||||
toFile="${core.dir}/${model.dir}/${proxy.name}Proxy.as">
|
||||
<filterset refid="common.filters" />
|
||||
<filterset>
|
||||
<filter token="facade" value="${app.prefix}Facade" />
|
||||
<filter token="proxy.name" value="${proxy.name}" />
|
||||
</filterset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="create-startup-command" depends="init" description="Creates the StartupCommand">
|
||||
<echo>${log.gen.startup.command}</echo>
|
||||
<antcall target="create-macro-command">
|
||||
<param name="cmd.name" value="Startup" />
|
||||
</antcall>
|
||||
<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">
|
||||
<echo>${log.gen.prepare.command}</echo>
|
||||
<antcall target="create-simple-command">
|
||||
<param name="cmd.name" value="PrepareActors" />
|
||||
</antcall>
|
||||
<replace file="${core.dir}/${controller.dir}/PrepareActorsCommand.as"
|
||||
token="//pmvcgen:insert imports">
|
||||
<replacevalue><![CDATA[import @namespace@.@model.dir@.*;
|
||||
import @namespace@.@view.dir@.*;]]></replacevalue>
|
||||
<replacefilter token="@namespace@" value="${core.namespace}" />
|
||||
<replacefilter token="@model.dir@" value="${model.dir}" />
|
||||
<replacefilter token="@view.dir@" value="${view.dir}" />
|
||||
</replace>
|
||||
<replace file="${core.dir}/${controller.dir}/PrepareActorsCommand.as"
|
||||
token="//pmvcgen:insert command logic">
|
||||
<replacevalue><![CDATA[//pmvcgen:register proxies
|
||||
|
||||
//pmvcgen:register mediators]]></replacevalue>
|
||||
</replace>
|
||||
</target>
|
||||
|
||||
<target name="create-application-mediator" depends="init" description="Creates the Application mediator.">
|
||||
<echo></echo>
|
||||
<antcall target="create-mediator">
|
||||
<param name="mediator.name" value="${app.prefix}" />
|
||||
</antcall>
|
||||
<replace file="${core.dir}/${view.dir}/${app.prefix}Mediator.as">
|
||||
<replacefilter token="YOURVIEWNAME" value="app" />
|
||||
<replacefilter token="YOURVIEWOBJ" value="${project.name}" />
|
||||
</replace>
|
||||
</target>
|
||||
|
||||
<!-- ********************** PROMPT TASKS ********************** -->
|
||||
|
||||
<target name="prompt-command-name" unless="cmd.name"
|
||||
description="Prompts the user to enter a command name, unless cmd.name is already set.">
|
||||
<input message="${log.prompt.command}" addproperty="cmd.name" />
|
||||
<condition property="do.abort">
|
||||
<length string="${cmd.name}" length="0" />
|
||||
</condition>
|
||||
<fail message="${log.fail.command.name}" if="do.abort" />
|
||||
<input message="${log.prompt.command.constant}" addproperty="cmd.const" />
|
||||
<condition property="do.abort">
|
||||
<length string="${cmd.const}" length="0" />
|
||||
</condition>
|
||||
<fail message="${log.fail.command.constant}" if="do.abort" />
|
||||
</target>
|
||||
|
||||
<target name="prompt-mediator-name" unless="mediator.name"
|
||||
description="Prompts the user to enter a mediator name, unless mediator.name is already set.">
|
||||
<input message="${log.prompt.mediator}" addproperty="mediator.name" />
|
||||
<condition property="do.abort">
|
||||
<length string="${mediator.name}" length="0" />
|
||||
</condition>
|
||||
<fail message="${log.fail.mediator.name}" if="do.abort" />
|
||||
</target>
|
||||
|
||||
<target name="prompt-proxy-name" unless="proxy.name"
|
||||
description="Prompts the user to enter a proxy name, unless proxy.name is already set.">
|
||||
<input message="${log.prompt.proxy}" addproperty="proxy.name" />
|
||||
<condition property="do.abort">
|
||||
<length string="${proxy.name}" length="0" />
|
||||
</condition>
|
||||
<fail message="${log.fail.proxy.name}" if="do.abort" />
|
||||
</target>
|
||||
|
||||
</project>
|
25
conf/config/pmvcgen.log.properties
Normal file
25
conf/config/pmvcgen.log.properties
Normal file
@ -0,0 +1,25 @@
|
||||
##### =============== ERROR MESSAGES =============== #####
|
||||
log.invalid.properties = All required properties have not been set. Please verify you are including the necessary .properties files.
|
||||
log.no.core.namespace = core.namespace is not set! The PureMVC-Gen convention is to specify this in a proj.properties file.
|
||||
log.no.pmvcgen.home = The PMVC_GEN_HOME environment variable is not set! Be sure to set it and point it to the location of your PureMVCGen directory.
|
||||
|
||||
##### =============== GENERATION MESSAGES =============== #####
|
||||
log.gen.facade = Creating PureMVC Facade class: ${core.namespace}.${app.prefix}Facade
|
||||
log.gen.macro.command = Creating PureMVC MacroCommand class => ${cmd.name}
|
||||
log.gen.simple.command = Creating PureMVC SimpleCommand class => ${cmd.name}
|
||||
log.gen.startup.command = Creating PureMVC StartupCommand
|
||||
log.gen.prepare.command = Creating PureMVC PrepareActorsCommand
|
||||
log.gen.mediator.command = Creating PureMVC Mediator class => ${mediator.name}
|
||||
log.gen.proxy.command = Creating PureMVC Proxy class => ${proxy.name}
|
||||
|
||||
##### =============== PROMPT MESSAGES =============== #####
|
||||
log.prompt.command.name = Enter the name of the command you'd like to create. (i.e., <YourCommandName> generates ==> <YourCommandName>Command.as)
|
||||
log.prompt.command.constant = Enter the name of the constant to be associated with the command.
|
||||
log.prompt.mediator.name = Enter the name of the mediator you'd like to create. (i.e., <YourMediatorName> generates ==> <YourMediatorName>Mediator.as)
|
||||
log.prompt.proxy.name = Enter the name of the proxy you'd like to create. (i.e., <YourProxyName> generates ==> <YourProxyName>Proxy.as)
|
||||
|
||||
##### =============== PROMPT MESSAGES =============== #####
|
||||
log.fail.command.name = You must enter a name for the command!
|
||||
log.fail.command.constant = You must enter a constant for the comman!
|
||||
log.fail.mediator.name = You must enter a name for the mediator!
|
||||
log.fail.proxy.name = You must enter a name for the proxy!
|
7
conf/config/pmvcgen.properties
Normal file
7
conf/config/pmvcgen.properties
Normal file
@ -0,0 +1,7 @@
|
||||
##### =============== PureMVC GEN PROPERTIES =============== #####
|
||||
model.dir = model
|
||||
view.dir = view
|
||||
controller.dir = controller
|
||||
events.dir = events
|
||||
|
||||
templates.dir = templates
|
2
conf/example/author.properties
Normal file
2
conf/example/author.properties
Normal file
@ -0,0 +1,2 @@
|
||||
author.name = Greg Jastrab
|
||||
author.email = greg@smartlogicsolutions.com
|
9
conf/example/proj.properties
Normal file
9
conf/example/proj.properties
Normal file
@ -0,0 +1,9 @@
|
||||
##### =============== PROJECT PROPERTIES =============== #####
|
||||
app.prefix = PMVCGen
|
||||
project.name = PMVCGenDemo
|
||||
core.namespace = net.slsdev.utils.pmvc.demo
|
||||
core.dir = net/slsdev/utils/pmvc/demo
|
||||
version = 1.0
|
||||
|
||||
##### =============== PureMVC PROPERTIES =============== #####
|
||||
pmvc.flavor = standard
|
55
conf/templates/Event.tpl
Normal file
55
conf/templates/Event.tpl
Normal file
@ -0,0 +1,55 @@
|
||||
@copy@
|
||||
package @namespace@.@events@ {
|
||||
|
||||
import flash.events.Event;
|
||||
|
||||
/**
|
||||
* Event description here.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @event.name@ extends Event {
|
||||
|
||||
/* --- Variables --- */
|
||||
|
||||
//pmvcgen:varconsts
|
||||
|
||||
/* === Variables === */
|
||||
|
||||
/* --- Constructor --- */
|
||||
|
||||
public function @event.name@(type:String) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
/* === Constructor === */
|
||||
|
||||
/* --- Functions --- */
|
||||
|
||||
/**
|
||||
* Clones the @event.name@.
|
||||
*
|
||||
* @return Duplicates an instance of an Event subclass
|
||||
*/
|
||||
public function clone():Event {
|
||||
var evt:@event.name@ = new @event.name@(type);
|
||||
return evt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the event to a string.
|
||||
*
|
||||
* @return Returns a string containing all the properties of the Event object
|
||||
*/
|
||||
override public function toString():String {
|
||||
return formatToString("@event.name@", "type");
|
||||
}
|
||||
|
||||
/* === Functions === */
|
||||
|
||||
}
|
||||
|
||||
}
|
13
conf/templates/standard/Application.tpl
Normal file
13
conf/templates/standard/Application.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
creationComplete="facade.startup(this)">
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import @namespace@.@app.prefix@Facade;
|
||||
|
||||
private var facade:@app.prefix@Facade = @app.prefix@Facade.getInstance();
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
</mx:Application>
|
51
conf/templates/standard/Facade.tpl
Normal file
51
conf/templates/standard/Facade.tpl
Normal file
@ -0,0 +1,51 @@
|
||||
package @namespace@ {
|
||||
|
||||
import @namespace@.@ctrls@.*;
|
||||
|
||||
import org.puremvc.as3.patterns.facade.Facade;
|
||||
|
||||
/**
|
||||
* Application Facade.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @app.prefix@Facade extends Facade {
|
||||
|
||||
/* --- Variables --- */
|
||||
|
||||
public static const STARTUP:String = "startup";
|
||||
|
||||
//pmvcgen:varconsts
|
||||
|
||||
/* === Variables === */
|
||||
|
||||
/* --- Functions --- */
|
||||
|
||||
public static function getInstance():@app.prefix@Facade {
|
||||
if(instance == null)
|
||||
instance = new @app.prefix@Facade();
|
||||
return instance as @app.prefix@Facade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts up @project.name@.
|
||||
*
|
||||
* @param app reference to the application
|
||||
*/
|
||||
public function startup(app:@project.name@):void {
|
||||
sendNotification(STARTUP, app);
|
||||
}
|
||||
|
||||
override protected function initializeController():void {
|
||||
super.initializeController();
|
||||
//pmvcgen:register commands
|
||||
}
|
||||
|
||||
/* === Functions === */
|
||||
|
||||
}
|
||||
|
||||
}
|
24
conf/templates/standard/MacroCommand.tpl
Normal file
24
conf/templates/standard/MacroCommand.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
package @namespace@.@ctrls@ {
|
||||
|
||||
//pmvcgen:import commands
|
||||
|
||||
import org.puremvc.as3.interfaces.INotification;
|
||||
import org.puremvc.as3.patterns.command.MacroCommand;
|
||||
|
||||
/**
|
||||
* @command.name@ command.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @command.name@Command extends MacroCommand {
|
||||
|
||||
override protected function initializeMacroCommand():void {
|
||||
//pmvcgen:chain simple commands
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
56
conf/templates/standard/Mediator.tpl
Normal file
56
conf/templates/standard/Mediator.tpl
Normal file
@ -0,0 +1,56 @@
|
||||
package @namespace@.@view@ {
|
||||
|
||||
import @namespace@.@facade@;
|
||||
|
||||
import org.puremvc.as3.patterns.mediator.Mediator;
|
||||
|
||||
/**
|
||||
* @mediator.name@ mediator.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @mediator.name@Mediator extends Mediator {
|
||||
|
||||
/* --- Variables --- */
|
||||
|
||||
public static const NAME:String = "@mediator.name@Mediator";
|
||||
|
||||
/* === Variables === */
|
||||
|
||||
/* --- Constructor --- */
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param viewComponent view component for mediator
|
||||
*/
|
||||
public function @mediator.name@Mediator(viewComponent:Object) {
|
||||
super(NAME, viewComponent);
|
||||
}
|
||||
|
||||
/* === Constructor === */
|
||||
|
||||
/* --- Functions --- */
|
||||
|
||||
override public function handleNotification(note:INotification):void {
|
||||
}
|
||||
|
||||
override public function listNotificationInterests():Array {
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/* === Functions === */
|
||||
|
||||
/* --- Public Accessors --- */
|
||||
|
||||
public function get YOURVIEWNAME():YOURVIEWOBJ { return viewComponent as YOURVIEWOBJ; }
|
||||
|
||||
/* === Public Accessors === */
|
||||
|
||||
}
|
||||
|
||||
}
|
50
conf/templates/standard/Proxy.tpl
Normal file
50
conf/templates/standard/Proxy.tpl
Normal file
@ -0,0 +1,50 @@
|
||||
package @namespace@.@model@ {
|
||||
|
||||
import @namespace@.@facade@;
|
||||
|
||||
import org.puremvc.as3.patterns.proxy.Proxy;
|
||||
|
||||
/**
|
||||
* @proxy.name@ proxy.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @proxy.name@Proxy extends Proxy {
|
||||
|
||||
/* --- Variables --- */
|
||||
|
||||
public static const NAME:String = "@proxy.name@Proxy";
|
||||
|
||||
/* === Variables === */
|
||||
|
||||
/* --- Constructor --- */
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param data data model for proxy
|
||||
*/
|
||||
public function @proxy.name@Proxy(data:Object=null) {
|
||||
super(NAME, data);
|
||||
}
|
||||
|
||||
/* === Constructor === */
|
||||
|
||||
/* --- Functions --- */
|
||||
|
||||
//addfunctions
|
||||
|
||||
/* === Functions === */
|
||||
|
||||
/* --- Public Accessors --- */
|
||||
|
||||
public function get data():Object { return data; }
|
||||
|
||||
/* === Public Accessors === */
|
||||
|
||||
}
|
||||
|
||||
}
|
24
conf/templates/standard/SimpleCommand.tpl
Normal file
24
conf/templates/standard/SimpleCommand.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
package @namespace@.@ctrls@ {
|
||||
|
||||
//pmvcgen:insert imports
|
||||
|
||||
import org.puremvc.as3.interfaces.INotification;
|
||||
import org.puremvc.as3.patterns.command.SimpleCommand;
|
||||
|
||||
/**
|
||||
* @command.name@ command.
|
||||
*
|
||||
* @langversion ActionScript 3.0
|
||||
* @author @author.name@ @author.email@
|
||||
* @date @today@
|
||||
* @version @version@
|
||||
*/
|
||||
public class @command.name@Command extends SimpleCommand {
|
||||
|
||||
override public function execute(note:INotification):void {
|
||||
//pmvcgen:insert command logic
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
0
lib/pure_m_v_c_gen.rb
Normal file
0
lib/pure_m_v_c_gen.rb
Normal file
20
lib/pure_m_v_c_gen/version.rb
Normal file
20
lib/pure_m_v_c_gen/version.rb
Normal file
@ -0,0 +1,20 @@
|
||||
module PureMVCGen
|
||||
module Version #:nodoc:
|
||||
# A method for comparing versions of required modules. It expects two
|
||||
# arrays of integers as parameters, the first being the minimum version
|
||||
# required, and the second being the actual version available. It returns
|
||||
# true if the actual version is at least equal to the required version.
|
||||
def self.check(required, actual) #:nodoc:
|
||||
required = required.map { |v| "%06d" % v }.join(".")
|
||||
actual = actual.map { |v| "%06d" % v }.join(".")
|
||||
return actual >= required
|
||||
end
|
||||
|
||||
MAJOR = 0
|
||||
MINOR = 1
|
||||
TINY = 0
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join(".")
|
||||
end
|
||||
end
|
||||
|
37
puremvc-gen.gemspec
Normal file
37
puremvc-gen.gemspec
Normal file
@ -0,0 +1,37 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{puremvc-gen}
|
||||
s.version = "0.1.0"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Greg Jastrab"]
|
||||
s.date = %q{2008-12-02}
|
||||
s.default_executable = %q{puremvc-gen}
|
||||
s.description = %q{An ANT-based PureMVC generator.}
|
||||
s.email = %q{gjastrab.dev@gmail.com}
|
||||
s.executables = ["puremvc-gen"]
|
||||
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
||||
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/puremvc-gen", "conf/build.xml", "conf/config/pmvcgen.log.properties", "conf/config/pmvcgen.properties", "conf/example/author.properties", "conf/example/proj.properties", "conf/templates/.DS_Store", "conf/templates/Event.tpl", "conf/templates/standard/Application.tpl", "conf/templates/standard/Facade.tpl", "conf/templates/standard/MacroCommand.tpl", "conf/templates/standard/Mediator.tpl", "conf/templates/standard/Proxy.tpl", "conf/templates/standard/SimpleCommand.tpl", "lib/pure_m_v_c_gen.rb", "lib/pure_m_v_c_gen/version.rb", "test/test_pure_m_v_c_gen.rb"]
|
||||
s.has_rdoc = true
|
||||
s.homepage = %q{FIX (url)}
|
||||
s.rdoc_options = ["--main", "README.txt"]
|
||||
s.require_paths = ["lib"]
|
||||
s.rubyforge_project = %q{gjastrab}
|
||||
s.rubygems_version = %q{1.3.1}
|
||||
s.summary = %q{An ANT-based PureMVC generator.}
|
||||
s.test_files = ["test/test_pure_m_v_c_gen.rb"]
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||
s.specification_version = 2
|
||||
|
||||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
||||
else
|
||||
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
||||
end
|
||||
else
|
||||
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
||||
end
|
||||
end
|
0
test/test_pure_m_v_c_gen.rb
Normal file
0
test/test_pure_m_v_c_gen.rb
Normal file
Loading…
Reference in New Issue
Block a user