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.
@@ -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,7 @@
1
+ ##### =============== PureMVC GEN PROPERTIES =============== #####
2
+ model.dir = model
3
+ view.dir = view
4
+ controller.dir = controller
5
+ events.dir = events
6
+
7
+ templates.dir = templates
@@ -0,0 +1,2 @@
1
+ author.name = Greg Jastrab
2
+ author.email = greg@smartlogicsolutions.com
@@ -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
@@ -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,25 @@
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
+ ANT_BIN = PureMVCGen::AntChecker.on_windows? ? PureMVCGen::AntChecker.get_windows_ant : "ant"
19
+
20
+ CMD_PATH = File.join(PMVC_GEN_LIB, 'commands')
21
+
22
+ require File.join(CMD_PATH, 'command_extensions')
23
+ require File.join(CMD_PATH, 'check_command')
24
+ require File.join(CMD_PATH, 'initialize_command')
25
+ require File.join(CMD_PATH, 'new_command')
@@ -0,0 +1,53 @@
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 = self.get_path
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.get_path
26
+ (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
27
+ end
28
+
29
+ # Locates the ant executable or BAT file and returns the full path to it
30
+ def self.get_windows_ant
31
+ ext = %w(.exe .bat)
32
+ path = self.get_path
33
+
34
+ path.each do |dir|
35
+ ext.each do |sfx|
36
+ file = File.join(dir, "ant" + sfx)
37
+ return File.expand_path(file) if File.executable?(file)
38
+ end
39
+ end
40
+
41
+ nil
42
+ end
43
+
44
+ def self.on_windows?
45
+ RUBY_PLATFORM =~ /mswin|mingw/
46
+ end
47
+
48
+ def self.windows_executable_extensions
49
+ %w(.exe .bat .com .cmd)
50
+ end
51
+
52
+ end
53
+ 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,14 @@
1
+ module CmdParse
2
+ class Command
3
+ # injects our common options
4
+ def default_options(&block)
5
+ CmdParse::OptionParserWrapper.new do |opt|
6
+ opt.on("-h", "--help") do
7
+ self.show_help
8
+ exit
9
+ end
10
+ yield(opt)
11
+ end
12
+ end
13
+ end
14
+ end