puremvc-gen 0.1.0
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 +6 -0
- data/Manifest.txt +27 -0
- data/README.txt +48 -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/.DS_Store +0 -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/ant_checker.rb +34 -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/lib/pure_m_v_c_gen.rb +23 -0
- data/puremvc-gen.gemspec +40 -0
- data/test/test_pure_m_v_c_gen.rb +0 -0
- metadata +101 -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,48 @@
|
|
1
|
+
= PureMVCGen
|
2
|
+
|
3
|
+
* FIX (url)
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2008 FIX
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
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 -f #{BUILDFILE} -Dpmvcgen.dir=#{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}/${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}/${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>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
##### =============== ERROR MESSAGES =============== #####
|
2
|
+
log.invalid.properties = All required properties have not been set. Please verify you are including the necessary .properties files.
|
3
|
+
log.no.core.namespace = core.namespace is not set! The PureMVC-Gen convention is to specify this in a proj.properties file.
|
4
|
+
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.
|
5
|
+
|
6
|
+
##### =============== GENERATION MESSAGES =============== #####
|
7
|
+
log.gen.facade = Creating PureMVC Facade class: ${core.namespace}.${app.prefix}Facade
|
8
|
+
log.gen.macro.command = Creating PureMVC MacroCommand class => ${cmd.name}
|
9
|
+
log.gen.simple.command = Creating PureMVC SimpleCommand class => ${cmd.name}
|
10
|
+
log.gen.startup.command = Creating PureMVC StartupCommand
|
11
|
+
log.gen.prepare.command = Creating PureMVC PrepareActorsCommand
|
12
|
+
log.gen.mediator.command = Creating PureMVC Mediator class => ${mediator.name}
|
13
|
+
log.gen.proxy.command = Creating PureMVC Proxy class => ${proxy.name}
|
14
|
+
|
15
|
+
##### =============== PROMPT MESSAGES =============== #####
|
16
|
+
log.prompt.command.name = Enter the name of the command you'd like to create. (i.e., <YourCommandName> generates ==> <YourCommandName>Command.as)
|
17
|
+
log.prompt.command.constant = Enter the name of the constant to be associated with the command.
|
18
|
+
log.prompt.mediator.name = Enter the name of the mediator you'd like to create. (i.e., <YourMediatorName> generates ==> <YourMediatorName>Mediator.as)
|
19
|
+
log.prompt.proxy.name = Enter the name of the proxy you'd like to create. (i.e., <YourProxyName> generates ==> <YourProxyName>Proxy.as)
|
20
|
+
|
21
|
+
##### =============== PROMPT MESSAGES =============== #####
|
22
|
+
log.fail.command.name = You must enter a name for the command!
|
23
|
+
log.fail.command.constant = You must enter a constant for the comman!
|
24
|
+
log.fail.mediator.name = You must enter a name for the mediator!
|
25
|
+
log.fail.proxy.name = You must enter a name for the proxy!
|
@@ -0,0 +1,9 @@
|
|
1
|
+
##### =============== PROJECT PROPERTIES =============== #####
|
2
|
+
app.prefix = PMVCGen
|
3
|
+
project.name = PMVCGenDemo
|
4
|
+
core.namespace = net.slsdev.utils.pmvc.demo
|
5
|
+
core.dir = net/slsdev/utils/pmvc/demo
|
6
|
+
version = 1.0
|
7
|
+
|
8
|
+
##### =============== PureMVC PROPERTIES =============== #####
|
9
|
+
pmvc.flavor = standard
|
Binary file
|
@@ -0,0 +1,55 @@
|
|
1
|
+
@copy@
|
2
|
+
package @namespace@.@events@ {
|
3
|
+
|
4
|
+
import flash.events.Event;
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Event description here.
|
8
|
+
*
|
9
|
+
* @langversion ActionScript 3.0
|
10
|
+
* @author @author.name@ @author.email@
|
11
|
+
* @date @today@
|
12
|
+
* @version @version@
|
13
|
+
*/
|
14
|
+
public class @event.name@ extends Event {
|
15
|
+
|
16
|
+
/* --- Variables --- */
|
17
|
+
|
18
|
+
//pmvcgen:varconsts
|
19
|
+
|
20
|
+
/* === Variables === */
|
21
|
+
|
22
|
+
/* --- Constructor --- */
|
23
|
+
|
24
|
+
public function @event.name@(type:String) {
|
25
|
+
super(type);
|
26
|
+
}
|
27
|
+
|
28
|
+
/* === Constructor === */
|
29
|
+
|
30
|
+
/* --- Functions --- */
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Clones the @event.name@.
|
34
|
+
*
|
35
|
+
* @return Duplicates an instance of an Event subclass
|
36
|
+
*/
|
37
|
+
public function clone():Event {
|
38
|
+
var evt:@event.name@ = new @event.name@(type);
|
39
|
+
return evt;
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Formats the event to a string.
|
44
|
+
*
|
45
|
+
* @return Returns a string containing all the properties of the Event object
|
46
|
+
*/
|
47
|
+
override public function toString():String {
|
48
|
+
return formatToString("@event.name@", "type");
|
49
|
+
}
|
50
|
+
|
51
|
+
/* === Functions === */
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
3
|
+
creationComplete="facade.startup(this)">
|
4
|
+
|
5
|
+
<mx:Script>
|
6
|
+
<![CDATA[
|
7
|
+
import @namespace@.@app.prefix@Facade;
|
8
|
+
|
9
|
+
private var facade:@app.prefix@Facade = @app.prefix@Facade.getInstance();
|
10
|
+
]]>
|
11
|
+
</mx:Script>
|
12
|
+
|
13
|
+
</mx:Application>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
package @namespace@ {
|
2
|
+
|
3
|
+
import @namespace@.@ctrls@.*;
|
4
|
+
|
5
|
+
import org.puremvc.as3.patterns.facade.Facade;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Application Facade.
|
9
|
+
*
|
10
|
+
* @langversion ActionScript 3.0
|
11
|
+
* @author @author.name@ @author.email@
|
12
|
+
* @date @today@
|
13
|
+
* @version @version@
|
14
|
+
*/
|
15
|
+
public class @app.prefix@Facade extends Facade {
|
16
|
+
|
17
|
+
/* --- Variables --- */
|
18
|
+
|
19
|
+
public static const STARTUP:String = "startup";
|
20
|
+
|
21
|
+
//pmvcgen:varconsts
|
22
|
+
|
23
|
+
/* === Variables === */
|
24
|
+
|
25
|
+
/* --- Functions --- */
|
26
|
+
|
27
|
+
public static function getInstance():@app.prefix@Facade {
|
28
|
+
if(instance == null)
|
29
|
+
instance = new @app.prefix@Facade();
|
30
|
+
return instance as @app.prefix@Facade;
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Starts up @project.name@.
|
35
|
+
*
|
36
|
+
* @param app reference to the application
|
37
|
+
*/
|
38
|
+
public function startup(app:@project.name@):void {
|
39
|
+
sendNotification(STARTUP, app);
|
40
|
+
}
|
41
|
+
|
42
|
+
override protected function initializeController():void {
|
43
|
+
super.initializeController();
|
44
|
+
//pmvcgen:register commands
|
45
|
+
}
|
46
|
+
|
47
|
+
/* === Functions === */
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
package @namespace@.@ctrls@ {
|
2
|
+
|
3
|
+
//pmvcgen:import commands
|
4
|
+
|
5
|
+
import org.puremvc.as3.interfaces.INotification;
|
6
|
+
import org.puremvc.as3.patterns.command.MacroCommand;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @command.name@ command.
|
10
|
+
*
|
11
|
+
* @langversion ActionScript 3.0
|
12
|
+
* @author @author.name@ @author.email@
|
13
|
+
* @date @today@
|
14
|
+
* @version @version@
|
15
|
+
*/
|
16
|
+
public class @command.name@Command extends MacroCommand {
|
17
|
+
|
18
|
+
override protected function initializeMacroCommand():void {
|
19
|
+
//pmvcgen:chain simple commands
|
20
|
+
}
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
package @namespace@.@view@ {
|
2
|
+
|
3
|
+
import @namespace@.@facade@;
|
4
|
+
|
5
|
+
import org.puremvc.as3.interfaces.INotification;
|
6
|
+
import org.puremvc.as3.patterns.mediator.Mediator;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @mediator.name@ mediator.
|
10
|
+
*
|
11
|
+
* @langversion ActionScript 3.0
|
12
|
+
* @author @author.name@ @author.email@
|
13
|
+
* @date @today@
|
14
|
+
* @version @version@
|
15
|
+
*/
|
16
|
+
public class @mediator.name@Mediator extends Mediator {
|
17
|
+
|
18
|
+
/* --- Variables --- */
|
19
|
+
|
20
|
+
public static const NAME:String = "@mediator.name@Mediator";
|
21
|
+
|
22
|
+
/* === Variables === */
|
23
|
+
|
24
|
+
/* --- Constructor --- */
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Constructor.
|
28
|
+
*
|
29
|
+
* @param viewComponent view component for mediator
|
30
|
+
*/
|
31
|
+
public function @mediator.name@Mediator(viewComponent:Object) {
|
32
|
+
super(NAME, viewComponent);
|
33
|
+
}
|
34
|
+
|
35
|
+
/* === Constructor === */
|
36
|
+
|
37
|
+
/* --- Functions --- */
|
38
|
+
|
39
|
+
override public function handleNotification(note:INotification):void {
|
40
|
+
}
|
41
|
+
|
42
|
+
override public function listNotificationInterests():Array {
|
43
|
+
return [
|
44
|
+
];
|
45
|
+
}
|
46
|
+
|
47
|
+
/* === Functions === */
|
48
|
+
|
49
|
+
/* --- Public Accessors --- */
|
50
|
+
|
51
|
+
public function get YOURVIEWNAME():YOURVIEWOBJ { return viewComponent as YOURVIEWOBJ; }
|
52
|
+
|
53
|
+
/* === Public Accessors === */
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
package @namespace@.@model@ {
|
2
|
+
|
3
|
+
import @namespace@.@facade@;
|
4
|
+
|
5
|
+
import org.puremvc.as3.patterns.proxy.Proxy;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @proxy.name@ proxy.
|
9
|
+
*
|
10
|
+
* @langversion ActionScript 3.0
|
11
|
+
* @author @author.name@ @author.email@
|
12
|
+
* @date @today@
|
13
|
+
* @version @version@
|
14
|
+
*/
|
15
|
+
public class @proxy.name@Proxy extends Proxy {
|
16
|
+
|
17
|
+
/* --- Variables --- */
|
18
|
+
|
19
|
+
public static const NAME:String = "@proxy.name@Proxy";
|
20
|
+
|
21
|
+
/* === Variables === */
|
22
|
+
|
23
|
+
/* --- Constructor --- */
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Constructor.
|
27
|
+
*
|
28
|
+
* @param data data model for proxy
|
29
|
+
*/
|
30
|
+
public function @proxy.name@Proxy(data:Object=null) {
|
31
|
+
super(NAME, data);
|
32
|
+
}
|
33
|
+
|
34
|
+
/* === Constructor === */
|
35
|
+
|
36
|
+
/* --- Functions --- */
|
37
|
+
|
38
|
+
//addfunctions
|
39
|
+
|
40
|
+
/* === Functions === */
|
41
|
+
|
42
|
+
/* --- Public Accessors --- */
|
43
|
+
|
44
|
+
public function get dataObject():Object { return data; }
|
45
|
+
|
46
|
+
/* === Public Accessors === */
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
package @namespace@.@ctrls@ {
|
2
|
+
|
3
|
+
//pmvcgen:insert imports
|
4
|
+
|
5
|
+
import org.puremvc.as3.interfaces.INotification;
|
6
|
+
import org.puremvc.as3.patterns.command.SimpleCommand;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @command.name@ command.
|
10
|
+
*
|
11
|
+
* @langversion ActionScript 3.0
|
12
|
+
* @author @author.name@ @author.email@
|
13
|
+
* @date @today@
|
14
|
+
* @version @version@
|
15
|
+
*/
|
16
|
+
public class @command.name@Command extends SimpleCommand {
|
17
|
+
|
18
|
+
override public function execute(note:INotification):void {
|
19
|
+
//pmvcgen:insert command logic
|
20
|
+
}
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PureMVCGen
|
2
|
+
class AntChecker
|
3
|
+
|
4
|
+
# Determines if ANT is installed on the system
|
5
|
+
def self.has_ant_installed?
|
6
|
+
AntChecker.find_in_path("ant")
|
7
|
+
end
|
8
|
+
|
9
|
+
# Searches the path, looking for the given utility. If an executable
|
10
|
+
# file is found that matches the parameter, this returns true.
|
11
|
+
def self.find_in_path(utility)
|
12
|
+
path = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
|
13
|
+
suffixes = self.on_windows? ? self.windows_executable_extensions : [""]
|
14
|
+
|
15
|
+
path.each do |dir|
|
16
|
+
suffixes.each do |sfx|
|
17
|
+
file = File.join(dir, utility + sfx)
|
18
|
+
return true if File.executable?(file)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.on_windows?
|
26
|
+
RUBY_PLATFORM =~ /mswin|mingw/
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.windows_executable_extensions
|
30
|
+
%w(.exe .bat .com .cmd)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PureMVCGen
|
2
|
+
module Commands
|
3
|
+
class CheckCommand < CmdParse::Command
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super('check', false)
|
7
|
+
self.short_desc = "Validates that all required property settings are current detected"
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute(args)
|
11
|
+
call_ant "validate-properties"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PureMVCGen
|
2
|
+
module Commands
|
3
|
+
class InitializeCommand < CmdParse::Command
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super('init', false)
|
7
|
+
self.short_desc = "Initializes the current working directory with a new PureMVC project"
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute(args)
|
11
|
+
call_ant "new-pmvc"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module PureMVCGen
|
2
|
+
module Commands
|
3
|
+
class NewCommand < CmdParse::Command
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super('new', true)
|
7
|
+
self.short_desc = "Command to generate PureMVC classes"
|
8
|
+
|
9
|
+
# add sub commands
|
10
|
+
self.add_command(CreateCommand.new)
|
11
|
+
self.add_command(CreateMediator.new)
|
12
|
+
self.add_command(CreateProxy.new)
|
13
|
+
end
|
14
|
+
|
15
|
+
class CreateCommand < CmdParse::Command
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super('command', false)
|
19
|
+
@type = :simple
|
20
|
+
self.short_desc = "Creates a simple or macro command (defaults to simple)."
|
21
|
+
self.description = <<-EOL
|
22
|
+
Generates a simple or macro command.
|
23
|
+
Generating a simple command is the default behavior, unless the macro switch is passed:
|
24
|
+
-m or --macro
|
25
|
+
|
26
|
+
If no other switches are passed, the ANT script will prompt for a command name and constant,
|
27
|
+
however these may be passed on the command line with the -n (or --name) and -c (or --const) switches.
|
28
|
+
EOL
|
29
|
+
self.options = default_options do |opt|
|
30
|
+
opt.on("-m", "--macro", "Specifies the command is a MacroCommand") { @type = :macro }
|
31
|
+
opt.on("-n", "--name COMMAND_NAME", "Specifies the name for the command") { |name| @command_name = name }
|
32
|
+
opt.on("-c", "--const COMMAND_CONSTANT", "Specifies the constant to use for the command") { |const| @command_const = const }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def execute(args)
|
37
|
+
cmd = ""
|
38
|
+
cmd << "-Dcmd.name=#{@command_name} " unless @command_name.nil?
|
39
|
+
cmd << "-Dcmd.const=#{@command_const} " unless @command_const.nil?
|
40
|
+
cmd << "#{@type == :simple ? "create-simple-command" : "create-macro-command"}"
|
41
|
+
call_ant cmd
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class CreateMediator < CmdParse::Command
|
47
|
+
|
48
|
+
def initialize
|
49
|
+
super('mediator', false)
|
50
|
+
self.short_desc = "Creates a new mediator."
|
51
|
+
self.options = default_options do |opt|
|
52
|
+
opt.on("-n", "--name MEDIATOR_NAME", "Specifies the name for the mediator") { |name| @mediator_name = name }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def execute(args)
|
57
|
+
cmd = ""
|
58
|
+
cmd << "-Dmediator.name=#{@mediator_name} " unless @mediator_name.nil?
|
59
|
+
cmd << "create-mediator"
|
60
|
+
call_ant cmd
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class CreateProxy < CmdParse::Command
|
66
|
+
|
67
|
+
def initialize
|
68
|
+
super('proxy', false)
|
69
|
+
self.short_desc = "Creates a new proxy."
|
70
|
+
self.options = default_options do |opt|
|
71
|
+
opt.on("-n", "--name PROXY_NAME", "Specifies the name for the proxy") { |name| @proxy_name = name }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def execute(args)
|
76
|
+
cmd = ""
|
77
|
+
cmd << "-Dproxy.name=#{@proxy_name} " unless @proxy_name.nil?
|
78
|
+
cmd << "create-proxy"
|
79
|
+
call_ant cmd
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PureMVCGen
|
2
|
+
module Version #:nodoc:
|
3
|
+
# A method for comparing versions of required modules. It expects two
|
4
|
+
# arrays of integers as parameters, the first being the minimum version
|
5
|
+
# required, and the second being the actual version available. It returns
|
6
|
+
# true if the actual version is at least equal to the required version.
|
7
|
+
def self.check(required, actual) #:nodoc:
|
8
|
+
required = required.map { |v| "%06d" % v }.join(".")
|
9
|
+
actual = actual.map { |v| "%06d" % v }.join(".")
|
10
|
+
return actual >= required
|
11
|
+
end
|
12
|
+
|
13
|
+
MAJOR = 0
|
14
|
+
MINOR = 1
|
15
|
+
TINY = 0
|
16
|
+
|
17
|
+
ARRAY = [MAJOR, MINOR, TINY]
|
18
|
+
STRING = ARRAY.join(".")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'cmdparse'
|
3
|
+
require 'pure_m_v_c_gen/version'
|
4
|
+
|
5
|
+
PMVC_GEN_LIB = File.join(File.dirname(__FILE__), '..', 'lib', 'pure_m_v_c_gen')
|
6
|
+
require File.join(PMVC_GEN_LIB, 'ant_checker')
|
7
|
+
|
8
|
+
unless PureMVCGen::AntChecker.has_ant_installed?
|
9
|
+
err = <<-EOL
|
10
|
+
You must have ANT installed to run puremvc-gen.
|
11
|
+
Install it! ==> http://ant.apache.org
|
12
|
+
If you have it installed, ensure it is on your path.
|
13
|
+
EOL
|
14
|
+
puts err
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
CMD_PATH = File.join(PMVC_GEN_LIB, 'commands')
|
19
|
+
|
20
|
+
require File.join(CMD_PATH, 'command_extensions')
|
21
|
+
require File.join(CMD_PATH, 'check_command')
|
22
|
+
require File.join(CMD_PATH, 'initialize_command')
|
23
|
+
require File.join(CMD_PATH, 'new_command')
|
data/puremvc-gen.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{puremvc-gen}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Greg Jastrab"]
|
9
|
+
s.date = %q{2008-12-05}
|
10
|
+
s.default_executable = %q{puremvc-gen}
|
11
|
+
s.description = %q{An ANT-based PureMVC generator.}
|
12
|
+
s.email = %q{gjastrab.dev@gmail.com}
|
13
|
+
s.executables = ["puremvc-gen"]
|
14
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
15
|
+
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/ant_checker.rb", "lib/pure_m_v_c_gen/commands/check_command.rb", "lib/pure_m_v_c_gen/commands/command_extensions.rb", "lib/pure_m_v_c_gen/commands/initialize_command.rb", "lib/pure_m_v_c_gen/commands/new_command.rb", "lib/pure_m_v_c_gen/version.rb", "puremvc-gen.gemspec", "test/test_pure_m_v_c_gen.rb"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{FIX (url)}
|
18
|
+
s.rdoc_options = ["--main", "README.txt"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{gjastrab}
|
21
|
+
s.rubygems_version = %q{1.3.1}
|
22
|
+
s.summary = %q{An ANT-based PureMVC generator.}
|
23
|
+
s.test_files = ["test/test_pure_m_v_c_gen.rb"]
|
24
|
+
|
25
|
+
if s.respond_to? :specification_version then
|
26
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
+
s.specification_version = 2
|
28
|
+
|
29
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
30
|
+
s.add_runtime_dependency(%q<cmdparse>, [">= 2.0.2"])
|
31
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<cmdparse>, [">= 2.0.2"])
|
34
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<cmdparse>, [">= 2.0.2"])
|
38
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
39
|
+
end
|
40
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puremvc-gen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Greg Jastrab
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-05 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cmdparse
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.2
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.2
|
34
|
+
version:
|
35
|
+
description: An ANT-based PureMVC generator.
|
36
|
+
email: gjastrab.dev@gmail.com
|
37
|
+
executables:
|
38
|
+
- puremvc-gen
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- History.txt
|
43
|
+
- Manifest.txt
|
44
|
+
- README.txt
|
45
|
+
files:
|
46
|
+
- History.txt
|
47
|
+
- Manifest.txt
|
48
|
+
- README.txt
|
49
|
+
- Rakefile
|
50
|
+
- bin/puremvc-gen
|
51
|
+
- conf/build.xml
|
52
|
+
- conf/config/pmvcgen.log.properties
|
53
|
+
- conf/config/pmvcgen.properties
|
54
|
+
- conf/example/author.properties
|
55
|
+
- conf/example/proj.properties
|
56
|
+
- conf/templates/.DS_Store
|
57
|
+
- conf/templates/Event.tpl
|
58
|
+
- conf/templates/standard/Application.tpl
|
59
|
+
- conf/templates/standard/Facade.tpl
|
60
|
+
- conf/templates/standard/MacroCommand.tpl
|
61
|
+
- conf/templates/standard/Mediator.tpl
|
62
|
+
- conf/templates/standard/Proxy.tpl
|
63
|
+
- conf/templates/standard/SimpleCommand.tpl
|
64
|
+
- lib/pure_m_v_c_gen.rb
|
65
|
+
- lib/pure_m_v_c_gen/ant_checker.rb
|
66
|
+
- lib/pure_m_v_c_gen/commands/check_command.rb
|
67
|
+
- lib/pure_m_v_c_gen/commands/command_extensions.rb
|
68
|
+
- lib/pure_m_v_c_gen/commands/initialize_command.rb
|
69
|
+
- lib/pure_m_v_c_gen/commands/new_command.rb
|
70
|
+
- lib/pure_m_v_c_gen/version.rb
|
71
|
+
- puremvc-gen.gemspec
|
72
|
+
- test/test_pure_m_v_c_gen.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: FIX (url)
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --main
|
78
|
+
- README.txt
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: gjastrab
|
96
|
+
rubygems_version: 1.3.1
|
97
|
+
signing_key:
|
98
|
+
specification_version: 2
|
99
|
+
summary: An ANT-based PureMVC generator.
|
100
|
+
test_files:
|
101
|
+
- test/test_pure_m_v_c_gen.rb
|