gjastrab-puremvc-gen 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +11 -0
- data/Manifest.txt +27 -0
- data/README.txt +104 -0
- data/Rakefile +33 -0
- data/bin/puremvc-gen +24 -0
- data/conf/build.xml +381 -0
- data/conf/config/pmvcgen.log.properties +25 -0
- data/conf/config/pmvcgen.properties +7 -0
- data/conf/example/author.properties +2 -0
- data/conf/example/proj.properties +9 -0
- data/conf/templates/Event.tpl +55 -0
- data/conf/templates/standard/Application.tpl +13 -0
- data/conf/templates/standard/Facade.tpl +51 -0
- data/conf/templates/standard/MacroCommand.tpl +24 -0
- data/conf/templates/standard/Mediator.tpl +57 -0
- data/conf/templates/standard/Proxy.tpl +50 -0
- data/conf/templates/standard/SimpleCommand.tpl +24 -0
- data/lib/pure_m_v_c_gen.rb +25 -0
- data/lib/pure_m_v_c_gen/ant_checker.rb +53 -0
- data/lib/pure_m_v_c_gen/commands/check_command.rb +16 -0
- data/lib/pure_m_v_c_gen/commands/command_extensions.rb +14 -0
- data/lib/pure_m_v_c_gen/commands/initialize_command.rb +16 -0
- data/lib/pure_m_v_c_gen/commands/new_command.rb +86 -0
- data/lib/pure_m_v_c_gen/version.rb +21 -0
- data/puremvc-gen.gemspec +40 -0
- data/test/test_pure_m_v_c_gen.rb +0 -0
- metadata +99 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
bin/puremvc-gen
|
6
|
+
conf/build.xml
|
7
|
+
conf/config/pmvcgen.log.properties
|
8
|
+
conf/config/pmvcgen.properties
|
9
|
+
conf/example/author.properties
|
10
|
+
conf/example/proj.properties
|
11
|
+
conf/templates/.DS_Store
|
12
|
+
conf/templates/Event.tpl
|
13
|
+
conf/templates/standard/Application.tpl
|
14
|
+
conf/templates/standard/Facade.tpl
|
15
|
+
conf/templates/standard/MacroCommand.tpl
|
16
|
+
conf/templates/standard/Mediator.tpl
|
17
|
+
conf/templates/standard/Proxy.tpl
|
18
|
+
conf/templates/standard/SimpleCommand.tpl
|
19
|
+
lib/pure_m_v_c_gen.rb
|
20
|
+
lib/pure_m_v_c_gen/ant_checker.rb
|
21
|
+
lib/pure_m_v_c_gen/commands/check_command.rb
|
22
|
+
lib/pure_m_v_c_gen/commands/command_extensions.rb
|
23
|
+
lib/pure_m_v_c_gen/commands/initialize_command.rb
|
24
|
+
lib/pure_m_v_c_gen/commands/new_command.rb
|
25
|
+
lib/pure_m_v_c_gen/version.rb
|
26
|
+
puremvc-gen.gemspec
|
27
|
+
test/test_pure_m_v_c_gen.rb
|
data/README.txt
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
= PureMVCGen
|
2
|
+
|
3
|
+
* http://bit.ly/puremvc-gen
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
PureMVCGen is a ruby gem which wraps an ANT-based code generation
|
8
|
+
utility for generating PureMVC ActionScript code.
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
-Features-
|
13
|
+
|
14
|
+
* Validates project property settings
|
15
|
+
* Generates the skeleton of a new Flex PureMVC project including:
|
16
|
+
- appropriate PureMVC folders
|
17
|
+
- Facade class
|
18
|
+
- StartupCommand and PrepareActorsCommand classes
|
19
|
+
* Generates skeleton PureMVC clases:
|
20
|
+
- SimpleCommand
|
21
|
+
- MacroCommand
|
22
|
+
_ Proxy
|
23
|
+
- Mediator
|
24
|
+
|
25
|
+
-Problems-
|
26
|
+
|
27
|
+
* MultiCore templates not yet created
|
28
|
+
|
29
|
+
== SYNOPSIS:
|
30
|
+
Lines starting with a $ denote the following command should
|
31
|
+
be run on the command line.
|
32
|
+
|
33
|
+
1. Create a proj.properties file in the directory you wish to begin
|
34
|
+
your project
|
35
|
+
|
36
|
+
2. $ puremvc-gen check
|
37
|
+
|
38
|
+
The check command will check if the required properties for a
|
39
|
+
project have been set. If they have not it will denote what
|
40
|
+
the required properties are. Refer to the example settings at
|
41
|
+
the blog post at http://bit.ly/puremvc-gen
|
42
|
+
|
43
|
+
3. Set the required properties in proj.properties
|
44
|
+
|
45
|
+
4. $ puremvc-gen init
|
46
|
+
|
47
|
+
The init command will create the skeleton of a new Flex PureMVC project.
|
48
|
+
|
49
|
+
If you want to create a new command:
|
50
|
+
|
51
|
+
$ puremvc-gen new command -n Example
|
52
|
+
|
53
|
+
which would generate a new SimpleCommand named ExampleCommand.
|
54
|
+
|
55
|
+
For help using puremvc-gen:
|
56
|
+
|
57
|
+
$ puremvc-gen help
|
58
|
+
|
59
|
+
which will output the usage:
|
60
|
+
|
61
|
+
Usage: puremvc-gen [options] COMMAND [options] [COMMAND [options] ...] [args]
|
62
|
+
|
63
|
+
Available commands:
|
64
|
+
check Validates that all required property settings are current detected
|
65
|
+
help Provide help for individual commands
|
66
|
+
init Initializes the current working directory with a new PureMVC project
|
67
|
+
new Command to generate PureMVC classes
|
68
|
+
command Creates a simple or macro command (defaults to simple).
|
69
|
+
mediator Creates a new mediator.
|
70
|
+
proxy Creates a new proxy.
|
71
|
+
version Show the version of the program
|
72
|
+
|
73
|
+
== REQUIREMENTS:
|
74
|
+
|
75
|
+
* Apache ANT: http://ant.apache.org
|
76
|
+
|
77
|
+
== INSTALL:
|
78
|
+
|
79
|
+
* sudo gem install puremvc-gen
|
80
|
+
|
81
|
+
== LICENSE:
|
82
|
+
|
83
|
+
(The MIT License)
|
84
|
+
|
85
|
+
Copyright (c) 2008 FIX
|
86
|
+
|
87
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
88
|
+
a copy of this software and associated documentation files (the
|
89
|
+
'Software'), to deal in the Software without restriction, including
|
90
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
91
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
92
|
+
permit persons to whom the Software is furnished to do so, subject to
|
93
|
+
the following conditions:
|
94
|
+
|
95
|
+
The above copyright notice and this permission notice shall be
|
96
|
+
included in all copies or substantial portions of the Software.
|
97
|
+
|
98
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
99
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
100
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
101
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
102
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
103
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
104
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/pure_m_v_c_gen/version.rb'
|
6
|
+
|
7
|
+
PKG_NAME = "puremvc-gen"
|
8
|
+
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
9
|
+
version = PureMVCGen::Version::STRING.dup
|
10
|
+
if ENV['SNAPSHOT'].to_i == 1
|
11
|
+
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
|
12
|
+
end
|
13
|
+
PKG_VERSION = version
|
14
|
+
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
15
|
+
|
16
|
+
Hoe.new(PKG_NAME, PKG_VERSION) do |p|
|
17
|
+
p.rubyforge_name = 'gjastrab' # if different than lowercase project name
|
18
|
+
p.developer('Greg Jastrab', 'gjastrab.dev@gmail.com')
|
19
|
+
p.name = PKG_NAME
|
20
|
+
p.version = PKG_VERSION
|
21
|
+
#p.platform = Gem::Platform::RUBY
|
22
|
+
p.author = "Greg Jastrab"
|
23
|
+
p.email = "gjastrab.dev@gmail.com"
|
24
|
+
p.description = %q(An ANT-based PureMVC generator.)
|
25
|
+
p.summary = p.description # More details later??
|
26
|
+
p.remote_rdoc_dir = PKG_NAME # Release to /PKG_NAME
|
27
|
+
# p.changes = p.paragraphs_of('CHANGELOG', 0..1).join("\n\n")
|
28
|
+
p.extra_deps << ["cmdparse", ">= 2.0.2"]
|
29
|
+
p.need_zip = true
|
30
|
+
p.need_tar = false
|
31
|
+
end
|
32
|
+
|
33
|
+
# vim: syntax=Ruby
|
data/bin/puremvc-gen
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pure_m_v_c_gen'
|
3
|
+
|
4
|
+
include PureMVCGen::Commands
|
5
|
+
|
6
|
+
PMVC_GEN_HOME = File.join(File.dirname(__FILE__), '..', 'conf')
|
7
|
+
BUILDFILE = File.join(PMVC_GEN_HOME, 'build.xml')
|
8
|
+
|
9
|
+
def call_ant(args='')
|
10
|
+
system "#{ANT_BIN} -f #{File.expand_path BUILDFILE} -Dpmvcgen.dir=#{File.expand_path PMVC_GEN_HOME} -Dbasedir=#{Dir.pwd} #{args}"
|
11
|
+
end
|
12
|
+
|
13
|
+
cmd = CmdParse::CommandParser.new(true, true)
|
14
|
+
cmd.program_name = "puremvc-gen "
|
15
|
+
cmd.program_version = PureMVCGen::Version::ARRAY
|
16
|
+
|
17
|
+
cmd.add_command(CmdParse::HelpCommand.new)
|
18
|
+
cmd.add_command(CmdParse::VersionCommand.new)
|
19
|
+
|
20
|
+
cmd.add_command(CheckCommand.new)
|
21
|
+
cmd.add_command(InitializeCommand.new)
|
22
|
+
cmd.add_command(NewCommand.new)
|
23
|
+
|
24
|
+
cmd.parse
|
data/conf/build.xml
ADDED
@@ -0,0 +1,381 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<project default="info">
|
3
|
+
|
4
|
+
<property environment="env" />
|
5
|
+
|
6
|
+
<!-- ********************** PROPERTY INITIALIZATION TASKS ********************** -->
|
7
|
+
|
8
|
+
<target name="set-pmvc-gen-conditions">
|
9
|
+
<condition property="pmvcgen.home.set">
|
10
|
+
<isset property="env.PMVC_GEN_HOME" />
|
11
|
+
</condition>
|
12
|
+
<condition property="pmvcgen.dir.set">
|
13
|
+
<isset property="pmvcgen.dir" />
|
14
|
+
</condition>
|
15
|
+
<condition property="in.pmvcgen.dir">
|
16
|
+
<and>
|
17
|
+
<available file="config" />
|
18
|
+
<available file="config/pmvcgen.properties" />
|
19
|
+
<available file="config/pmvcgen.log.properties" />
|
20
|
+
</and>
|
21
|
+
</condition>
|
22
|
+
</target>
|
23
|
+
|
24
|
+
<target name="set-project-conditions">
|
25
|
+
<condition property="proj.dir.set">
|
26
|
+
<isset property="proj.dir" />
|
27
|
+
</condition>
|
28
|
+
<condition property="proj.properties.available">
|
29
|
+
<available file="proj.properties" />
|
30
|
+
</condition>
|
31
|
+
</target>
|
32
|
+
|
33
|
+
<target name="read-properties" description="Reads in property files in at least an obtrusive way as possible."
|
34
|
+
depends="set-pmvc-gen-conditions,pmvc-gen-properties,set-project-conditions,project-properties">
|
35
|
+
<echo>Read in PureMVCGen and project properties.</echo>
|
36
|
+
</target>
|
37
|
+
|
38
|
+
<target name="pmvc-gen-properties" description="Determines PureMVCGen properties."
|
39
|
+
depends="pmvc-gen-properties-from-env-home,pmvc-gen-properties-from-pmvcgen-dir,pmvc-gen-properties-from-within-pmvcgen-dir">
|
40
|
+
<echo>PureMVCGen Properties have been set.</echo>
|
41
|
+
</target>
|
42
|
+
|
43
|
+
<target name="pmvc-gen-properties-from-env-home" if="pmvcgen.home.set">
|
44
|
+
<condition property="pmvcgen.home.valid">
|
45
|
+
<and>
|
46
|
+
<available file="${env.PMVC_GEN_HOME}" />
|
47
|
+
<available file="${env.PMVC_GEN_HOME}/config" />
|
48
|
+
<available file="${env.PMVC_GEN_HOME}/config/pmvcgen.properties" />
|
49
|
+
<available file="${env.PMVC_GEN_HOME}/config/pmvcgen.log.properties" />
|
50
|
+
</and>
|
51
|
+
</condition>
|
52
|
+
<fail message="PMVC_GEN_HOME is not set to a valid directory." unless="pmvcgen.home.valid" />
|
53
|
+
<property file="${env.PMVC_GEN_HOME}/config/pmvcgen.properties" />
|
54
|
+
<property file="${env.PMVC_GEN_HOME}/config/pmvcgen.log.properties" />
|
55
|
+
<property name="pmvcgen.dir" value="${env.PMVC_GEN_HOME}" />
|
56
|
+
</target>
|
57
|
+
|
58
|
+
<target name="pmvc-gen-properties-from-pmvcgen-dir" if="pmvcgen.dir.set">
|
59
|
+
<condition property="pmvcgen.dir.valid">
|
60
|
+
<and>
|
61
|
+
<available file="${pmvcgen.dir}" />
|
62
|
+
<available file="${pmvcgen.dir}/config" />
|
63
|
+
<available file="${pmvcgen.dir}/config/pmvcgen.properties" />
|
64
|
+
<available file="${pmvcgen.dir}/config/pmvcgen.log.properties" />
|
65
|
+
</and>
|
66
|
+
</condition>
|
67
|
+
<fail message="The pmvcgen.dir is not pointing to a valid PureMVCGen directory." unless="pmvcgen.dir.valid" />
|
68
|
+
<property file="${pmvcgen.dir}/config/pmvcgen.properties" />
|
69
|
+
<property file="${pmvcgen.dir}/config/pmvcgen.log.properties" />
|
70
|
+
</target>
|
71
|
+
|
72
|
+
<target name="pmvc-gen-properties-from-within-pmvcgen-dir" if="in.pmvcgen.dir">
|
73
|
+
<property file="config/pmvcgen.properties" />
|
74
|
+
<property file="config/pmvcgen.log.properties" />
|
75
|
+
</target>
|
76
|
+
|
77
|
+
<target name="project-properties" description="Determines project properties."
|
78
|
+
depends="project-properties-from-project-dir,project-properties-from-basedir">
|
79
|
+
</target>
|
80
|
+
|
81
|
+
<target name="project-properties-from-project-dir" if="proj.dir.set">
|
82
|
+
<condition property="proj.dir.valid">
|
83
|
+
<and>
|
84
|
+
<available file="${proj.dir}" />
|
85
|
+
<available file="${proj.dir}/proj.properties" />
|
86
|
+
</and>
|
87
|
+
</condition>
|
88
|
+
<fail message="The proj.dir (${proj.dir}) either doesn't exist or it doesn't contain a proj.properties file!"
|
89
|
+
unless="proj.dir.valid" />
|
90
|
+
<property file="${proj.dir}/proj.properties" />
|
91
|
+
<property file="${proj.dir}/author.properties" />
|
92
|
+
</target>
|
93
|
+
|
94
|
+
<target name="project-properties-from-basedir" if="proj.properties.available">
|
95
|
+
<property file="proj.properties" />
|
96
|
+
<property file="${proj.dir}/author.properties" />
|
97
|
+
</target>
|
98
|
+
|
99
|
+
<target name="validate-properties" description="Ensures all required properties have been set"
|
100
|
+
depends="read-properties">
|
101
|
+
<!-- Validate PureMVCGen Properties -->
|
102
|
+
<condition property="pmvcgen.properties.are.set">
|
103
|
+
<and>
|
104
|
+
<isset property="model.dir" />
|
105
|
+
<isset property="view.dir" />
|
106
|
+
<isset property="controller.dir" />
|
107
|
+
<isset property="events.dir" />
|
108
|
+
<isset property="templates.dir" />
|
109
|
+
</and>
|
110
|
+
</condition>
|
111
|
+
<fail unless="pmvcgen.properties.are.set">
|
112
|
+
<![CDATA[ERROR:
|
113
|
+
All required PureMVCGen properties have not been set.
|
114
|
+
Please verify you are either:
|
115
|
+
1. Setting the PMVC_GEN_HOME environment variable to point to the PureMVCGen directory
|
116
|
+
2. Setting the pmvcgen.dir property
|
117
|
+
3. Running this build file from within the PureMVCGen directory
|
118
|
+
Required PureMVCGen properties are:
|
119
|
+
-model.dir => name for the model directory ("model" by default)
|
120
|
+
-view.dir => name for the view directory ("view" by default)
|
121
|
+
-controller.dir => name for the controller directory ("controller" by default)
|
122
|
+
-events.dir => name for the events directory ("events" by default)]]>
|
123
|
+
</fail>
|
124
|
+
<!-- Validate Project Properties -->
|
125
|
+
<condition property="project.properties.are.set">
|
126
|
+
<and>
|
127
|
+
<isset property="app.prefix" />
|
128
|
+
<isset property="project.name" />
|
129
|
+
<isset property="core.namespace" />
|
130
|
+
<isset property="core.dir" />
|
131
|
+
<isset property="pmvc.flavor" />
|
132
|
+
</and>
|
133
|
+
</condition>
|
134
|
+
<fail unless="project.properties.are.set">
|
135
|
+
<![CDATA[ERROR:
|
136
|
+
All required project properties have not been set.
|
137
|
+
Please verify you are including the necessary .properties files.
|
138
|
+
Required project properties are:
|
139
|
+
-app.prefix => Prefix you'd like prepended to your Facade and Application Mediator
|
140
|
+
-project.name => Name of the project which will be used to create the main MXML file
|
141
|
+
-core.namespace => Core package structure (where PureMVC directories and Facade will be placed)
|
142
|
+
Example: com.slslabs.puremvc.generator
|
143
|
+
-core.dir => Directory location of core package structure. This should just be the core.namespace with the .'s replaced with /'s
|
144
|
+
Example: com/slslabs/puremvc/generator
|
145
|
+
-pmvc.flavor => standard / multicore]]>
|
146
|
+
</fail>
|
147
|
+
<property name="all.properties.valid" value="true" />
|
148
|
+
<echo>All properties have been read in and verified.</echo>
|
149
|
+
</target>
|
150
|
+
|
151
|
+
<target name="init" description="Initializes project environment."
|
152
|
+
depends="validate-properties">
|
153
|
+
<!-- determine standard vs multicore -->
|
154
|
+
<property name="event.template" value="${pmvcgen.dir}/${templates.dir}/Event.tpl" />
|
155
|
+
<property name="app.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Application.tpl" />
|
156
|
+
<property name="facade.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Facade.tpl" />
|
157
|
+
<property name="macro.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/MacroCommand.tpl" />
|
158
|
+
<property name="mediator.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Mediator.tpl" />
|
159
|
+
<property name="proxy.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/Proxy.tpl" />
|
160
|
+
<property name="simple.template" value="${pmvcgen.dir}/${templates.dir}/${pmvc.flavor}/SimpleCommand.tpl" />
|
161
|
+
|
162
|
+
<tstamp>
|
163
|
+
<format property="today" pattern="MM/dd/yyyy" />
|
164
|
+
</tstamp>
|
165
|
+
</target>
|
166
|
+
|
167
|
+
<target name="info" description="Outputs the current PureMVC classes in the project.">
|
168
|
+
<echo>Basedir is: ${basedir}</echo>
|
169
|
+
</target>
|
170
|
+
|
171
|
+
<target name="strip-comments" description="Strips the //pmvcgen: comments from all files."
|
172
|
+
depends="init">
|
173
|
+
</target>
|
174
|
+
|
175
|
+
<target name="new-pmvc" description="Creates the core project directories, generates the Facade, StartupCommand, and main MXML file."
|
176
|
+
depends="init,create-dirs,create-main-mxml,create-facade,create-startup-command,create-prepare-actors-command,create-application-mediator">
|
177
|
+
</target>
|
178
|
+
|
179
|
+
<target name="create-dirs" description="Creates the core project directories.">
|
180
|
+
<echo>Creating PureMVC Core project directory: ${core.dir}</echo>
|
181
|
+
<mkdir dir="${core.dir}" />
|
182
|
+
<echo>Creating PureMVC directories in ${core.dir}</echo>
|
183
|
+
<mkdir dir="${core.dir}/${model.dir}" />
|
184
|
+
<mkdir dir="${core.dir}/${view.dir}" />
|
185
|
+
<mkdir dir="${core.dir}/${controller.dir}/components" />
|
186
|
+
<mkdir dir="${core.dir}/${view.dir}/${events.dir}" />
|
187
|
+
</target>
|
188
|
+
|
189
|
+
<target name="set-filters">
|
190
|
+
<filterset id="common.filters">
|
191
|
+
<filter token="app.prefix" value="${app.prefix}" />
|
192
|
+
<filter token="project.name" value="${project.name}" />
|
193
|
+
<filter token="namespace" value="${core.namespace}" />
|
194
|
+
<filter token="model" value="${model.dir}" />
|
195
|
+
<filter token="view" value="${view.dir}" />
|
196
|
+
<filter token="ctrls" value="${controller.dir}" />
|
197
|
+
<filter token="author.name" value="${author.name}" />
|
198
|
+
<filter token="author.email" value=" <${author.email}>" />
|
199
|
+
<filter token="version" value="${version}" />
|
200
|
+
<filter token="today" value="${today}" />
|
201
|
+
</filterset>
|
202
|
+
</target>
|
203
|
+
|
204
|
+
<!-- ********************** GENERATION TASKS ********************** -->
|
205
|
+
|
206
|
+
<target name="create-main-mxml" depends="init,set-filters"
|
207
|
+
description="Creates the main MXML class, initializing the Facade and sending the startup command.">
|
208
|
+
<echo>Creating main MXML for PureMVC project.</echo>
|
209
|
+
<copy file="${app.template}"
|
210
|
+
toFile="${project.name}.mxml">
|
211
|
+
<filterset refid="common.filters" />
|
212
|
+
</copy>
|
213
|
+
</target>
|
214
|
+
|
215
|
+
<target name="create-event" depends="init,set-filters"
|
216
|
+
description="Creates a new event class.">
|
217
|
+
<echo>${log.gen.event}</echo>
|
218
|
+
<input message="Specify the name of the new event class you wish to create:" addproperty="event.class.name" />
|
219
|
+
<copy file="${event.template}"
|
220
|
+
toFile="${core.dir}/${view.dir}/${events.dir}/${event.class.name}.as">
|
221
|
+
<filterset refid="common.filters" />
|
222
|
+
<filterset>
|
223
|
+
<filter token="event.name" value="${event.class.name}" />
|
224
|
+
</filterset>
|
225
|
+
</copy>
|
226
|
+
</target>
|
227
|
+
|
228
|
+
<target name="create-facade" depends="init,set-filters" description="Creates the facade class.">
|
229
|
+
<echo>${log.gen.facade}</echo>
|
230
|
+
<copy file="${facade.template}"
|
231
|
+
toFile="${core.dir}/${app.prefix}Facade.as">
|
232
|
+
<filterset refid="common.filters" />
|
233
|
+
</copy>
|
234
|
+
</target>
|
235
|
+
|
236
|
+
<target name="create-macro-command" depends="init,prompt-command-name,prompt-command-const,set-filters"
|
237
|
+
description="Creates a MacroCommand">
|
238
|
+
<echo>${log.gen.macro.command}</echo>
|
239
|
+
<copy file="${macro.template}"
|
240
|
+
toFile="${core.dir}/${controller.dir}/${cmd.name}Command.as">
|
241
|
+
<filterset refid="common.filters" />
|
242
|
+
<filterset>
|
243
|
+
<filter token="command.name" value="${cmd.name}" />
|
244
|
+
</filterset>
|
245
|
+
</copy>
|
246
|
+
<replace file="${core.dir}/${app.prefix}Facade.as"
|
247
|
+
token="//pmvcgen:register commands">
|
248
|
+
<replacevalue><![CDATA[registerCommand(/* CONST FOR COMMAND */, PMVCGenCommand);
|
249
|
+
//pmvcgen:register commands]]></replacevalue>
|
250
|
+
<replacefilter token="PMVCGenCommand" value="${cmd.name}Command" />
|
251
|
+
<replacefilter token="/* CONST FOR COMMAND */" value="${cmd.const}" />
|
252
|
+
</replace>
|
253
|
+
</target>
|
254
|
+
|
255
|
+
<target name="create-simple-command" depends="init,prompt-command-name,set-filters"
|
256
|
+
description="Creates a SimpleCommand">
|
257
|
+
<echo>${log.gen.simple.command}</echo>
|
258
|
+
<copy file="${simple.template}"
|
259
|
+
toFile="${core.dir}/${controller.dir}/${cmd.name}Command.as">
|
260
|
+
<filterset refid="common.filters" />
|
261
|
+
<filterset>
|
262
|
+
<filter token="command.name" value="${cmd.name}" />
|
263
|
+
</filterset>
|
264
|
+
</copy>
|
265
|
+
</target>
|
266
|
+
|
267
|
+
<target name="create-mediator" depends="init,prompt-mediator-name,set-filters"
|
268
|
+
description="Creates a Mediator">
|
269
|
+
<echo>${log.gen.mediator}</echo>
|
270
|
+
<copy file="${mediator.template}"
|
271
|
+
toFile="${core.dir}/${view.dir}/${mediator.name}Mediator.as">
|
272
|
+
<filterset refid="common.filters" />
|
273
|
+
<filterset>
|
274
|
+
<filter token="facade" value="${app.prefix}Facade" />
|
275
|
+
<filter token="mediator.name" value="${mediator.name}" />
|
276
|
+
</filterset>
|
277
|
+
</copy>
|
278
|
+
</target>
|
279
|
+
|
280
|
+
<target name="create-proxy" depends="init,prompt-proxy-name,set-filters"
|
281
|
+
description="Creates a Proxy">
|
282
|
+
<echo>${log.gen.proxy}</echo>
|
283
|
+
<copy file="${proxy.template}"
|
284
|
+
toFile="${core.dir}/${model.dir}/${proxy.name}Proxy.as">
|
285
|
+
<filterset refid="common.filters" />
|
286
|
+
<filterset>
|
287
|
+
<filter token="facade" value="${app.prefix}Facade" />
|
288
|
+
<filter token="proxy.name" value="${proxy.name}" />
|
289
|
+
</filterset>
|
290
|
+
</copy>
|
291
|
+
</target>
|
292
|
+
|
293
|
+
<target name="create-startup-command" depends="init" description="Creates the StartupCommand">
|
294
|
+
<echo>${log.gen.startup.command}</echo>
|
295
|
+
<antcall target="create-macro-command">
|
296
|
+
<param name="cmd.name" value="Startup" />
|
297
|
+
<param name="cmd.const" value="STARTUP" />
|
298
|
+
</antcall>
|
299
|
+
<replace file="${core.dir}/${controller.dir}/StartupCommand.as"
|
300
|
+
token="//pmvcgen:import commands">
|
301
|
+
<replacevalue><![CDATA[import @namespace@.@controller.dir@.PrepareActorsCommand;
|
302
|
+
//pmvcgen:import commands]]></replacevalue>
|
303
|
+
<replacefilter token="//pmvcgen:chain simple commands" value="addSubCommand(PrepareActorsCommand);" />
|
304
|
+
<replacefilter token="@namespace@" value="${core.namespace}" />
|
305
|
+
<replacefilter token="@controller.dir@" value="${controller.dir}" />
|
306
|
+
</replace>
|
307
|
+
<!--replace file="${core.dir}/${app.prefix}Facade.as"
|
308
|
+
token="/* CONST FOR COMMAND */" value="STARTUP" /-->
|
309
|
+
</target>
|
310
|
+
|
311
|
+
<target name="create-prepare-actors-command" depends="init" description="Creates the PrepareActorsCommand">
|
312
|
+
<echo>${log.gen.prepare.command}</echo>
|
313
|
+
<antcall target="create-simple-command">
|
314
|
+
<param name="cmd.name" value="PrepareActors" />
|
315
|
+
</antcall>
|
316
|
+
<replace file="${core.dir}/${controller.dir}/PrepareActorsCommand.as"
|
317
|
+
token="//pmvcgen:insert imports">
|
318
|
+
<replacevalue><![CDATA[import @namespace@.@model.dir@.*;
|
319
|
+
import @namespace@.@view.dir@.*;]]></replacevalue>
|
320
|
+
<replacefilter token="@namespace@" value="${core.namespace}" />
|
321
|
+
<replacefilter token="@model.dir@" value="${model.dir}" />
|
322
|
+
<replacefilter token="@view.dir@" value="${view.dir}" />
|
323
|
+
</replace>
|
324
|
+
<replace file="${core.dir}/${controller.dir}/PrepareActorsCommand.as"
|
325
|
+
token="//pmvcgen:insert command logic">
|
326
|
+
<replacevalue><![CDATA[//pmvcgen:register proxies
|
327
|
+
|
328
|
+
//pmvcgen:register mediators]]></replacevalue>
|
329
|
+
</replace>
|
330
|
+
</target>
|
331
|
+
|
332
|
+
<target name="create-application-mediator" depends="init" description="Creates the Application mediator.">
|
333
|
+
<echo></echo>
|
334
|
+
<antcall target="create-mediator">
|
335
|
+
<param name="mediator.name" value="${app.prefix}" />
|
336
|
+
</antcall>
|
337
|
+
<replace file="${core.dir}/${view.dir}/${app.prefix}Mediator.as">
|
338
|
+
<replacefilter token="YOURVIEWNAME" value="app" />
|
339
|
+
<replacefilter token="YOURVIEWOBJ" value="${project.name}" />
|
340
|
+
</replace>
|
341
|
+
</target>
|
342
|
+
|
343
|
+
<!-- ********************** PROMPT TASKS ********************** -->
|
344
|
+
|
345
|
+
<target name="prompt-command-name" unless="cmd.name"
|
346
|
+
description="Prompts the user to enter a command name, unless cmd.name is already set.">
|
347
|
+
<input message="${log.prompt.command}" addproperty="cmd.name" />
|
348
|
+
<condition property="do.abort">
|
349
|
+
<length string="${cmd.name}" length="0" />
|
350
|
+
</condition>
|
351
|
+
<fail message="${log.fail.command.name}" if="do.abort" />
|
352
|
+
</target>
|
353
|
+
|
354
|
+
<target name="prompt-command-const" unless="cmd.const"
|
355
|
+
description="Prompts the user to enter a command constant, unless cmd.const is already set.">
|
356
|
+
<input message="${log.prompt.command.constant}" addproperty="cmd.const" />
|
357
|
+
<condition property="do.abort">
|
358
|
+
<length string="${cmd.const}" length="0" />
|
359
|
+
</condition>
|
360
|
+
<fail message="${log.fail.command.constant}" if="do.abort" />
|
361
|
+
</target>
|
362
|
+
|
363
|
+
<target name="prompt-mediator-name" unless="mediator.name"
|
364
|
+
description="Prompts the user to enter a mediator name, unless mediator.name is already set.">
|
365
|
+
<input message="${log.prompt.mediator}" addproperty="mediator.name" />
|
366
|
+
<condition property="do.abort">
|
367
|
+
<length string="${mediator.name}" length="0" />
|
368
|
+
</condition>
|
369
|
+
<fail message="${log.fail.mediator.name}" if="do.abort" />
|
370
|
+
</target>
|
371
|
+
|
372
|
+
<target name="prompt-proxy-name" unless="proxy.name"
|
373
|
+
description="Prompts the user to enter a proxy name, unless proxy.name is already set.">
|
374
|
+
<input message="${log.prompt.proxy}" addproperty="proxy.name" />
|
375
|
+
<condition property="do.abort">
|
376
|
+
<length string="${proxy.name}" length="0" />
|
377
|
+
</condition>
|
378
|
+
<fail message="${log.fail.proxy.name}" if="do.abort" />
|
379
|
+
</target>
|
380
|
+
|
381
|
+
</project>
|