fabricator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +63 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +48 -0
  5. data/Rakefile +28 -0
  6. data/app_generators/pureapp/USAGE +5 -0
  7. data/app_generators/pureapp/pureapp_generator.rb +151 -0
  8. data/app_generators/pureapp/templates/actionscript.properties +20 -0
  9. data/app_generators/pureapp/templates/authentication_module.mxml +27 -0
  10. data/app_generators/pureapp/templates/common/constants.as +12 -0
  11. data/app_generators/pureapp/templates/dashboard_module.mxml +28 -0
  12. data/app_generators/pureapp/templates/flex.properties +2 -0
  13. data/app_generators/pureapp/templates/html-template/AC_OETags.js +276 -0
  14. data/app_generators/pureapp/templates/html-template/history/history.css +6 -0
  15. data/app_generators/pureapp/templates/html-template/history/history.js +645 -0
  16. data/app_generators/pureapp/templates/html-template/history/historyFrame.html +29 -0
  17. data/app_generators/pureapp/templates/html-template/index.template.html +121 -0
  18. data/app_generators/pureapp/templates/html-template/playerProductInstall.swf +0 -0
  19. data/app_generators/pureapp/templates/libs/PureMVC_AS3_MultiCore_1_0_5.swc +0 -0
  20. data/app_generators/pureapp/templates/libs/Utility_AS3_MultiCore_Pipes_1_1.swc +0 -0
  21. data/app_generators/pureapp/templates/libs/fabrication-0.6-flex.swc +0 -0
  22. data/app_generators/pureapp/templates/libs/fabrication_license.txt +7 -0
  23. data/app_generators/pureapp/templates/libs/puremvc_multicore_license.txt +61 -0
  24. data/app_generators/pureapp/templates/libs/puremvc_pipes_license.txt +63 -0
  25. data/app_generators/pureapp/templates/mainapp.mxml +22 -0
  26. data/app_generators/pureapp/templates/modules/authentication/controller/authentication_module_startup_command.as +22 -0
  27. data/app_generators/pureapp/templates/modules/authentication/model/authentication_proxy.as +20 -0
  28. data/app_generators/pureapp/templates/modules/authentication/view/authentication_module_mediator.as +31 -0
  29. data/app_generators/pureapp/templates/modules/authentication/view/components/sign_in_view.mxml +48 -0
  30. data/app_generators/pureapp/templates/modules/authentication/view/sign_in_view_mediator.as +48 -0
  31. data/app_generators/pureapp/templates/modules/dashboard/controller/dashboard_module_startup_command.as +22 -0
  32. data/app_generators/pureapp/templates/modules/dashboard/view/components/nav_bar.mxml +14 -0
  33. data/app_generators/pureapp/templates/modules/dashboard/view/components/todo_list.mxml +21 -0
  34. data/app_generators/pureapp/templates/modules/dashboard/view/dashboard_module_mediator.as +37 -0
  35. data/app_generators/pureapp/templates/modules/dashboard/view/nav_bar_mediator.as +45 -0
  36. data/app_generators/pureapp/templates/modules/dashboard/view/todo_list_mediator.as +23 -0
  37. data/app_generators/pureapp/templates/project.properties +18 -0
  38. data/app_generators/pureapp/templates/properties.yml +6 -0
  39. data/app_generators/pureapp/templates/shell/controller/add_module_command.as +18 -0
  40. data/app_generators/pureapp/templates/shell/controller/change_selected_module_command.as +23 -0
  41. data/app_generators/pureapp/templates/shell/controller/load_dashboard_module_command.as +16 -0
  42. data/app_generators/pureapp/templates/shell/controller/remove_module_command.as +21 -0
  43. data/app_generators/pureapp/templates/shell/controller/startup_command.as +30 -0
  44. data/app_generators/pureapp/templates/shell/model/i_list_element.as +8 -0
  45. data/app_generators/pureapp/templates/shell/model/list_proxy.as +53 -0
  46. data/app_generators/pureapp/templates/shell/model/module_descriptor.as +19 -0
  47. data/app_generators/pureapp/templates/shell/model/selection_proxy.as +30 -0
  48. data/app_generators/pureapp/templates/shell/shell_constants.as +11 -0
  49. data/app_generators/pureapp/templates/shell/view/components/modules_container.mxml +15 -0
  50. data/app_generators/pureapp/templates/shell/view/mediator.as +35 -0
  51. data/app_generators/pureapp/templates/shell/view/modules_container_mediator.as +124 -0
  52. data/bin/pureapp +17 -0
  53. data/lib/fabricator.rb +6 -0
  54. data/script/console +10 -0
  55. data/script/destroy +14 -0
  56. data/script/generate +14 -0
  57. data/test/test_fabricator.rb +11 -0
  58. data/test/test_generator_helper.rb +29 -0
  59. data/test/test_helper.rb +3 -0
  60. data/test/test_pureapp_generator.rb +43 -0
  61. metadata +145 -0
@@ -0,0 +1,22 @@
1
+ package <%= base_package%>.modules.dashboard.controller {
2
+ import org.puremvc.as3.multicore.interfaces.INotification;
3
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
4
+
5
+ import <%= base_package%>.common.<%= name%>Constants;
6
+ //import <%= base_package%>.modules.dashboard.model.DashboardProxy;
7
+
8
+ import DashboardModule;
9
+ import <%= base_package%>.modules.dashboard.view.DashboardModuleMediator;
10
+
11
+ public class DashboardModuleStartupCommand extends SimpleFabricationCommand {
12
+
13
+ override public function execute(note:INotification):void {
14
+ trace("starting dashboard module")
15
+ //registerProxy(new DashboardProxy());
16
+ /*registerCommand(FabricationRoutingDemoConstants.RECEIVE_MESSAGE, UpdateMessageCountsCommand);
17
+ */
18
+ registerMediator(new DashboardModuleMediator(note.getBody() as DashboardModule));
19
+ }
20
+
21
+ }
22
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:ApplicationControlBar xmlns:mx="http://www.adobe.com/2006/mxml" dock="true" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #FFFFFF]" width="100%" cornerRadius="0">
3
+ <mx:HBox id="toolbarLeft" horizontalAlign="left" verticalAlign="middle" width="50%" height="100%">
4
+ <mx:Text text="<%= title%>" fontFamily="Verdana" fontSize="18" fontStyle="normal" color="#325EC0"/>
5
+ <mx:Button id="home" label="Home" color="#325EC0" cornerRadius="0" fontWeight="bold" borderColor="#FEFEFE" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #FFFFFF]"/>
6
+ </mx:HBox>
7
+
8
+ <mx:HBox id="toolbarRight" horizontalAlign="right" verticalAlign="middle" width="50%" height="100%">
9
+ <mx:Label text="User:" color="#325EC0"/>
10
+ <!--mx:Text id="user" color="#325EC0"/-->
11
+ <mx:VRule height="18"/>
12
+ <mx:Button id="signOutButton" label="Sign out" color="#325EC0" cornerRadius="0" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #FFFFFF]"/>
13
+ </mx:HBox>
14
+ </mx:ApplicationControlBar>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="450" height="450" title="TODO list" color="0xffffff" borderAlpha="0.15"
3
+ paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">
4
+
5
+ <mx:Label text="This is a list of things to complete before the application is finished." top="15" horizontalCenter="0" color="#000000"/>
6
+
7
+ <mx:VBox color="0x000000" horizontalCenter="0" verticalCenter="0">
8
+ <mx:CheckBox label="Finish the AuthenticationProxy" />
9
+ <mx:CheckBox label="Make a service call to retrieve data" />
10
+ <mx:CheckBox label="Build extra modules with the generator" />
11
+ <mx:CheckBox label="Add module buttons to navbar" />
12
+ <mx:CheckBox label="..." />
13
+ <mx:CheckBox label="..." />
14
+ <mx:CheckBox label="..." />
15
+ <mx:CheckBox label="..." />
16
+ <mx:CheckBox label="..." />
17
+ <mx:CheckBox label="Make a release build with flex builder" />
18
+ <mx:CheckBox label="Enjoy!!!" />
19
+ </mx:VBox>
20
+
21
+ </mx:TitleWindow>
@@ -0,0 +1,37 @@
1
+ package <%= base_package%>.modules.dashboard.view {
2
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;
3
+
4
+ import <%= base_package%>.modules.dashboard.view.components.NavBar;
5
+ import <%= base_package%>.modules.dashboard.view.components.TodoList;
6
+
7
+ public class DashboardModuleMediator extends FlexMediator {
8
+
9
+ static public const NAME:String = "DashboardModuleMediator";
10
+
11
+ static public function getDefinitionByName(path:String):Object {
12
+ return getDefinitionByName(path);
13
+ }
14
+
15
+ public function DashboardModuleMediator(viewComponent:DashboardModule) {
16
+ super(NAME, viewComponent);
17
+ }
18
+
19
+ public function get application():DashboardModule {
20
+ return viewComponent as DashboardModule;
21
+ }
22
+
23
+ public function get navBar():NavBar {
24
+ return application.navBar as NavBar;
25
+ }
26
+
27
+ public function get todoList():TodoList {
28
+ return application.todoList as TodoList;
29
+ }
30
+
31
+ override public function onRegister():void {
32
+ registerMediator(new NavBarMediator(navBar));
33
+ registerMediator(new TodoListMediator(todoList));
34
+ }
35
+
36
+ }
37
+ }
@@ -0,0 +1,45 @@
1
+ package <%= base_package%>.modules.dashboard.view
2
+ {
3
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;
4
+
5
+ import <%= base_package%>.common.<%= name%>Constants;
6
+ import <%= base_package%>.modules.dashboard.view.components.NavBar;
7
+
8
+ import mx.controls.Button;
9
+ import flash.events.MouseEvent;
10
+
11
+ import flash.events.Event;
12
+
13
+ /*import org.puremvc.as3.multicore.interfaces.INotification;
14
+ import org.puremvc.as3.multicore.patterns.mediator.Mediator;*/
15
+
16
+ public class NavBarMediator extends FlexMediator {
17
+
18
+ public static const NAME:String = "NavBarMediator";
19
+
20
+ public function NavBarMediator( viewComponent:NavBar )
21
+ {
22
+ super( NAME, viewComponent );
23
+ }
24
+
25
+ /**
26
+ * The viewComponent cast to type ControlBar.
27
+ */
28
+ private function get navBar():NavBar
29
+ {
30
+ return viewComponent as NavBar;
31
+ }
32
+
33
+ public function get signOutButton():Button {
34
+ return navBar.signOutButton as Button;
35
+ }
36
+
37
+
38
+ public function reactToSignOutButtonClick(e:MouseEvent):void {
39
+ trace("sign out button clicked")
40
+ routeNotification(<%= name%>Constants.SIGN_OUT, null, null,"*");
41
+
42
+ }
43
+
44
+ }
45
+ }
@@ -0,0 +1,23 @@
1
+ package <%= base_package%>.modules.dashboard.view
2
+ {
3
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;
4
+ import <%= base_package%>.modules.dashboard.view.components.TodoList;
5
+
6
+ public class TodoListMediator extends FlexMediator {
7
+
8
+ public static const NAME:String = "TodoListMediator";
9
+
10
+ public function TodoListMediator( viewComponent:TodoList )
11
+ {
12
+ super( NAME, viewComponent );
13
+ }
14
+
15
+ /**
16
+ * The viewComponent cast to type TodoList.
17
+ */
18
+ private function get todoList():TodoList
19
+ {
20
+ return viewComponent as TodoList;
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name><%= name %></name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>com.adobe.flexbuilder.project.flexnature</nature>
16
+ <nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
17
+ </natures>
18
+ </projectDescription>
@@ -0,0 +1,6 @@
1
+ base_src_folder:
2
+ <%= base_src_folder%>
3
+ base_package_folder:
4
+ <%= base_package_folder%>
5
+ package:
6
+ <%= base_package%>
@@ -0,0 +1,18 @@
1
+ package <%= base_package%>.shell.controller {
2
+ import <%= base_package%>.shell.model.ListProxy;
3
+ import <%= base_package%>.shell.<%= name%>ShellConstants;
4
+ import <%= base_package%>.shell.model.ModuleDescriptor;
5
+
6
+ import org.puremvc.as3.multicore.interfaces.INotification;
7
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
8
+
9
+ public class AddModuleCommand extends SimpleFabricationCommand {
10
+
11
+ override public function execute(note:INotification):void {
12
+ var moduleDescriptor:ModuleDescriptor = note.getBody() as ModuleDescriptor;
13
+ var moduleListProxy:ListProxy = retrieveProxy(ListProxy.NAME) as ListProxy;
14
+
15
+ moduleListProxy.add(moduleDescriptor);
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,23 @@
1
+ package <%= base_package%>.shell.controller {
2
+ import org.puremvc.as3.multicore.interfaces.INotification;
3
+ import org.puremvc.as3.multicore.utilities.fabrication.interfaces.IFabrication;
4
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
5
+
6
+ import <%= base_package%>.common.<%= name%>Constants;
7
+
8
+ import <%= base_package%>.shell.<%= name%>ShellConstants;
9
+ import <%= base_package%>.shell.model.SelectionProxy;
10
+
11
+ public class ChangeSelectedModuleCommand extends SimpleFabricationCommand {
12
+
13
+ override public function execute(note:INotification):void {
14
+ var module:IFabrication = note.getBody() as IFabrication;
15
+ var selectionProxy:SelectionProxy = retrieveProxy(SelectionProxy.NAME) as SelectionProxy;
16
+
17
+ if (selectionProxy.changeSelection(module)) {
18
+ routeNotification(<%= name%>Constants.SELECTED_MODULE_CHANGED, module);
19
+ }
20
+ }
21
+
22
+ }
23
+ }
@@ -0,0 +1,16 @@
1
+ package <%= base_package%>.shell.controller {
2
+ import <%= base_package%>.shell.<%= name%>ShellConstants;
3
+ import <%= base_package%>.shell.model.ModuleDescriptor;
4
+
5
+ import org.puremvc.as3.multicore.interfaces.INotification;
6
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
7
+
8
+ public class LoadDashboardModuleCommand extends SimpleFabricationCommand {
9
+
10
+ override public function execute(note:INotification):void {
11
+ trace("Loading dashboard module")
12
+ var moduleDescriptor:ModuleDescriptor = new ModuleDescriptor("DashboardModule.swf");
13
+ sendNotification(<%= name%>ShellConstants.ADD_MODULE, moduleDescriptor);
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,21 @@
1
+ package <%= base_package%>.shell.controller {
2
+ import org.puremvc.as3.multicore.patterns.observer.Notification;
3
+
4
+ import <%= base_package%>.shell.<%= name%>ShellConstants;
5
+ import <%= base_package%>.shell.model.ModuleDescriptor;
6
+ import <%= base_package%>.shell.model.ListProxy;
7
+
8
+ import org.puremvc.as3.multicore.interfaces.INotification;
9
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
10
+
11
+ public class RemoveModuleCommand extends SimpleFabricationCommand {
12
+
13
+ override public function execute(note:INotification):void {
14
+ var moduleDescriptor:ModuleDescriptor = note.getBody() as ModuleDescriptor;
15
+ var moduleListProxy:ListProxy = retrieveProxy(ListProxy.NAME) as ListProxy;
16
+
17
+ moduleListProxy.remove(moduleDescriptor);
18
+ executeCommand(ChangeSelectedModuleCommand, null);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,30 @@
1
+ package <%= base_package%>.shell.controller {
2
+ import <%= base_package%>.shell.view.<%= name%>ShellMediator;
3
+
4
+ import org.puremvc.as3.multicore.interfaces.INotification;
5
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
6
+ import <%= base_package%>.shell.model.ListProxy;
7
+ import <%= base_package%>.shell.model.ModuleDescriptor;
8
+ import <%= base_package%>.shell.<%= name%>ShellConstants;
9
+
10
+ public class <%= startup_command_name %> extends SimpleFabricationCommand {
11
+
12
+ override public function execute(note:INotification):void {
13
+ trace("starting up");
14
+ registerProxy(new ListProxy());
15
+
16
+ registerCommand(<%= name%>ShellConstants.ADD_MODULE, AddModuleCommand);
17
+ registerCommand(<%= name%>ShellConstants.REMOVE_MODULE, RemoveModuleCommand);
18
+ registerCommand(<%= name%>ShellConstants.SELECT_MODULE, ChangeSelectedModuleCommand);
19
+
20
+ registerCommand(<%= name%>ShellConstants.LOAD_DASHBOARD_MODULE, LoadDashboardModuleCommand);
21
+
22
+
23
+ registerMediator(new <%= name%>ShellMediator(note.getBody() as <%= name%>Shell));
24
+
25
+ //FIXME test add of authentication module
26
+ var moduleDescriptor:ModuleDescriptor = new ModuleDescriptor("AuthenticationModule.swf");
27
+ sendNotification(<%= name%>ShellConstants.ADD_MODULE, moduleDescriptor);
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,8 @@
1
+ package <%= base_package%>.shell.model {
2
+
3
+ public interface IListElement {
4
+
5
+ function getElementID():String;
6
+
7
+ }
8
+ }
@@ -0,0 +1,53 @@
1
+ package <%= base_package%>.shell.model {
2
+ import mx.collections.ArrayCollection;
3
+
4
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.proxy.FabricationProxy;
5
+
6
+ public class ListProxy extends FabricationProxy {
7
+
8
+ static public const NAME:String = "ListProxy";
9
+ static public const ADDED_TO_LIST:String = "addedToList";
10
+ static public const REMOVED_FROM_LIST:String = "removedFromList";
11
+
12
+ public function ListProxy(name:String = NAME, _list:ArrayCollection = null) {
13
+ super(name, _list != null ? _list : new ArrayCollection());
14
+ }
15
+
16
+ public function get list():ArrayCollection {
17
+ return data as ArrayCollection;
18
+ }
19
+
20
+ public function add(element:IListElement):void {
21
+ if (!exists(element)) {
22
+ list.addItem(element);
23
+ sendNotification(ADDED_TO_LIST, element);
24
+ }
25
+ }
26
+
27
+ public function remove(element:IListElement):void {
28
+ if (exists(element)) {
29
+ var index:int = list.getItemIndex(element);
30
+ list.removeItemAt(index);
31
+ sendNotification(REMOVED_FROM_LIST, element);
32
+ }
33
+ }
34
+
35
+ public function exists(element:IListElement):Boolean {
36
+ return list.contains(element);
37
+ }
38
+
39
+ public function find(elementID:String):IListElement {
40
+ var n:int = list.length;
41
+ var element:IListElement;
42
+ for (var i:int = 0; i < n; i++) {
43
+ element = list.getItemAt(i) as IListElement;
44
+ if (element.getElementID() == elementID) {
45
+ return element;
46
+ }
47
+ }
48
+
49
+ return null;
50
+ }
51
+
52
+ }
53
+ }
@@ -0,0 +1,19 @@
1
+ package <%= base_package%>.shell.model {
2
+ import mx.utils.UIDUtil;
3
+
4
+ public class ModuleDescriptor implements IListElement {
5
+
6
+ public var url:String;
7
+ private var elementID:String;
8
+
9
+ public function ModuleDescriptor(url:String) {
10
+ this.url = url;
11
+ elementID = UIDUtil.createUID();
12
+ }
13
+
14
+ public function getElementID():String {
15
+ return elementID;
16
+ }
17
+
18
+ }
19
+ }
@@ -0,0 +1,30 @@
1
+ package <%= base_package%>.shell.model {
2
+ import mx.collections.ArrayCollection;
3
+
4
+ import org.puremvc.as3.multicore.utilities.fabrication.patterns.proxy.FabricationProxy;
5
+
6
+ public class SelectionProxy extends FabricationProxy {
7
+
8
+ static public const NAME:String = "SelectionProxy";
9
+ static public const SELECTION_CHANGED:String = "selectionChanged";
10
+
11
+ public function SelectionProxy(name:String = NAME, _selection:ArrayCollection = null) {
12
+ super(name, _selection != null ? _selection : new ArrayCollection());
13
+ }
14
+
15
+ public function changeSelection(newSelection:Object):Boolean {
16
+ if (selection != newSelection) {
17
+ setData(newSelection);
18
+ sendNotification(SELECTION_CHANGED, newSelection);
19
+ return true;
20
+ } else {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ public function get selection():Object {
26
+ return data;
27
+ }
28
+
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ package <%= base_package%>.shell {
2
+
3
+ public class <%= name%>ShellConstants {
4
+
5
+ static public const ADD_MODULE:String = "addModule";
6
+ static public const REMOVE_MODULE:String = "removeModule";
7
+ static public const SELECT_MODULE:String = "selectModule";
8
+ static public const LOAD_DASHBOARD_MODULE:String = "loadDashboardModule";
9
+
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:ViewStack xmlns:mx="http://www.adobe.com/2006/mxml" resizeToContent="true" width="100%" height="100%" hideEffect="hideViewStack" showEffect="showViewStack">
3
+ <mx:transitions>
4
+ <mx:Transition >
5
+ <mx:Parallel id="hideViewStack" >
6
+ <mx:WipeDown duration="800"/>
7
+ </mx:Parallel>
8
+ </mx:Transition>
9
+ <mx:Transition >
10
+ <mx:Parallel id="showViewStack">
11
+ <mx:WipeUp duration="800"/>
12
+ </mx:Parallel>
13
+ </mx:Transition>
14
+ </mx:transitions>
15
+ </mx:ViewStack>