rlmattax-restfulx 1.2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/README.rdoc +50 -0
  2. data/Rakefile +79 -0
  3. data/VERSION.yml +4 -0
  4. data/app_generators/rx_app/USAGE +22 -0
  5. data/app_generators/rx_app/rx_app_generator.rb +110 -0
  6. data/app_generators/rx_app/templates/actionscript.properties +16 -0
  7. data/app_generators/rx_app/templates/actionscriptair.properties +16 -0
  8. data/app_generators/rx_app/templates/app.yaml.erb +12 -0
  9. data/app_generators/rx_app/templates/default_tasks.rake +38 -0
  10. data/app_generators/rx_app/templates/empty.txt +0 -0
  11. data/app_generators/rx_app/templates/expressInstall.swf +0 -0
  12. data/app_generators/rx_app/templates/flex.properties +2 -0
  13. data/app_generators/rx_app/templates/generate.rb +17 -0
  14. data/app_generators/rx_app/templates/html-template/AC_OETags.js +276 -0
  15. data/app_generators/rx_app/templates/html-template/history/history.css +6 -0
  16. data/app_generators/rx_app/templates/html-template/history/history.js +645 -0
  17. data/app_generators/rx_app/templates/html-template/history/historyFrame.html +29 -0
  18. data/app_generators/rx_app/templates/html-template/index.template.html +121 -0
  19. data/app_generators/rx_app/templates/html-template/playerProductInstall.swf +0 -0
  20. data/app_generators/rx_app/templates/index.html.erb +18 -0
  21. data/app_generators/rx_app/templates/index.yaml +11 -0
  22. data/app_generators/rx_app/templates/mainair-app.xml +134 -0
  23. data/app_generators/rx_app/templates/mainapp-config.xml +22 -0
  24. data/app_generators/rx_app/templates/mainapp.mxml +152 -0
  25. data/app_generators/rx_app/templates/project-textmate.erb +72 -0
  26. data/app_generators/rx_app/templates/project.properties +18 -0
  27. data/app_generators/rx_app/templates/projectair.properties +24 -0
  28. data/app_generators/rx_app/templates/restfulx.yml +46 -0
  29. data/app_generators/rx_app/templates/swfobject.js +5 -0
  30. data/bin/rx-gen +31 -0
  31. data/lib/restfulx.rb +90 -0
  32. data/lib/restfulx/active_foo.rb +181 -0
  33. data/lib/restfulx/active_record_tasks.rb +90 -0
  34. data/lib/restfulx/active_record_uuid_helper.rb +17 -0
  35. data/lib/restfulx/configuration.rb +75 -0
  36. data/lib/restfulx/datamapper_foo.rb +81 -0
  37. data/lib/restfulx/rails/recipes.rb +60 -0
  38. data/lib/restfulx/rails/schema_to_yaml.rb +111 -0
  39. data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +8 -0
  40. data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +17 -0
  41. data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +73 -0
  42. data/lib/restfulx/rails/swf_helper.rb +59 -0
  43. data/lib/restfulx/tasks.rb +110 -0
  44. data/rails_generators/rx_config/USAGE +19 -0
  45. data/rails_generators/rx_config/rx_config_generator.rb +151 -0
  46. data/rails_generators/rx_config/templates/actionscript.properties +16 -0
  47. data/rails_generators/rx_config/templates/actionscriptair.properties +16 -0
  48. data/rails_generators/rx_config/templates/expressInstall.swf +0 -0
  49. data/rails_generators/rx_config/templates/flex.properties +2 -0
  50. data/rails_generators/rx_config/templates/flex_controller.erb +4 -0
  51. data/rails_generators/rx_config/templates/html-template/AC_OETags.js +276 -0
  52. data/rails_generators/rx_config/templates/html-template/history/history.css +6 -0
  53. data/rails_generators/rx_config/templates/html-template/history/history.js +645 -0
  54. data/rails_generators/rx_config/templates/html-template/history/historyFrame.html +29 -0
  55. data/rails_generators/rx_config/templates/html-template/index.template.html +121 -0
  56. data/rails_generators/rx_config/templates/html-template/playerProductInstall.swf +0 -0
  57. data/rails_generators/rx_config/templates/index.erb +16 -0
  58. data/rails_generators/rx_config/templates/mainair-app.xml +134 -0
  59. data/rails_generators/rx_config/templates/mainapp-config.xml +22 -0
  60. data/rails_generators/rx_config/templates/mainapp.mxml +129 -0
  61. data/rails_generators/rx_config/templates/project-textmate.erb +72 -0
  62. data/rails_generators/rx_config/templates/project.properties +18 -0
  63. data/rails_generators/rx_config/templates/projectair.properties +24 -0
  64. data/rails_generators/rx_config/templates/restfulx.erb +75 -0
  65. data/rails_generators/rx_config/templates/restfulx.yml +65 -0
  66. data/rails_generators/rx_config/templates/restfulx_tasks.rake +9 -0
  67. data/rails_generators/rx_config/templates/routes.erb +47 -0
  68. data/rails_generators/rx_config/templates/session_store_flash.erb +1 -0
  69. data/rails_generators/rx_config/templates/swfobject.js +5 -0
  70. data/rails_generators/rx_controller/USAGE +10 -0
  71. data/rails_generators/rx_controller/rx_controller_generator.rb +31 -0
  72. data/rails_generators/rx_controller/templates/controller.as.erb +38 -0
  73. data/rails_generators/rx_main_app/USAGE +8 -0
  74. data/rails_generators/rx_main_app/rx_main_app_generator.rb +60 -0
  75. data/rails_generators/rx_main_app/templates/mainapp.mxml +129 -0
  76. data/rails_generators/rx_scaffold/USAGE +35 -0
  77. data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +242 -0
  78. data/rails_generators/rx_scaffold/templates/controllers/default.rb.erb +125 -0
  79. data/rails_generators/rx_scaffold/templates/controllers/resource_controller.rb.erb +23 -0
  80. data/rails_generators/rx_scaffold/templates/fixtures.yml.erb +39 -0
  81. data/rails_generators/rx_scaffold/templates/functional_test.rb +45 -0
  82. data/rails_generators/rx_scaffold/templates/helper_test.rb +4 -0
  83. data/rails_generators/rx_scaffold/templates/layouts/default.erb +167 -0
  84. data/rails_generators/rx_scaffold/templates/migration.rb.erb +46 -0
  85. data/rails_generators/rx_scaffold/templates/model.as.erb +73 -0
  86. data/rails_generators/rx_scaffold/templates/model.rb.erb +46 -0
  87. data/rails_generators/rx_yaml_scaffold/USAGE +51 -0
  88. data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +68 -0
  89. data/rxgen_generators/rx_config/USAGE +5 -0
  90. data/rxgen_generators/rx_config/rx_config_generator.rb +21 -0
  91. data/rxgen_generators/rx_controller/USAGE +10 -0
  92. data/rxgen_generators/rx_controller/rx_controller_generator.rb +41 -0
  93. data/rxgen_generators/rx_controller/templates/assist.py +65 -0
  94. data/rxgen_generators/rx_controller/templates/controller.as.erb +38 -0
  95. data/rxgen_generators/rx_controller/templates/iso8601.py +92 -0
  96. data/rxgen_generators/rx_controller/templates/restful.py +136 -0
  97. data/rxgen_generators/rx_main_app/USAGE +8 -0
  98. data/rxgen_generators/rx_main_app/rx_main_app_generator.rb +65 -0
  99. data/rxgen_generators/rx_main_app/templates/main.py.erb +29 -0
  100. data/rxgen_generators/rx_main_app/templates/mainapp.mxml +152 -0
  101. data/rxgen_generators/rx_scaffold/USAGE +29 -0
  102. data/rxgen_generators/rx_scaffold/rx_scaffold_generator.rb +194 -0
  103. data/rxgen_generators/rx_scaffold/templates/controller.py.erb +27 -0
  104. data/rxgen_generators/rx_scaffold/templates/layouts/default.erb +167 -0
  105. data/rxgen_generators/rx_scaffold/templates/model.as.erb +73 -0
  106. data/rxgen_generators/rx_scaffold/templates/model.py.erb +14 -0
  107. data/rxgen_generators/rx_yaml_scaffold/USAGE +45 -0
  108. data/rxgen_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +47 -0
  109. data/spec/restfulx_spec.rb +4 -0
  110. data/spec/spec_helper.rb +13 -0
  111. data/tasks/restfulx.rake +2 -0
  112. data/test/rails/controllers/application_controller.rb +15 -0
  113. data/test/rails/controllers/locations_controller.rb +93 -0
  114. data/test/rails/controllers/notes_controller.rb +96 -0
  115. data/test/rails/controllers/projects_controller.rb +93 -0
  116. data/test/rails/controllers/tasks_controller.rb +93 -0
  117. data/test/rails/controllers/users_controller.rb +93 -0
  118. data/test/rails/database.yml +4 -0
  119. data/test/rails/fixtures/locations.yml +8 -0
  120. data/test/rails/fixtures/notes.yml +17 -0
  121. data/test/rails/fixtures/projects.yml +25 -0
  122. data/test/rails/fixtures/simple_properties.yml +19 -0
  123. data/test/rails/fixtures/tasks.yml +46 -0
  124. data/test/rails/fixtures/users.yml +13 -0
  125. data/test/rails/helpers/functional_test_helper.rb +21 -0
  126. data/test/rails/helpers/test_helper.rb +54 -0
  127. data/test/rails/helpers/unit_test_helper.rb +29 -0
  128. data/test/rails/model.yml +35 -0
  129. data/test/rails/models/location.rb +4 -0
  130. data/test/rails/models/note.rb +3 -0
  131. data/test/rails/models/project.rb +4 -0
  132. data/test/rails/models/simple_property.rb +2 -0
  133. data/test/rails/models/task.rb +18 -0
  134. data/test/rails/models/user.rb +20 -0
  135. data/test/rails/schema.rb +77 -0
  136. data/test/rails/test.swf +1 -0
  137. data/test/rails/test_active_foo.rb +36 -0
  138. data/test/rails/test_rails_integration_functional.rb +22 -0
  139. data/test/rails/test_to_fxml.rb +35 -0
  140. data/test/rails/test_to_json.rb +23 -0
  141. data/test/rails/views/notes/empty_params_action.html.erb +1 -0
  142. data/test/rails/views/notes/index.html.erb +1 -0
  143. metadata +234 -0
@@ -0,0 +1,29 @@
1
+ <html>
2
+ <head>
3
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
4
+ <META HTTP-EQUIV="Expires" CONTENT="-1">
5
+ </head>
6
+ <body>
7
+ <script>
8
+ function processUrl()
9
+ {
10
+
11
+ var pos = url.indexOf("?");
12
+ url = pos != -1 ? url.substr(pos + 1) : "";
13
+ if (!parent._ie_firstload) {
14
+ parent.BrowserHistory.setBrowserURL(url);
15
+ try {
16
+ parent.BrowserHistory.browserURLChange(url);
17
+ } catch(e) { }
18
+ } else {
19
+ parent._ie_firstload = false;
20
+ }
21
+ }
22
+
23
+ var url = document.location.href;
24
+ processUrl();
25
+ document.write(url);
26
+ </script>
27
+ Hidden frame for Browser History support.
28
+ </body>
29
+ </html>
@@ -0,0 +1,121 @@
1
+ <!-- saved from url=(0014)about:internet -->
2
+ <html lang="en">
3
+
4
+ <!--
5
+ Smart developers always View Source.
6
+
7
+ This application was built using Adobe Flex, an open source framework
8
+ for building rich Internet applications that get delivered via the
9
+ Flash Player or to desktops via Adobe AIR.
10
+
11
+ Learn more about Flex at http://flex.org
12
+ // -->
13
+
14
+ <head>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+
17
+ <!-- BEGIN Browser History required section -->
18
+ <link rel="stylesheet" type="text/css" href="history/history.css" />
19
+ <!-- END Browser History required section -->
20
+
21
+ <title>${title}</title>
22
+ <script src="AC_OETags.js" language="javascript"></script>
23
+
24
+ <!-- BEGIN Browser History required section -->
25
+ <script src="history/history.js" language="javascript"></script>
26
+ <!-- END Browser History required section -->
27
+
28
+ <style>
29
+ body { margin: 0px; overflow:hidden }
30
+ </style>
31
+ <script language="JavaScript" type="text/javascript">
32
+ <!--
33
+ // -----------------------------------------------------------------------------
34
+ // Globals
35
+ // Major version of Flash required
36
+ var requiredMajorVersion = ${version_major};
37
+ // Minor version of Flash required
38
+ var requiredMinorVersion = ${version_minor};
39
+ // Minor version of Flash required
40
+ var requiredRevision = ${version_revision};
41
+ // -----------------------------------------------------------------------------
42
+ // -->
43
+ </script>
44
+ </head>
45
+
46
+ <body scroll="no">
47
+ <script language="JavaScript" type="text/javascript">
48
+ <!--
49
+ // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
50
+ var hasProductInstall = DetectFlashVer(6, 0, 65);
51
+
52
+ // Version check based upon the values defined in globals
53
+ var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
54
+
55
+ if ( hasProductInstall && !hasRequestedVersion ) {
56
+ // DO NOT MODIFY THE FOLLOWING FOUR LINES
57
+ // Location visited after installation is complete if installation is required
58
+ var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
59
+ var MMredirectURL = window.location;
60
+ document.title = document.title.slice(0, 47) + " - Flash Player Installation";
61
+ var MMdoctitle = document.title;
62
+
63
+ AC_FL_RunContent(
64
+ "src", "playerProductInstall",
65
+ "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
66
+ "width", "${width}",
67
+ "height", "${height}",
68
+ "align", "middle",
69
+ "id", "${application}",
70
+ "quality", "high",
71
+ "bgcolor", "${bgcolor}",
72
+ "name", "${application}",
73
+ "allowScriptAccess","sameDomain",
74
+ "type", "application/x-shockwave-flash",
75
+ "pluginspage", "http://www.adobe.com/go/getflashplayer"
76
+ );
77
+ } else if (hasRequestedVersion) {
78
+ // if we've detected an acceptable version
79
+ // embed the Flash Content SWF when all tests are passed
80
+ AC_FL_RunContent(
81
+ "src", "${swf}",
82
+ "width", "${width}",
83
+ "height", "${height}",
84
+ "align", "middle",
85
+ "id", "${application}",
86
+ "quality", "high",
87
+ "bgcolor", "${bgcolor}",
88
+ "name", "${application}",
89
+ "allowScriptAccess","sameDomain",
90
+ "type", "application/x-shockwave-flash",
91
+ "pluginspage", "http://www.adobe.com/go/getflashplayer"
92
+ );
93
+ } else { // flash is too old or we can't detect the plugin
94
+ var alternateContent = 'Alternate HTML content should be placed here. '
95
+ + 'This content requires the Adobe Flash Player. '
96
+ + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
97
+ document.write(alternateContent); // insert non-flash content
98
+ }
99
+ // -->
100
+ </script>
101
+ <noscript>
102
+ <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
103
+ id="${application}" width="${width}" height="${height}"
104
+ codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
105
+ <param name="movie" value="${swf}.swf" />
106
+ <param name="quality" value="high" />
107
+ <param name="bgcolor" value="${bgcolor}" />
108
+ <param name="allowScriptAccess" value="sameDomain" />
109
+ <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
110
+ width="${width}" height="${height}" name="${application}" align="middle"
111
+ play="true"
112
+ loop="false"
113
+ quality="high"
114
+ allowScriptAccess="sameDomain"
115
+ type="application/x-shockwave-flash"
116
+ pluginspage="http://www.adobe.com/go/getflashplayer">
117
+ </embed>
118
+ </object>
119
+ </noscript>
120
+ </body>
121
+ </html>
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <title><%= project_name %></title>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5
+ <script type="text/javascript" src="javascripts/swfobject.js"></script>
6
+ <script type="text/javascript">
7
+ swfobject.embedSWF("bin/<%= flex_project_name %>.swf", "mainApp", "100%", "100%", "9.0.0", "expressInstall.swf");
8
+ </script>
9
+ <style>
10
+ body { margin: 0px; overflow: hidden; }
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <div id="mainApp">
15
+ <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
16
+ </div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,11 @@
1
+ indexes:
2
+
3
+ # AUTOGENERATED
4
+
5
+ # This index.yaml is automatically updated whenever the dev_appserver
6
+ # detects that a new type of query is run. If you want to manage the
7
+ # index.yaml file manually, remove the above marker line (the line
8
+ # saying "# AUTOGENERATED"). If you want to manage some indexes
9
+ # manually, move them above the marker line. The index.yaml file is
10
+ # automatically uploaded to the admin console when you next deploy
11
+ # your application using appcfg.py.
@@ -0,0 +1,134 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <application xmlns="http://ns.adobe.com/air/application/1.5">
3
+
4
+ <!-- Adobe AIR Application Descriptor File Template.
5
+
6
+ Specifies parameters for identifying, installing, and launching AIR applications.
7
+ See http://www.adobe.com/go/air_1.0_application_descriptor for complete documentation.
8
+
9
+ xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/1.0
10
+ The last segment of the namespace specifies the version
11
+ of the AIR runtime required for this application to run.
12
+
13
+ minimumPatchLevel - The minimum patch level of the AIR runtime required to run
14
+ the application. Optional.
15
+ -->
16
+
17
+ <!-- The application identifier string, unique to this application. Required. -->
18
+ <id><%= flex_project_name %></id>
19
+
20
+ <!-- Used as the filename for the application. Required. -->
21
+ <filename><%= flex_project_name %></filename>
22
+
23
+ <!-- The name that is displayed in the AIR application installer. Optional. -->
24
+ <name><%= flex_project_name %></name>
25
+
26
+ <!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
27
+ <version>v1</version>
28
+
29
+ <!-- Description, displayed in the AIR application installer. Optional. -->
30
+ <!-- <description></description> -->
31
+
32
+ <!-- Copyright information. Optional -->
33
+ <!-- <copyright></copyright> -->
34
+
35
+ <!-- Settings for the application's initial window. Required. -->
36
+ <initialWindow>
37
+ <!-- The main SWF or HTML file of the application. Required. -->
38
+ <!-- Note: In Flex Builder, the SWF reference is set automatically. -->
39
+ <content>[This value will be overwritten by Flex Builder in the output app.xml]</content>
40
+
41
+ <!-- The title of the main window. Optional. -->
42
+ <!-- <title></title> -->
43
+
44
+ <!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
45
+ <!-- <systemChrome></systemChrome> -->
46
+
47
+ <!-- Whether the window is transparent. Only applicable when systemChrome is false. Optional. Default false. -->
48
+ <!-- <transparent></transparent> -->
49
+
50
+ <!-- Whether the window is initially visible. Optional. Default false. -->
51
+ <!-- <visible></visible> -->
52
+
53
+ <!-- Whether the user can minimize the window. Optional. Default true. -->
54
+ <!-- <minimizable></minimizable> -->
55
+
56
+ <!-- Whether the user can maximize the window. Optional. Default true. -->
57
+ <!-- <maximizable></maximizable> -->
58
+
59
+ <!-- Whether the user can resize the window. Optional. Default true. -->
60
+ <!-- <resizable></resizable> -->
61
+
62
+ <!-- The window's initial width. Optional. -->
63
+ <width>800</width>
64
+
65
+ <!-- The window's initial height. Optional. -->
66
+ <height>600</height>
67
+
68
+ <!-- The window's initial x position. Optional. -->
69
+ <!-- <x></x> -->
70
+
71
+ <!-- The window's initial y position. Optional. -->
72
+ <!-- <y></y> -->
73
+
74
+ <!-- The window's minimum size, specified as a width/height pair, such as "400 200". Optional. -->
75
+ <!-- <minSize></minSize> -->
76
+
77
+ <!-- The window's initial maximum size, specified as a width/height pair, such as "1600 1200". Optional. -->
78
+ <!-- <maxSize></maxSize> -->
79
+ </initialWindow>
80
+
81
+ <!-- The subpath of the standard default installation location to use. Optional. -->
82
+ <!-- <installFolder></installFolder> -->
83
+
84
+ <!-- The subpath of the Windows Start/Programs menu to use. Optional. -->
85
+ <!-- <programMenuFolder></programMenuFolder> -->
86
+
87
+ <!-- The icon the system uses for the application. For at least one resolution,
88
+ specify the path to a PNG file included in the AIR package. Optional. -->
89
+ <!-- <icon>
90
+ <image16x16></image16x16>
91
+ <image32x32></image32x32>
92
+ <image48x48></image48x48>
93
+ <image128x128></image128x128>
94
+ </icon> -->
95
+
96
+ <!-- Whether the application handles the update when a user double-clicks an update version
97
+ of the AIR file (true), or the default AIR application installer handles the update (false).
98
+ Optional. Default false. -->
99
+ <!-- <customUpdateUI></customUpdateUI> -->
100
+
101
+ <!-- Whether the application can be launched when the user clicks a link in a web browser.
102
+ Optional. Default false. -->
103
+ <!-- <allowBrowserInvocation></allowBrowserInvocation> -->
104
+
105
+ <!-- Listing of file types for which the application can register. Optional. -->
106
+ <!-- <fileTypes> -->
107
+
108
+ <!-- Defines one file type. Optional. -->
109
+ <!-- <fileType> -->
110
+
111
+ <!-- The name that the system displays for the registered file type. Required. -->
112
+ <!-- <name></name> -->
113
+
114
+ <!-- The extension to register. Required. -->
115
+ <!-- <extension></extension> -->
116
+
117
+ <!-- The description of the file type. Optional. -->
118
+ <!-- <description></description> -->
119
+
120
+ <!-- The MIME type. Optional. -->
121
+ <!-- <contentType></contentType> -->
122
+
123
+ <!-- The icon to display for the file type. Optional. -->
124
+ <!-- <icon>
125
+ <image16x16></image16x16>
126
+ <image32x32></image32x32>
127
+ <image48x48></image48x48>
128
+ <image128x128></image128x128>
129
+ </icon> -->
130
+
131
+ <!-- </fileType> -->
132
+ <!-- </fileTypes> -->
133
+
134
+ </application>
@@ -0,0 +1,22 @@
1
+ <flex-config>
2
+ <benchmark>false</benchmark>
3
+ <default-background-color>#FFFFFF</default-background-color>
4
+ <compiler>
5
+ <incremental>false</incremental>
6
+ <keep-as3-metadata append="true">
7
+ <name>Resource</name>
8
+ <name>HasOne</name>
9
+ <name>HasMany</name>
10
+ <name>BelongsTo</name>
11
+ <name>DateTime</name>
12
+ <name>Lazy</name>
13
+ <name>Ignored</name>
14
+ <name>Nested</name>
15
+ </keep-as3-metadata>
16
+ <optimize>true</optimize>
17
+ <keep-generated-actionscript>false</keep-generated-actionscript>
18
+ <warn-no-constructor>false</warn-no-constructor>
19
+ <warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>
20
+ <debug>false</debug>
21
+ </compiler>
22
+ </flex-config>
@@ -0,0 +1,152 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:<%= application_tag %> xmlns:mx="http://www.adobe.com/2006/mxml"
3
+ xmlns:generated="<%= base_package %>.views.generated.*"
4
+ paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8"
5
+ layout="horizontal" styleName="plain" initialize="init()">
6
+ <mx:Script>
7
+ <![CDATA[
8
+ <% if use_air -%>
9
+ <% if distributed -%>
10
+ import air.net.SocketMonitor;
11
+ import org.restfulx.events.PullEndEvent;
12
+ import org.restfulx.events.PullStartEvent;
13
+ import org.restfulx.events.PushEndEvent;
14
+ import org.restfulx.events.PushStartEvent;
15
+ import org.restfulx.controllers.ChangeController;
16
+ import org.restfulx.services.ISyncingServiceProvider;
17
+ <% end -%>
18
+ import org.restfulx.services.air.AIRServiceProvider;
19
+ <% end -%>
20
+ <% if use_gae -%>
21
+ import org.restfulx.services.http.GAEHTTPServiceProvider;
22
+ <% else -%>
23
+ import org.restfulx.services.http.XMLHTTPServiceProvider;
24
+ <% end -%>
25
+ import org.restfulx.Rx;
26
+ import <%= base_package %>.controllers.<%= command_controller_name %>;
27
+ <% if use_air -%>
28
+ <% if distributed -%>
29
+
30
+ [Bindable]
31
+ private var socketMonitor:SocketMonitor;
32
+
33
+ [Bindable]
34
+ private var online:Boolean;
35
+
36
+ [Bindable]
37
+ private var syncStatus:String;
38
+ <% end -%>
39
+ <% end -%>
40
+
41
+ private function init():void {
42
+ <% if use_air -%>
43
+ <% if distributed -%>
44
+ Rx.httpRootUrl = "http://localhost:3000/";
45
+ Rx.enableSync = true;
46
+
47
+ socketMonitor = new SocketMonitor("localhost", 3000);
48
+ socketMonitor.pollInterval = 2000; /* miliseconds */
49
+ socketMonitor.addEventListener(StatusEvent.STATUS, onNetworkStatusChange);
50
+ socketMonitor.start();
51
+
52
+ <% end -%>
53
+ <%= command_controller_name %>.initialize([AIRServiceProvider],
54
+ AIRServiceProvider.ID, "<%= base_package %>");
55
+ <% if distributed -%>
56
+
57
+ <% if use_gae -%>
58
+ Rx.changes.setSyncProviders(
59
+ ISyncingServiceProvider(Rx.services.getServiceProvider(AIRServiceProvider.ID)),
60
+ Rx.services.getServiceProvider(GAEHTTPServiceProvider.ID));
61
+ <% else -%>
62
+ Rx.changes.setSyncProviders(
63
+ ISyncingServiceProvider(Rx.services.getServiceProvider(AIRServiceProvider.ID)),
64
+ Rx.services.getServiceProvider(XMLHTTPServiceProvider.ID));
65
+ <% end -%>
66
+
67
+ Rx.changes.addEventListener(PushStartEvent.ID, onPushStart);
68
+ Rx.changes.addEventListener(PushEndEvent.ID, onPushEnd);
69
+ Rx.changes.addEventListener(PullStartEvent.ID, onPullStart);
70
+ Rx.changes.addEventListener(PullEndEvent.ID, onPullEnd);
71
+ <% end -%>
72
+ <% else -%>
73
+ <% if use_gae -%>
74
+ <%= command_controller_name %>.initialize([GAEHTTPServiceProvider], GAEHTTPServiceProvider.ID);
75
+ <% else -%>
76
+ <%= command_controller_name %>.initialize();
77
+ <% end -%>
78
+ <% end -%>
79
+ }
80
+ <% if use_air -%>
81
+ <% if distributed -%>
82
+
83
+ private function onPushStart(event:Event):void {
84
+ syncStatus = "Pushing changes ...";
85
+ }
86
+
87
+ private function onPushEnd(event:Event):void {
88
+ syncStatus = "Push complete.";
89
+ }
90
+
91
+ private function onPullStart(event:Event):void {
92
+ syncStatus = "Pulling data...";
93
+ }
94
+
95
+ private function onPullEnd(event:Event):void {
96
+ syncStatus = "Pull complete.";
97
+ }
98
+
99
+ private function onNetworkStatusChange(event:StatusEvent):void {
100
+ online = (socketMonitor.available) ? true : false;
101
+
102
+ if (online) {
103
+ <% if use_gae -%>
104
+ Rx.defaultServiceId = GAEHTTPServiceProvider.ID;
105
+ <% else -%>
106
+ Rx.defaultServiceId = XMLHTTPServiceProvider.ID;
107
+ <% end -%>
108
+ } else {
109
+ Rx.defaultServiceId = AIRServiceProvider.ID;
110
+ }
111
+ }
112
+
113
+ private function getCurrentProviderName(id:int):String {
114
+ switch (id) {
115
+ <% if use_gae -%>
116
+ case GAEHTTPServiceProvider.ID:
117
+ return "GAE";
118
+ <% else -%>
119
+ case XMLHTTPServiceProvider.ID:
120
+ return "XML/HTTP";
121
+ <% end -%>
122
+ case AIRServiceProvider.ID:
123
+ return "AIR (SQLite)";
124
+ default :
125
+ return "No idea";
126
+ }
127
+ }
128
+ <% end -%>
129
+ <% end -%>
130
+ ]]>
131
+ </mx:Script>
132
+ <% if use_air -%>
133
+ <% if distributed -%>
134
+ <mx:VBox height="100%">
135
+ <mx:Label text="Current Provider: {getCurrentProviderName(Rx.defaultServiceId)}"/>
136
+ <mx:Label text="Status: {online ? 'Online' : 'Offline' }"/>
137
+ <mx:HBox>
138
+ <mx:Button label="Push" click="{Rx.changes.push()}" enabled="{online}"/>
139
+ <mx:Button label="Pull" click="{Rx.changes.pull()}" enabled="{online}"/>
140
+ </mx:HBox>
141
+ <mx:Label text="{syncStatus}"/>
142
+ </mx:VBox>
143
+ <% end -%>
144
+ <% end -%>
145
+ <mx:LinkBar dataProvider="{mainViewStack}" direction="vertical" borderStyle="solid" backgroundColor="#EEEEEE"/>
146
+ <mx:ViewStack id="mainViewStack" width="100%" height="100%">
147
+ <!-- For a simple demo, put all the components here. -->
148
+ <% for component in component_names -%>
149
+ <generated:<%= component %>/>
150
+ <% end -%>
151
+ </mx:ViewStack>
152
+ </mx:<%= application_tag %>>