Browse files

Merge branch 'develop-perf' of git://github.com/yahoo/mojito into par…

…tials
  • Loading branch information...
2 parents e6499c5 + bba2079 commit 9d75095a46222495d2e4b2772c9fa974d9ede7dd @caridy committed Nov 21, 2012
Showing with 457 additions and 5,987 deletions.
  1. +0 −4 docs/dev_guide/code_exs/adding_assets.rst
  2. +21 −21 docs/dev_guide/code_exs/view_engines.rst
  3. +10 −24 docs/dev_guide/intro/mojito_configuring.rst
  4. +2 −1 docs/dev_guide/intro/mojito_mojits.rst
  5. +5 −3 docs/dev_guide/intro/mojito_mvc.rst
  6. +1 −3 docs/dev_guide/intro/mojito_static_resources.rst
  7. +19 −19 docs/dev_guide/topics/mojito_extensions.rst
  8. +0 −66 docs/dev_guide/topics/mojito_logging.rst
  9. +1 −1 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
  10. +0 −4 examples/input/cookies/mojits/ClientCookie/controller.common.js
  11. +0 −7 examples/newsboxes/application.json
  12. +7 −12 examples/performance/string/application.json
  13. +0 −4 examples/sandbox/bindercomm/mojits/BlueChild/controller.server.js
  14. +0 −4 examples/sandbox/bindercomm/mojits/Parent/controller.server.js
  15. +0 −5 examples/sandbox/bindercomm/mojits/RedChild/controller.server.js
  16. +0 −9 examples/sandbox/binderrender/application.json
  17. +0 −11 examples/sandbox/bindertime/application.json
  18. +0 −4 examples/sandbox/bindertime/mojits/Layout/controller.common.js
  19. +0 −4 examples/sandbox/bindertime/mojits/Loader/controller.common.js
  20. +0 −6 examples/sandbox/controller-state/application.json
  21. +0 −4 examples/sandbox/controller-state/mojits/Parent/controller.common.js
  22. +5 −9 examples/sandbox/controller-state/mojits/Stateful/controller.common.js
  23. +0 −4 examples/sandbox/metabubble/mojits/Child/controller.common.js
  24. +0 −4 examples/sandbox/metabubble/mojits/Parent/controller.common.js
  25. +0 −4 examples/sandbox/server_side/mojits/Layout/controller.server.js
  26. +0 −4 examples/sandbox/server_side/mojits/MyServer/controller.server.js
  27. +0 −4 examples/sandbox/strangeloop/application.json
  28. +0 −6 examples/sandbox/view_refresh/application.json
  29. +0 −4 examples/sandbox/yuiconf/application.json
  30. +0 −382 lib/app/addons/ac/output-adapter.common.js
  31. +0 −224 lib/app/autoload/controller-context.common.js
  32. +4 −0 lib/app/autoload/dispatch.client.js
  33. +2 −0 lib/app/autoload/json-stringify-hack.server.js
  34. +0 −171 lib/app/autoload/loader.common.js
  35. +0 −217 lib/app/autoload/logger.common.js
  36. +0 −203 lib/app/autoload/resource-store-adapter.common.js
  37. +0 −5 lib/app/autoload/store.server.js
  38. 0 lib/app/autoload/{tunnel.common.js → tunnel-client.common.js}
  39. +0 −4 lib/app/mojits/TunnelProxy/controller.server.js
  40. +0 −37 lib/mojito.js
  41. +0 −147 lib/server-log.js
  42. +1 −1 package.json
  43. +1 −7 tests/base/mojito-test.js
  44. +1 −5 tests/fixtures/badfiles/mojits/M/controller.server.js
  45. +0 −17 tests/fixtures/gsg5-appConfig/application.json
  46. +0 −6 tests/fixtures/gsg5-appConfig/server.js
  47. +0 −11 tests/fixtures/gsg5/application.json
  48. +0 −6 tests/fixtures/gsg5/server.js
  49. +0 −58 tests/fixtures/ondemand/application.json
  50. +0 −16 tests/fixtures/ondemand/index.js
  51. +0 −69 tests/fixtures/ondemand/models/flickr.common.js
  52. +0 −27 tests/fixtures/ondemand/mojits/FlickrBrowser/assets/logmutator.js
  53. +0 −48 tests/fixtures/ondemand/mojits/FlickrBrowser/binders/index.js
  54. +0 −33 tests/fixtures/ondemand/mojits/FlickrBrowser/controller.common.js
  55. +0 −12 tests/fixtures/ondemand/mojits/FlickrBrowser/views/index.hb.html
  56. +0 −14 tests/fixtures/ondemand/mojits/FlickrBrowser/views/index.iphone.hb.html
  57. +0 −41 tests/fixtures/ondemand/mojits/FlickrDetail/assets/index.css
  58. +0 −12 tests/fixtures/ondemand/mojits/FlickrDetail/assets/message.css
  59. +0 −65 tests/fixtures/ondemand/mojits/FlickrDetail/binders/index.js
  60. +0 −15 tests/fixtures/ondemand/mojits/FlickrDetail/binders/message.js
  61. +0 −64 tests/fixtures/ondemand/mojits/FlickrDetail/controller.common.js
  62. +0 −29 tests/fixtures/ondemand/mojits/FlickrDetail/lang/FlickrDetail_de.js
  63. +0 −29 tests/fixtures/ondemand/mojits/FlickrDetail/lang/FlickrDetail_en-US.js
  64. +0 −45 tests/fixtures/ondemand/mojits/FlickrDetail/views/index.hb.html
  65. +0 −45 tests/fixtures/ondemand/mojits/FlickrDetail/views/index.iphone.hb.html
  66. +0 −3 tests/fixtures/ondemand/mojits/FlickrDetail/views/message.hb.html
  67. +0 −12 tests/fixtures/ondemand/mojits/PagedFlickr/assets/index.css
  68. +0 −62 tests/fixtures/ondemand/mojits/PagedFlickr/binders/index.js
  69. +0 −90 tests/fixtures/ondemand/mojits/PagedFlickr/controller.common.js
  70. +0 −90 tests/fixtures/ondemand/mojits/PagedFlickr/controller.iphone.common.js
  71. +0 −18 tests/fixtures/ondemand/mojits/PagedFlickr/lang/PagedFlickr_de.js
  72. +0 −18 tests/fixtures/ondemand/mojits/PagedFlickr/lang/PagedFlickr_en-US.js
  73. +0 −18 tests/fixtures/ondemand/mojits/PagedFlickr/lang/PagedFlickr_en.js
  74. +0 −21 tests/fixtures/ondemand/mojits/PagedFlickr/views/index.hb.html
  75. +0 −26 tests/fixtures/ondemand/mojits/PagedFlickr/views/index.iphone.hb.html
  76. +0 −16 tests/fixtures/ondemand/package.json
  77. +0 −23 tests/fixtures/ondemand/routes.json
  78. +0 −12 tests/fixtures/ondemand/server.js
  79. +0 −58 tests/fixtures/precomputed-ondemand/application.json
  80. +0 −16 tests/fixtures/precomputed-ondemand/index.js
  81. +0 −69 tests/fixtures/precomputed-ondemand/models/flickr.common.js
  82. +0 −27 tests/fixtures/precomputed-ondemand/mojits/FlickrBrowser/assets/logmutator.js
  83. +0 −48 tests/fixtures/precomputed-ondemand/mojits/FlickrBrowser/binders/index.js
  84. +0 −33 tests/fixtures/precomputed-ondemand/mojits/FlickrBrowser/controller.common.js
  85. +0 −12 tests/fixtures/precomputed-ondemand/mojits/FlickrBrowser/views/index.hb.html
  86. +0 −14 tests/fixtures/precomputed-ondemand/mojits/FlickrBrowser/views/index.iphone.hb.html
  87. +0 −41 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/assets/index.css
  88. +0 −12 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/assets/message.css
  89. +0 −65 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/binders/index.js
  90. +0 −15 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/binders/message.js
  91. +0 −64 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/controller.common.js
  92. +0 −29 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/lang/FlickrDetail_de.js
  93. +0 −29 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/lang/FlickrDetail_en-US.js
  94. +0 −45 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/views/index.hb.html
  95. +0 −45 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/views/index.iphone.hb.html
  96. +0 −3 tests/fixtures/precomputed-ondemand/mojits/FlickrDetail/views/message.hb.html
  97. +0 −12 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/assets/index.css
  98. +0 −62 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/binders/index.js
  99. +0 −90 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/controller.common.js
  100. +0 −90 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/controller.iphone.common.js
  101. +0 −18 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/lang/PagedFlickr_de.js
  102. +0 −18 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/lang/PagedFlickr_en-US.js
  103. +0 −18 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/lang/PagedFlickr_en.js
  104. +0 −21 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/views/index.hb.html
  105. +0 −26 tests/fixtures/precomputed-ondemand/mojits/PagedFlickr/views/index.iphone.hb.html
  106. +0 −16 tests/fixtures/precomputed-ondemand/package.json
  107. +0 −23 tests/fixtures/precomputed-ondemand/routes.json
  108. +0 −12 tests/fixtures/precomputed-ondemand/server.js
  109. +0 −58 tests/fixtures/precomputed/application.json
  110. +0 −16 tests/fixtures/precomputed/index.js
  111. +0 −69 tests/fixtures/precomputed/models/flickr.common.js
  112. +0 −27 tests/fixtures/precomputed/mojits/FlickrBrowser/assets/logmutator.js
  113. +0 −48 tests/fixtures/precomputed/mojits/FlickrBrowser/binders/index.js
  114. +0 −33 tests/fixtures/precomputed/mojits/FlickrBrowser/controller.common.js
  115. +0 −12 tests/fixtures/precomputed/mojits/FlickrBrowser/views/index.hb.html
  116. +0 −14 tests/fixtures/precomputed/mojits/FlickrBrowser/views/index.iphone.hb.html
  117. +0 −41 tests/fixtures/precomputed/mojits/FlickrDetail/assets/index.css
  118. +0 −12 tests/fixtures/precomputed/mojits/FlickrDetail/assets/message.css
  119. +0 −65 tests/fixtures/precomputed/mojits/FlickrDetail/binders/index.js
  120. +0 −15 tests/fixtures/precomputed/mojits/FlickrDetail/binders/message.js
  121. +0 −64 tests/fixtures/precomputed/mojits/FlickrDetail/controller.common.js
  122. +0 −29 tests/fixtures/precomputed/mojits/FlickrDetail/lang/FlickrDetail_de.js
  123. +0 −29 tests/fixtures/precomputed/mojits/FlickrDetail/lang/FlickrDetail_en-US.js
  124. +0 −45 tests/fixtures/precomputed/mojits/FlickrDetail/views/index.hb.html
  125. +0 −45 tests/fixtures/precomputed/mojits/FlickrDetail/views/index.iphone.hb.html
  126. +0 −3 tests/fixtures/precomputed/mojits/FlickrDetail/views/message.hb.html
  127. +0 −12 tests/fixtures/precomputed/mojits/PagedFlickr/assets/index.css
  128. +0 −62 tests/fixtures/precomputed/mojits/PagedFlickr/binders/index.js
  129. +0 −90 tests/fixtures/precomputed/mojits/PagedFlickr/controller.common.js
  130. +0 −90 tests/fixtures/precomputed/mojits/PagedFlickr/controller.iphone.common.js
  131. +0 −18 tests/fixtures/precomputed/mojits/PagedFlickr/lang/PagedFlickr_de.js
  132. +0 −18 tests/fixtures/precomputed/mojits/PagedFlickr/lang/PagedFlickr_en-US.js
  133. +0 −18 tests/fixtures/precomputed/mojits/PagedFlickr/lang/PagedFlickr_en.js
  134. +0 −21 tests/fixtures/precomputed/mojits/PagedFlickr/views/index.hb.html
  135. +0 −26 tests/fixtures/precomputed/mojits/PagedFlickr/views/index.iphone.hb.html
  136. +0 −16 tests/fixtures/precomputed/package.json
  137. +0 −23 tests/fixtures/precomputed/routes.json
  138. +0 −12 tests/fixtures/precomputed/server.js
  139. +0 −3 tests/fixtures/store/application.json
  140. +1 −5 tests/fixtures/store/mojits/test_mojit_2/controller.server.js
  141. +0 −6 tests/fixtures/store/server.js
  142. +1 −5 tests/fixtures/store/soloMojit/controller.server.js
  143. +1 −5 tests/fixtures/store_no_app_config/mojits/test_mojit/controller.server.js
  144. +0 −4 tests/func/applications/frameworkapp/commandline/mojits/Coverage/controller.server.js
  145. +0 −4 tests/func/applications/frameworkapp/commandline/mojits/ExecuteCommand/controller.server.js
  146. +0 −4 tests/func/applications/frameworkapp/common/just_one_mojit/one_level_in/Binders/controller.common.js
  147. +0 −4 tests/func/applications/frameworkapp/common/mojits/BlueChild/controller.common.js
  148. +0 −4 tests/func/applications/frameworkapp/common/mojits/BroadCast/controller.common.js
  149. +0 −4 tests/func/applications/frameworkapp/common/mojits/CM_Layout/controller.common.js
  150. +0 −4 tests/func/applications/frameworkapp/common/mojits/ClientCookie/controller.common.js
  151. +0 −4 tests/func/applications/frameworkapp/common/mojits/Coverage/controller.common.js
  152. +0 −4 tests/func/applications/frameworkapp/common/mojits/CoverageClient/controller.common.js
  153. +0 −4 tests/func/applications/frameworkapp/common/mojits/GlobalMojit/controller.common.js
  154. +0 −5 tests/func/applications/frameworkapp/common/mojits/GreenChild/controller.common.js
  155. +0 −4 tests/func/applications/frameworkapp/common/mojits/MetaChild/controller.common.js
  156. +0 −4 tests/func/applications/frameworkapp/common/mojits/MojitContainer/controller.common.js
  157. +0 −4 tests/func/applications/frameworkapp/common/mojits/MojitProxyMojit/controller.common.js
  158. +0 −4 tests/func/applications/frameworkapp/common/mojits/PartialMojit/controller.common.js
  159. +0 −5 tests/func/applications/frameworkapp/common/mojits/RedChild/controller.common.js
  160. +0 −4 tests/func/applications/frameworkapp/common/mojits/Stateful/controller.common.js
  161. +0 −4 tests/func/applications/frameworkapp/common/mojits/TestsLayout/controller.common.js
  162. +0 −4 ...plications/frameworkapp/common/mojits_subdir1/other_mojits/AccessGlobalMojit/controller.common.js
  163. +0 −4 ...unc/applications/frameworkapp/common/mojits_subdir1/other_mojits/AssetsMojit/controller.common.js
  164. +0 −4 tests/func/applications/frameworkapp/common/mojits_subdir1/other_mojits/CM_News/controller.common.js
  165. +0 −4 ...unc/applications/frameworkapp/common/mojits_subdir1/other_mojits/ConfigMojit/controller.common.js
  166. +0 −4 tests/func/applications/frameworkapp/configapp/mojits/Coverage/controller.common.js
  167. +0 −10 tests/func/applications/frameworkapp/routing/application.json
  168. +0 −4 tests/func/applications/frameworkapp/routing/mojits/Coverage/controller.server.js
  169. +0 −4 tests/func/applications/frameworkapp/routing/mojits/Poster/controller.server.js
  170. +0 −4 tests/func/applications/frameworkapp/routing/mojits/ShowUrl/controller.server.js
  171. +0 −4 tests/func/applications/frameworkapp/routing/mojits/SimpleRoute/controller.server.js
  172. +0 −4 tests/func/applications/frameworkapp/routing/mojits/SimpleRoute2/controller.server.js
  173. +0 −1 tests/func/applications/frameworkapp/serveronly/application.json
  174. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/Container/controller.server.js
  175. +0 −3 tests/func/applications/frameworkapp/serveronly/mojits/Cookies/controller.server.js
  176. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/Coverage/controller.server.js
  177. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/HttpAddonChild/controller.server.js
  178. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/HttpAddonParent/controller.server.js
  179. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/MultiAction/controller.server.js
  180. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/RESTLib/controller.common.js
  181. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/RefreshChild/controller.server.js
  182. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/RefreshParent/controller.server.js
  183. +0 −3 tests/func/applications/frameworkapp/serveronly/mojits/ServerCookie/controller.server.js
  184. +0 −4 tests/func/applications/frameworkapp/serveronly/mojits/Yca/controller.common.js
  185. +0 −4 tests/func/applications/frameworkapp/test_files/mojits/CM_Footer/controller.common.js
  186. +0 −4 tests/func/applications/frameworkapp/usecase/mojits/Coverage/controller.server.js
  187. +0 −4 tests/func/applications/frameworkapp/usecase/mojits/i18nMojit/controller.server.js
  188. +0 −4 tests/func/applications/frameworkapp/usecase/mojits/i18n_Mojit/controller.server.js
  189. +0 −2 tests/func/common/commonclienttest_descriptor.json
  190. +0 −2 tests/func/common/commonservertest_descriptor.json
  191. +0 −2 tests/func/config/configtest_descriptor.json
  192. +0 −2 tests/func/examples/developerguide/developerguide_descriptor.json
  193. +0 −2 tests/func/examples/input/input_descriptor.json
  194. +0 −2 tests/func/examples/newsboxes/newsboxes_descriptor.json
  195. +0 −2 tests/func/examples/simple/simple_descriptor.json
  196. +0 −2 tests/func/routing/routingtest_descriptor.json
  197. +0 −2 tests/func/serveronly/serveronlytest_descriptor.json
  198. +1 −1 tests/func/serveronly/testbz5264755.js
  199. +0 −2 tests/func/usecases/usecasestest_descriptor.json
  200. +11 −3 tests/run.js
  201. +1 −9 tests/unit/lib/app/addons/ac/ac_test_descriptor.json
  202. +1 −191 tests/unit/lib/app/addons/ac/test-deploy.server.js
  203. +0 −258 tests/unit/lib/app/addons/ac/test-output-adapter.common.js
  204. +0 −3 tests/unit/lib/app/addons/rs/test-config.js
  205. +1 −5 tests/unit/lib/app/addons/rs/test-yui.js
  206. +2 −2 tests/unit/lib/app/autoload/autoload_test_descriptor.json
  207. +334 −80 tests/unit/lib/app/autoload/test-action-context.common.js
  208. +0 −26 tests/unit/lib/app/autoload/test-controller-context.common.js
  209. +1 −1 tests/unit/lib/app/autoload/test-dispatch.client.js
  210. +1 −1 tests/unit/lib/app/autoload/test-dispatch.server.js
  211. +0 −153 tests/unit/lib/app/autoload/test-loader.common.js
  212. +0 −26 tests/unit/lib/app/autoload/test-logger.common.js
  213. +0 −2 tests/unit/lib/app/autoload/test-mojito-client.client.js
  214. +0 −142 tests/unit/lib/app/autoload/test-resource-store-adapter.common.js
  215. +8 −1 tests/unit/lib/app/autoload/test-store.client.js
  216. +2 −3 tests/unit/lib/app/autoload/test-store.server.js
  217. +1 −1 tests/unit/lib/app/autoload/test-tunnel.common.js
  218. +0 −7 tests/unit/lib/lib_test_descriptor.json
  219. +10 −30 tests/unit/lib/test-mojito.js
  220. +0 −24 tests/unit/lib/test-server-log.server.js
View
4 docs/dev_guide/code_exs/adding_assets.rst
@@ -2,10 +2,6 @@
Adding CSS
==========
-.. raw:: html
-
- <span class="testimate">Time Estimate: 10 minutes</span>&nbsp;&nbsp;&nbsp;<span class="difficulty">Difficulty: Beginner</span>
-
**Time Estimate:** 10 minutes
**Difficulty:** Beginner
View
42 docs/dev_guide/code_exs/view_engines.rst
@@ -54,14 +54,14 @@ Installing a Rendering Engine
You could write your own rendering engine or copy code into your Mojito
application, but this example follows the most common use case of installing
a rendering engine with ``npm``. We will be installing the rendering engine
- `EJS <http://embeddedjs.com/>`_ with ``npm``.
+`EJS <http://embeddedjs.com/>`_ with ``npm``.
Because your Mojito application is simply a ``npm`` module, you can have a
``node_modules`` directory for locally installing other modules. Thus, from
your application directory, you would use the following ``npm`` command to
install ``ejs``:
-``{app_dir}/ $ npm install ejs``
+``$ npm install ejs``
After you have installed ``ejs``, a ``node_modules`` directory will be created
with the contents similar to the following:
@@ -114,45 +114,45 @@ The view engine addon must have the following:
view engine addon with the name ``addons-viewengine-ejs`` in our code example
as seen below.
- .. code-block:: javascript
+ .. code-block:: javascript
- YUI.add('addons-viewengine-ejs', function(Y, NAME) {
+ YUI.add('addons-viewengine-ejs', function(Y, NAME) {
- // The addon name 'addons-viewengine-hb' is registered by YUI.add
+ // The addon name 'addons-viewengine-hb' is registered by YUI.add
- }, '0.1.0', {requires: []});
+ }, '0.1.0', {requires: []});
- a prototype of the object has the following two methods ``render`` and
``compiler`` as shown below. We will look at the ``render`` and ``compile``
methods more closely in the next section.
- .. code-block:: javascript
+ .. code-block:: javascript
- ...
+ ...
- EjsAdapter.prototype = {
+ EjsAdapter.prototype = {
- render: function(data, mojitType, tmpl, adapter, meta, more) {
- ...
- },
- compiler: function(tmpl) {
- ...
+ render: function(data, mojitType, tmpl, adapter, meta, more) {
+ ...
+ },
+ compiler: function(tmpl) {
+ ...
}
...
- an object that is assigned to ``Y.mojito.addons.viewEngines.{view_engine_name}``.
In our example, the constructor ``EjsAdapter`` is assigned to the namespace
``Y.namespace('mojito.addons.viewEngines').ejs`` or ``Y.mojito.addons.viewEngines.ejs``.
- .. code-block:: javascript
+ .. code-block:: javascript
- ...
+ ...
- function EjsAdapter(viewId) {
- this.viewId = viewId;
- }
- ...
- Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
+ function EjsAdapter(viewId) {
+ this.viewId = viewId;
+ }
+ ...
+ Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
.. _ve_addon_create-render_compile:
View
34 docs/dev_guide/intro/mojito_configuring.rst
@@ -434,16 +434,9 @@ Some of the properties of the ``config`` object used for configuring logging are
+----------------------+---------------+-------------------+-----------------------------------------------------------+
| Property | Data Type | Default Value | Description |
+======================+===============+===================+===========================================================+
-| ``buffer`` | boolean | false | Determines whether Mojito should buffer log |
-| | | | entries (``true``) or output each as they occur |
-| | | | (``false``). |
-+----------------------+---------------+-------------------+-----------------------------------------------------------+
| ``debug`` | boolean | true | Determines whether ``Y.log`` messages are written to the |
| | | | browser console. |
+----------------------+---------------+-------------------+-----------------------------------------------------------+
-| ``defaultLevel`` | string | "info" | Specifies the default log level to log entries. See |
-| | | | `Log Levels <../topics/mojito_logging.html#log-levels>`_. |
-+----------------------+---------------+-------------------+-----------------------------------------------------------+
| ``logExclude`` | object | none | Excludes the logging of the YUI module(s) specified. |
| | | | For example: ``logExclude: { "logModel": true }`` |
+----------------------+---------------+-------------------+-----------------------------------------------------------+
@@ -454,13 +447,7 @@ Some of the properties of the ``config`` object used for configuring logging are
| | | | log output. See |
| | | | `Log Levels <../topics/mojito_logging.html#log-levels>`_. |
+----------------------+---------------+-------------------+-----------------------------------------------------------+
-| ``maxBufferSize`` | number | 1024 | If ``buffer`` is set to ``true``, specifies the |
-| | | | number of log entries to store before flushing to |
-| | | | output. |
-+----------------------+---------------+-------------------+-----------------------------------------------------------+
-| ``timestamp`` | boolean | true | Determines whether the timestamp is included in |
-| | | | the log output. |
-+----------------------+---------------+-------------------+-----------------------------------------------------------+
+
@@ -1182,7 +1169,7 @@ the action are specified in the ``"foo_default"`` object.
"call": "foo-1.index"
}
-In this code snippet from ``controller.js``, the `Url addon <../../api/classes/Url.common.html>`_
+In this code snippet from ``controller.js``, the `Url addon <../../api/classes/Url.common.html>`_
with the ``make`` method use the mojit instance and function specified in the
``routes.json`` above to create the URL ``/foo`` with the query string parameters
``?foo=bar``.
@@ -1202,9 +1189,9 @@ The ``index`` function above returns the following URL: ``http://localhost:8666/
Accessing Configurations from Mojits
====================================
-The controller, model, and binder can access mojit configurations from the ``init``
+The model, and binder can access mojit configurations from the ``init``
function. The controller and model are passed ``configuration`` objects. The controller
-can also access configuration from other functions through the ``actionContext`` object.
+can access configuration the ``actionContext`` object and the ``Config`` addon.
The ``init`` function in the binder instead of a configuration object is passed the
``mojitProxy`` object, which enables you to get the configurations.
@@ -1310,9 +1297,8 @@ configurations of ``application.json`` override those in ``defaults.json``.
Controller
##########
-In the controller, the mojit-level configurations are passed to the ``init`` function. In
-other controller functions, you can access mojit-level configurations from the
-``actionContext`` object using the `Config addon <../../api/classes/Config.common.html>`_.
+Controllers can access mojit-level configurations from the ``actionContext`` object
+using the `Config addon <../../api/classes/Config.common.html>`_.
Use ``ac.config.get`` to access configuration values from ``application.json`` and
``defaults.json`` and ``ac.config.getDefinition`` to access definition values from
``definition.json``.
@@ -1323,10 +1309,10 @@ Use ``ac.config.get`` to access configuration values from ``application.json`` a
Model
#####
-The ``init`` function in the model is also passed the mojit-level configurations. If other
-model functions need the configurations, you need to save the configurations to the
-``this`` reference because no ``actionContext`` object is passed to the model, so your
-model does not have access to the ``Config`` addon.
+The ``init`` function in the model is also passed the mojit-level configurations.
+If other model functions need the configurations, you need to save the
+configurations to the ``this`` reference because no ``actionContext`` object is
+passed to the model, so your model does not have access to the ``Config`` addon.
.. _access_mojit-binder:
View
3 docs/dev_guide/intro/mojito_mojits.rst
@@ -13,7 +13,7 @@ implementation details, see the following:
- `Mojit Configuration <mojito_configuring.html#mojit-configuration>`_
- `Mojits <mojito_apps.html#mojits>`_ in the `Mojito Applications <mojito_apps.html>`_
- chapter
+ chapter
- `MVC in Mojito <mojito_mvc.html>`_
- `Mojito API Documentation <../../api>`_
@@ -176,6 +176,7 @@ and has the following characteristics:
- versioned and immutable for a given version.
Metadata can be packaged as a unit (e.g., as a zip file) for:
+
- configuration schema
- data requirements
- mojit dependencies
View
8 docs/dev_guide/intro/mojito_mvc.rst
@@ -420,7 +420,7 @@ For example, if you wanted to use the ``photo_search`` function in the model for
``flickr`` mojit, you would use the following: ``ac.models.get('flickr').photo_search(args, callback);``
The ``controller.server.js`` below shows a simple example of calling
-``get_data`` from the model of the ``simple`` mojit.
+``get_data`` from the model ``simpleModel``.
.. code-block:: javascript
@@ -455,8 +455,10 @@ The controller also uses the ActionContext object to send data to the view.
Calling the ``done`` method from the ActionContext object, you can send literal
strings or objects, with the latter being interpolated in template tags that are
rendered by the appropriate view engine. The ``done`` method should only be
-called once. If neither ``done`` nor ``error`` is called, your application will
-hang waiting for output.
+called once. If neither ``done`` nor ``error`` is called within 60 seconds, Mojito
+will log a warning and invoke ``error`` with a Timeout error.
+You can change the default timeout value of 60000ms (60 seconds) by setting the
+``actionTimeout`` property of your application configuration.
In the example ``controller.server.js`` below, the ``index`` function sends the ``user``
object to the ``index`` template.
View
4 docs/dev_guide/intro/mojito_static_resources.rst
@@ -11,9 +11,7 @@ URL that contains the following three components:
application, or the mojit depending on the level of the resource.
- **relative path** - the path relative to the source path.
-The URL of the static URL has the following syntax:
-
-``/static/{source_path}/{relative_path}``
+The URL of the static URL has the following syntax: ``/static/{source_path}/{relative_path}``
.. _static_resources-prefix:
View
38 docs/dev_guide/topics/mojito_extensions.rst
@@ -461,7 +461,7 @@ Mojito framework and the rendering engine.
In the following sections, we will be discussing how to create a view engine
addon that relies on a rendering engine, not how to write code that renders
- templates.
+templates.
.. _ve_overview-term:
@@ -571,42 +571,42 @@ The view engine addon must have the following:
- a ``YUI.add`` statement to register the addon. For example:
- .. code-block:: javascript
+ .. code-block:: javascript
- YUI.add('addons-viewengine-hb', function(Y, NAME) {
+ YUI.add('addons-viewengine-hb', function(Y, NAME) {
- // The addon name 'addons-viewengine-hb' is registered by YUI.add
+ // The addon name 'addons-viewengine-hb' is registered by YUI.add
- }, '0.1.0', {requires: []});
+ }, '0.1.0', {requires: []});
- an object that is assigned to ``Y.mojito.addons.viewEngines.{view_engine_name}``
as seen below:
- .. code-block:: javascript
+ .. code-block:: javascript
- ...
+ ...
- function EjsAdapter(viewId) {
- this.viewId = viewId;
- }
- ...
- Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
+ function EjsAdapter(viewId) {
+ this.viewId = viewId;
+ }
+ ...
+ Y.namespace('mojito.addons.viewEngines').ejs = EjsAdapter;
- a prototype of the object has the following two methods ``render`` and ``compiler``
as shown below:
- .. code-block:: javascript
+ .. code-block:: javascript
- ...
+ ...
- EjsAdapter.prototype = {
+ EjsAdapter.prototype = {
- render: function(data, mojitType, tmpl, adapter, meta, more) {
+ render: function(data, mojitType, tmpl, adapter, meta, more) {
...
- },
- compiler: function(tmpl) {
+ },
+ compiler: function(tmpl) {
...
- }
+ }
...
View
66 docs/dev_guide/topics/mojito_logging.rst
@@ -36,12 +36,6 @@ Log Defaults
The server and client log settings have the following default values:
- ``logLevel:`` ``DEBUG`` - log level filter.
-- ``yui:`` ``true`` - determines whether YUI library logs are displayed.
-- ``buffer:`` ``false`` - determines whether logs are buffered.
-- ``maxBufferSize: 1024`` - the number of logs the buffer holds before auto-flushing.
-- ``timestamp: true`` - log statements are given a timestamp if value is true.
-- ``defaultLevel: 'info'`` - if ``Y.log`` is called without a log level, this is the
- default.
.. _mojito_logging-config:
@@ -61,7 +55,6 @@ overrides the defaults for ``logLevel`` and ``buffer``.
"yui": {
"config": {
"level": "error",
- "buffer": true
}
},
...
@@ -91,66 +84,7 @@ context with the log configuration shown below:
}
]
-.. _mojito_logging-buffering:
-Log Buffering
-=============
-
-To avoid performance issues caused by logging, you can enable buffering, which will
-configure Mojito to cache all logs in memory. You can force Mojito to flush the logs with
-the ``Y.log`` function or setting the maximum buffer size. The following sections show you
-how to enable buffering and force Mojito to flush the cached logs.
-
-.. _logging_buffering-enable:
-
-Enable Buffering
-----------------
-
-To configure Mojito to buffer your logs, set the ``buffer`` property to ``true`` in the
-``yui.config`` object as shown in the example ``application.json`` below.
-
-.. code-block:: javascript
-
- [
- {
- "settings": [ "master" ],
- "yui": {
- "config": {
- "buffer": true
- }
- },
- ...
- }
- ]
-
-.. _logging_buffering-flush:
-
-Flush Cached Logs
------------------
-
-Mojito provides you with two ways to forcefully flush cached logs. When you have buffering
-enabled, you can force Mojito to flush the cached logs with ``Y.log(({flush: true})``.
-You can also set the maximum buffer size, so that Mojito will flush cached logs after the
-cache has reached the maximum buffer size.
-
-In the example ``application.json`` below, the maximum buffer size is set to be 4096 bytes.
-Once the log cache reaches this size, the logs are then flushed. The default size of the
-log cache is 1024 bytes.
-
-.. code-block:: javascript
-
- [
- {
- "settings": [ "master" ],
- "yui": {
- "config": {
- "buffer": true,
- "maxBufferSize": 4096
- }
- },
- ...
- }
- ]
.. _mojito_logging-custom:
View
2 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
@@ -376,7 +376,7 @@ Adapter Functions
The functions ``ac.done``, ``ac.flush``, and ``ac.error`` defined in the ``adapter``
object are actually implemented by the Mojito framework. For example, before
``adapter.done`` is executed, Mojito runs the ``done`` function defined in
-`output-adapter.common.js <https://github.com/yahoo/mojito/blob/develop/lib/app/addons/ac/output-adapter.common.js>`_,
+`action-context.common.js <https://github.com/yahoo/mojito/blob/develop/lib/app/autoload/action-context.common.js>`_,
which collects metadata and configuration.
.. _dyn_dispatch-controller:
View
4 examples/input/cookies/mojits/ClientCookie/controller.common.js
@@ -20,10 +20,6 @@ YUI.add('ClientCookie', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
7 examples/newsboxes/application.json
@@ -2,20 +2,13 @@
"settings": ["master"],
"appPort": 8000,
- "staticHandling": {
- "useRollups": true
- },
"builds": {
"html5app": {
"attachManifest": true,
"forceRelativePaths": true,
"urls": ["/read.html"]
}
},
- "log": {
- "client": { "level": "warn", "yui": true },
- "server": { "level": "info", "yui": true }
- },
"cacheViewTemplates": false,
"specs": {
View
19 examples/performance/string/application.json
@@ -1,14 +1,9 @@
[{
"settings": [ "master" ],
-
- "log": {
- "client": {
- "level": "none",
- "yui": false
- },
- "server": {
- "level": "none",
- "yui": false
- }
- }
-}]
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "error"
+ }
+ }
+}]
View
4 examples/sandbox/bindercomm/mojits/BlueChild/controller.server.js
@@ -20,10 +20,6 @@ YUI.add('BlueChild', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
4 examples/sandbox/bindercomm/mojits/Parent/controller.server.js
@@ -20,10 +20,6 @@ YUI.add('Parent', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
'index': function(ac) {
ac.done();
},
View
5 examples/sandbox/bindercomm/mojits/RedChild/controller.server.js
@@ -20,18 +20,13 @@ YUI.add('RedChild', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
* @param ac {Object} The action context that provides access
* to the Mojito API.
*/
index: function(ac) {
- Y.log(this.config);
ac.done({id: ac.config.get('id')});
}
View
9 examples/sandbox/binderrender/application.json
@@ -2,15 +2,6 @@
{
"settings": [ "master" ],
- "log": {
- "client": { "level": "warn", "yui": false },
- "server": { "level": "warn", "yui": false }
- },
-
- "staticHandling": {
- "useRollups": true
- },
-
"specs": {
"home": {
"type": "HTMLFrameMojit",
View
11 examples/sandbox/bindertime/application.json
@@ -4,17 +4,6 @@
"allowQueryStringRouting": true,
- "log": {
- "server": {
- "level": "debug",
- "yui": true
- },
- "client": {
- "level": "mojito",
- "yui": true
- }
- },
-
"specs": {
"frame": {
"type": "HTMLFrameMojit",
View
4 examples/sandbox/bindertime/mojits/Layout/controller.common.js
@@ -20,10 +20,6 @@ YUI.add('Layout', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
4 examples/sandbox/bindertime/mojits/Loader/controller.common.js
@@ -20,10 +20,6 @@ YUI.add('Loader', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
6 examples/sandbox/controller-state/application.json
@@ -2,12 +2,6 @@
{
"settings": [ "master" ],
- "log": {
- "server": {
- "level": "debug"
- }
- },
-
"specs": {
"frame": {
View
4 examples/sandbox/controller-state/mojits/Parent/controller.common.js
@@ -20,10 +20,6 @@ YUI.add('Parent', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
14 examples/sandbox/controller-state/mojits/Stateful/controller.common.js
@@ -6,15 +6,12 @@
YUI.add('Stateful', function(Y, NAME) {
- Y.namespace('mojito.controllers')[NAME] = {
+ var time = new Date().getTime();
- init: function(config) {
- this.config = config;
- this.time = new Date().getTime();
- },
+ Y.namespace('mojito.controllers')[NAME] = {
index: function(ac) {
- ac.done({id: this.config.id});
+ ac.done({id: ac.config.get('id')});
},
pitch: function(ac) {
@@ -26,19 +23,18 @@ YUI.add('Stateful', function(Y, NAME) {
'catch': function(ac) {
var self = this;
this.logit('catch');
-// DOING
ac.models.get('Stateful').getData(function(err, data) {
ac.done({
ball: self.ball,
- time: self.time,
+ time: time,
model: data.modelId
}, 'json');
});
},
logit: function(msg) {
- Y.log(msg + this.time, 'warn', NAME);
+ Y.log(msg + time, 'warn', NAME);
}
};
View
4 examples/sandbox/metabubble/mojits/Child/controller.common.js
@@ -8,10 +8,6 @@ YUI.add('Child', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
index: function(ac) {
var color = ac.config.get('color');
// store some analytics stuff
View
4 examples/sandbox/metabubble/mojits/Parent/controller.common.js
@@ -8,10 +8,6 @@ YUI.add('Parent', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
index: function(ac) {
ac.analytics.retrieve(function(analytics) {
View
4 examples/sandbox/server_side/mojits/Layout/controller.server.js
@@ -20,10 +20,6 @@ YUI.add('Layout', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
4 examples/sandbox/server_side/mojits/MyServer/controller.server.js
@@ -20,10 +20,6 @@ YUI.add('MyServer', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
View
4 examples/sandbox/strangeloop/application.json
@@ -2,10 +2,6 @@
{
"settings": [ "master" ],
- "staticHandling": {
- "useRollups": true
- },
-
"specs": {
"frame": {
"type": "HTMLFrameMojit",
View
6 examples/sandbox/view_refresh/application.json
@@ -1,12 +1,6 @@
[
{
"settings": [ "master" ],
- "log": {
- "client": {
- "level": "debug",
- "yui": false
- }
- },
"specs": {
"frame": {
"type": "HTMLFrameMojit",
View
4 examples/sandbox/yuiconf/application.json
@@ -2,10 +2,6 @@
{
"settings": [ "master" ],
- "staticHandling": {
- "useRollups": true
- },
-
"specs": {
"frame": {
"type": "HTMLFrameMojit",
View
382 lib/app/addons/ac/output-adapter.common.js
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-
-/*jslint anon:true, sloppy:true, nomen:true*/
-/*global YUI*/
-
-
-/**
- * @module ActionContextAddon
- */
-YUI.add('mojito-output-adapter-addon', function(Y, NAME) {
-
- return;
-
-// var CHARSET = 'charset=utf-8',
-// // the functions this core addon is going to attach to the
-// // ActionContext
-// flush,
-// done,
-// error,
-
-// // serializer container
-// serializer,
-// // private functions
-// serialize_xml,
-// serialize_json,
-// sanitizeConfigCopy,
-// sanitizeChildren,
-// attachChildViewIdsToMetaChildren,
-// CACHE = { renderers: { } };
-
-// /* see action-context.common.js for docs */
-// flush = function(data, meta) {
-// // NOTE: 'this' is the ActionContext instance
-// return this.done(data, meta, true);
-// };
-
-
-// /* see action-context.common.js for docs */
-// done = function(data, meta, more) {
-
-// // NOTE: 'this' is the ActionContext instance
-// var callbackFunc = more ? 'flush' : 'done',
-// instance = this.command.instance,
-// config = instance.config || {},
-// context = this.command.context || {},
-// adapter = this._adapter,
-// action = this.command.action,
-// mojitView,
-// renderer = null,
-// contentType,
-// contentPath,
-// appConfig = this.app.config,
-// viewEngineOptions,
-// perf = Y.mojito.perf.timeline('mojito', 'ac.done',
-// 'time to execute ac.done process', this.command);
-
-// if (Y.Lang.isString(meta)) {
-// // If the meta string is a serializer set it
-// if (serializer[meta]) {
-// meta = {
-// serialize: meta
-// };
-// } else {// Otherwise we think it is a template name
-// meta = {
-// view: {name: meta}
-// };
-// }
-// }
-
-// meta = meta || {};
-// meta.assets = meta.assets || {};
-// meta.assets.bottom = meta.assets.bottom || {};
-// meta.assets.bottom.js = meta.assets.bottom.js || [];
-// meta.http = meta.http || {};
-// meta.http.code = meta.http.code || 200;
-// meta.http.headers = meta.http.headers || {};
-// meta.view = meta.view || {};
-// viewEngineOptions = appConfig.viewEngine || {};
-
-// // Cache all tempates by default
-// meta.view.cacheTemplates = true;
-
-// if (appConfig.cacheViewTemplates) {
-// meta.view.cacheTemplates = appConfig.cacheViewTemplates || false;
-// }
-
-// // Check to see we need to serialize the data
-// if (meta.serialize && serializer[meta.serialize]) {
-// // Warning: this metod can change the "meta" object
-// data = serializer[meta.serialize].apply(this, [data, meta]);
-// // Once we are done remove the "serialize" option so others don't
-// // use it by mistake
-// delete meta.serialize;
-// }
-
-// // We want to know the view name, id, and binder used later so make sure
-// // "meta" is up-to-date
-// meta.view.name = meta.view.name || action;
-// // TODO: Use a different binder
-// meta.view.binder = meta.view.binder || meta.view.name;
-// mojitView = instance.views[meta.view.name];
-// if (!meta.view.id) {
-// meta.view.id = Y.guid();
-// //DEBUGGING: meta.view.id += '-viewId-' +
-// // this.command.instance.type + '-' + this.command.action;
-// }
-
-// // If we are given "meta.view['content-path']" use it over what we got
-// // from "instance.views"
-// if (mojitView && meta.view['content-path']) {
-// mojitView['content-path'] = meta.view['content-path'];
-// }
-
-// // If we are given "meta.view['engine']" use it over what we got from
-// // "instance.views"
-// if (mojitView && meta.view.engine) {
-// mojitView.engine = meta.view.engine;
-// }
-
-// meta.assets = Y.mojito.util.metaMerge(meta.assets, config.assets || {});
-// // Here we ask each "thing" attached to the AC if it wants to add view
-// // "meta"
-// Y.Object.each(this, function(item) {
-// if (item && Y.Lang.isFunction(item.mergeMetaInto)) {
-// item.mergeMetaInto(meta);
-// }
-// });
-
-// contentType = meta.http.headers['content-type'];
-
-// attachChildViewIdsToMetaChildren(meta.children, meta.binders);
-
-// if (!meta.binders) {
-// meta.binders = {};
-// }
-
-// // Don't clobber an existing meta.binders[meta.view.id] entry
-// if (!meta.binders[meta.view.id]) {
-// meta.binders[meta.view.id] = {
-// base: instance.base,
-// action: action,
-// config: sanitizeConfigCopy(instance.config),
-// type: instance.type,
-// viewId: meta.view.id,
-// guid: instance.instanceId, // DEPRECATED, use instanceId
-// instanceId: instance.instanceId,
-// // We don't use the actual config's children object, because
-// // that might not have been what was actually dispatched. We get
-// // the actual children config that was dispatched through the
-// // meta object.
-// children: sanitizeChildren(meta.children)
-// };
-// }
-
-// /*
-// * Here we provide an easy way to return a string
-// * data == 'a string of chars'
-// */
-// if (Y.Lang.isString(data)) {
-// // if the user didn't provided a content type, we'll make it plain
-// // text
-// if (!contentType) {
-// meta.http.headers['content-type'] = ['text/plain; ' + CHARSET];
-// }
-// //Y.log('pushing to native adapter', 'info', NAME);
-// adapter[callbackFunc](data, meta);
-
-// perf.done(); // closing the 'ac.done' timeline
-
-// return;
-// }
-
-// // there may not be a view if this is running on the client
-// if (mojitView) {
-
-// data = data || {}; // default null data to empty view template
-
-// // Get the YUI Module name of the Binder if we can.
-// if (meta.binders[meta.view.id]) {
-// meta.binders[meta.view.id].name = mojitView['binder-module'];
-// meta.binders[meta.view.id].needs =
-// mojitView['binder-yui-sorted'];
-// }
-
-// if (!contentType) {
-// meta.http.headers['content-type'] = ['text/html; ' + CHARSET];
-// }
-
-// data.mojit_guid = instance.instanceId;
-// data.mojit_view_id = meta.view.id;
-// data.mojit_assets = this.command.instance.assetsRoot;
-
-// // Use engine to compile template view
-// // Y.log('Rendering "' + meta.view.name + '" view for "' +
-// // (instance.id || '@' + instance.type) + '"', 'info', NAME);
-
-// contentPath = mojitView['content-path'];
-// // this is mainly used by html5app
-// if (appConfig.pathToRoot) {
-// contentPath = appConfig.pathToRoot + contentPath;
-// }
-
-// // optimize for server only
-// if (typeof context.runtime !== undefined && 'server' === context.runtime) {
-// renderer = CACHE.renderers[mojitView.engine];
-// if (!renderer) {
-// // viewEngineOptions are app level
-// CACHE.renderers[mojitView.engine] = renderer =
-// new (Y.mojito.addons.viewEngines[mojitView.engine])('', viewEngineOptions);
-// }
-// renderer.viewId = meta.view.id;
-// renderer.render(data, instance.type, contentPath, adapter, meta, more);
-// } else {
-// renderer = new Y.mojito.ViewRenderer(
-// mojitView.engine,
-// meta.view.id,
-// viewEngineOptions
-// );
-// renderer.render(data, instance.type, contentPath, adapter, meta, more);
-// }
-
-// } else {
-
-// if (Y.Lang.isObject(data)) {
-// throw new Error("Missing view template: '" + meta.view.name +
-// "'");
-// }
-// adapter[callbackFunc](data, meta);
-// }
-
-// perf.done(); // closing the 'ac.done' timeline
-
-// Y.mojito.perf.mark('mojito', 'action:stop', 'after the action', this.command);
-// };
-
-
-// /* see action-context.common.js for docs */
-// error = function(err) {
-// // NOTE: 'this' is the ActionContext instance
-// this._adapter.error(err);
-// };
-
-
-// sanitizeConfigCopy = function(cfg) {
-// var copy;
-// if (!Y.Lang.isObject(cfg)) {
-// return cfg;
-// }
-// copy = Y.mojito.util.copy(cfg);
-// copy.children = sanitizeChildren(copy.children);
-// return copy;
-// };
-
-
-// sanitizeChildren = function(children) {
-// if (!Y.Lang.isObject(children)) {
-// return children;
-// }
-// Y.Object.each(children, function(v, k) {
-// // We don't want child params to be included within a mojit's
-// // configuration, because it can leak implemenation details out to
-// // other execution environments. For example, the client runtime
-// // does not need to have the parameters of the mojits that were used
-// // to construct the initial client DOM.
-// delete children[k].params;
-// });
-// return children;
-// };
-
-
-// attachChildViewIdsToMetaChildren = function(children, binders) {
-// if (!children) {
-// return;
-// }
-// Y.Object.each(binders, function(binderData, viewId) {
-// Y.Object.each(children, function(childData) {
-// if (binderData.instanceId === childData.instanceId) {
-// childData.viewId = viewId;
-// }
-// });
-// });
-// };
-
-
-// /*
-// * @method serialize_json
-// * @private
-// * @param {object} data
-// * @param {object} meta
-// * @return {string}
-// */
-// serialize_json = function(data, meta) {
-// meta.http.headers['content-type'] = ['application/json; ' + CHARSET];
-
-// try {
-// return Y.JSON.stringify(data);
-// } catch (err) {
-// throw new Error('Expected JSON data, but there was a parse error' +
-// ' on the string: \"' + data);
-// }
-
-// };
-
-
-// /*
-// * @method serialize_xml
-// * @private
-// * @param {object} data
-// * @param {object} meta
-// * @return {string}
-// */
-// serialize_xml = function(data, meta) {
-// // A dirty XML function I found on the interwebs
-// function simpleXml(js, wraptag) {
-// if (js instanceof Object) {
-// return simpleXml(Y.Object.keys(js).map(function(key) {
-// return simpleXml(js[key], key);
-// }).join('\n'), wraptag);
-// }
-
-// return ((wraptag) ? '<' + wraptag + '>' : '') + js +
-// ((wraptag) ? '</' + wraptag + '>' : ''
-// );
-// }
-
-// meta.http.headers['content-type'] = ['application/xml; ' + CHARSET];
-// if (Y.Lang.isObject) {
-// try {
-// return simpleXml(data, 'xml');
-// } catch (err) {
-// throw new Error('Expected XML data, but there was a parse' +
-// ' error on the string: \"' + err.message);
-// }
-// }
-
-// return '';
-// };
-
-
-// serializer = {
-// json: serialize_json,
-// xml: serialize_xml
-// };
-
-
-// /**
-// * <strong>Access point:</strong> <em>ac.*</em>
-// * The main API point for developers in a Controller. This addon provides
-// * the core functions
-// * of the ActionContext: <em>flush</em>, <em>done</em>, and <em>error</em>.
-// * @class OutputAdapter.common
-// * @private
-// */
-// function Addon(command, adapter, ac) {
-// /*
-// * This plugin doesn't act the same way as the others. It attaches its
-// * functions directly onto the ActionContext. Each functions is assumed
-// * that 'this' will be the actual instance of ActionContext, not the
-// * object this constructor is creating.
-// */
-// ac.flush = flush;
-// ac.done = done;
-// ac.error = error;
-// }
-
-// Addon.prototype = {
-// namespace: 'core'
-// };
-
-// Y.namespace('mojito.addons.ac').core = Addon;
-
-}, '0.1.0', {requires: [
- 'json-stringify',
- 'event-custom-base',
- 'mojito-view-renderer',
- 'mojito-util'
-]});
View
224 lib/app/autoload/controller-context.common.js
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-
-// << RIC + This is not used anymore
-
-/*jslint anon:true, sloppy:true, nomen:true*/
-/*global YUI*/
-
-
-YUI.add('mojito-controller-context', function(Y, NAME) {
-
- return;
-
-// /**
-// * @class ControllerContext
-// * @constructor
-// * @param {Object} opts contains instance, Y, store, appShareYUIInstance,
-// * dispatch
-// */
-// function ControllerContext(opts) {
-// this.instance = opts.instance;
-// this.dispatch = opts.dispatch;
-// this.store = opts.store;
-// this.Y = opts.Y;
-// this.shareYUIInstance = false;
-// Y.mojito.util.shouldShareYUIInstance(opts.appShareYUIInstance, this.instance);
-// this.init();
-// }
-
-
-// ControllerContext.prototype = {
-
-// init: function() {
-
-// var c = this.Y.mojito.controllers[this.instance['controller-module']],
-// controller;
-
-// controller = this.controller = Y.mojito.util.heir(c);
-
-// if (Y.Lang.isFunction(controller.init)) {
-// controller.init(this.instance.config);
-// }
-
-// return; // << RIC
-
-// /*
-// var error,
-// // Not really an instance...more like constructor options...see
-// // controller.init() call below.
-// instance = this.instance,
-// controller,
-// shareYUIInstance = this.shareYUIInstance,
-
-// // do a shallow merge of app-level and mojit-level configs
-// // mojit config properties take precedence
-// configApp = this.store.getAppConfig({}).config,
-// configCombo = Y.merge(configApp, instance.config),
-
-// // Y.mojito.controller for legacy, multi-instance.
-// // Y.mojito.controllers for shared instance
-// c = this.Y.mojito.controller ||
-// this.Y.mojito.controllers[instance['controller-module']];
-
-// // If sharing YUI and controller clobbers, log an error.
-// if (shareYUIInstance && this.Y.mojito.controller) {
-// this.Y.log(instance['controller-module'] + ' mojit' +
-// ' clobbers Y.mojito.controller namespace. Please use' +
-// ' `Y.namespace(\'mojito.controllers\')[NAME]` when ' +
-// ' declaring controllers.', 'error', NAME);
-// }
-
-// if (!Y.Lang.isObject(c)) {
-// error = new Error('Mojit controller prototype is not an' +
-// ' object! (mojit id: \'' + instance.id + '\')');
-
-// error.code = 500;
-// throw error;
-// }
-
-// // we make a controller instance by using the heir() function, this
-// // gives us proper function scope within the controller actions
-// controller = this.controller = Y.mojito.util.heir(c);
-
-// if (Y.Lang.isFunction(controller.init)) {
-// // Use the instance data which isn't really an instance to
-// // provide construction parameters for the controller init().
-// controller.init(configCombo);
-// }
-
-// // mix in any (new) actions (the actions namespace here would be
-// // populated by the resource store...but currently unused? Could
-// // this be replaced by light inheritance to the controllers here).
-// Y.Object.each(this.Y.mojito.actions, function(action, actionName) {
-// this.Y.log('mixing action \'' + actionName +
-// '\' into controller...', 'debug', NAME);
-// controller[actionName] = function() {
-// action.apply(controller, arguments);
-// };
-// });
-
-// // stash the models this controller has available to be later
-// // attached to the ActionContext
-// this.models = {};
-
-// Y.Object.each(this.Y.mojito.models, function(model, modelName) {
-
-// if (!shareYUIInstance || (instance.models &&
-// instance.models[modelName])) {
-
-// // TODO: Why? There's no particular reason to inherit here.
-// var modelInstance = Y.mojito.util.heir(model);
-
-// if (Y.Lang.isFunction(modelInstance.init)) {
-// // NOTE that we use the same config here that we use to
-// // config the controller
-// modelInstance.init(configCombo);
-// }
-// this.models[modelName] = modelInstance;
-// }
-// }, this);
-// */
-// },
-
-
-// invoke: function(command, adapter) {
-
-// var ac;
-
-// try {
-// ac = new this.Y.mojito.ActionContext({
-// command: command,
-// controller: this.controller,
-// models: this.models,
-// dispatch: this.dispatch,
-// adapter: adapter,
-// store: this.store
-// });
-// } catch (err) {
-// console.log(err);
-// this.Y.log('WARNING!! Uncaught error from dispatch on' +
-// ' instance \'' + (command.instance.id || '@' + command.instance.type) +
-// '\'', 'error', NAME);
-// this.Y.log(err.message, 'error', NAME);
-// this.Y.log(err.stack, 'error', NAME);
-// }
-
-// return; // << RIC
-
-// /*
-// var instance = this.instance,
-// config = command.instance.config,
-// // this is the action that will be executed
-// action = command.action,
-// ac,
-// perfID,
-// perf;
-
-// // replace the non-expanded command instance with the proper
-// // instance, that was already expanded when the controller context
-// // was created
-
-// // TODO: This may not be necessary...we did this in dispatch().
-// // command.instance = instance;
-
-// // however! we want to use the most recent config, not the cached
-// // config, because that can change between action executions!
-// // command.instance.config = config;
-
-// // if there is no action, make 'index' the default
-// // TODO: This may not be necessary...we did this in dispatch().
-// if (!command.action) {
-// // use instance config for default action or 'index'
-// command.action = instance.action || 'index';
-// }
-
-// perfID = Y.mojito.perf.idFromCommand(command);
-// perf = Y.mojito.perf.timeline('mojito', 'ac:ctor',
-// 'create ac (which also invokes the action)', perfID);
-
-// try {
-// // Note: ac var is here to appease jslint.
-// ac = new this.Y.mojito.ActionContext({
-// command: command,
-// controller: this.controller,
-// models: this.models,
-// dispatch: this.dispatch,
-// adapter: adapter,
-// store: this.store
-// });
-
-// // TODO: uncomment once above issue is repaired.
-// // ac.invoke(command, adapter); // do it this way ;)
-// } catch (err) {
-// if (adapter.error) {
-// adapter.error(err);
-// } else {
-// this.Y.log('WARNING!! Uncaught error from dispatch on' +
-// ' instance \'' + (instance.id || '@' + instance.type) +
-// '\'', 'error', NAME);
-// this.Y.log(err.message, 'error', NAME);
-// this.Y.log(err.stack, 'error', NAME);
-// }
-// // TODO: should we be rethrowing the error here? We log but we
-// // don't ensure callers know...but then again dispatch() may
-// // need this level of isolation.
-// } finally {
-// perf.done();
-// }
-
-// this.Y.mojito.perf.mark('mojito', 'core_dispatch_end', 'invoked action', perfID);
-// */
-// }
-// };
-
-// Y.namespace('mojito').ControllerContext = ControllerContext;
-
-}, '0.1.0', {requires: [
- 'mojito-action-context',
- 'mojito-util'
-]});
View
4 lib/app/autoload/dispatch.client.js
@@ -149,6 +149,10 @@ YUI.add('mojito-dispatcher', function (Y, NAME) {
rpc: function (command, adapter) {
if (this.tunnel) {
+ // this prevents the server from trying to RPC itself
+ // FUTURE: might be a better place to do this
+ delete command.rpc;
+
Y.log('Dispatching instance "' + (command.instance.base || '@' +
command.instance.type) + '" through RPC tunnel.', 'info', NAME);
this.tunnel.rpc(command, adapter);
View
2 lib/app/autoload/json-stringify-hack.server.js
@@ -12,6 +12,8 @@ YUI.add('json-stringify-hack', function (Y) {
// http://yuilibrary.com/projects/yui3/ticket/2532759
// PR here:
// https://github.com/yui/yui3/pull/270
+ // GIST for verification:
+ // https://gist.github.com/4119541
Y.JSON.stringify = JSON.stringify;
}, '3.5.1-2', {requires: ['json-stringify']});
View
171 lib/app/autoload/loader.common.js
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-
-/*jslint anon:true, sloppy:true, nomen:true*/
-/*global YUI*/
-
-YUI.add('mojito-loader', function(Y, NAME) {
-
- return;
-
-// // IE has a limit of 2048-character long URLs.
-// var MAX_URL_LENGTH = 2000;
-
-// function Loader(appConfig, prefix) {
-// // Y.log('ctor()', 'mojito', NAME);
-// this.appConfig = appConfig;
-// this.prefix = prefix || ''; // optional
-// }
-
-
-// Loader.prototype = {
-
-// load: function(paths, cb) {
-// var self = this,
-// mod,
-// script,
-// scriptsToLoad = {},
-// loaded = 0;
-
-// paths = paths || {};
-// if (!Y.Object.size(paths)) {
-// cb();
-// return;
-// }
-
-// for (mod in paths) {
-// if (paths.hasOwnProperty(mod)) {
-// if (!YUI.Env.mods[mod]) {
-// script = paths[mod];
-// if (/\.js$/i.test(script)) {
-// if ('/' === script.charAt(0)) {
-// script = this.prefix + script;
-// }
-// scriptsToLoad[script] = true;
-// }
-// }
-// }
-// }
-// scriptsToLoad = Y.Object.keys(scriptsToLoad);
-// if (!scriptsToLoad.length) {
-// return cb();
-// }
-
-// Y.log('loading ' + scriptsToLoad.join(', '), 'mojito', NAME);
-
-// Y.Get.script(scriptsToLoad, {
-// async: true,
-
-// onSuccess: function() {
-// Y.log('SUCCESS', 'mojito', NAME);
-// cb();
-// },
-
-// onFailure: function() {
-// Y.log('FAILURE', 'warn', NAME);
-// var err = new Error('Failed to load URLs: ' +
-// scriptsToLoad.join(', '));
-// cb(err);
-// }
-// });
-// },
-
-
-// _createURLlist: function(base, list) {
-// var url, urls = [],
-// newPart, newLength;
-// if (!list.length) {
-// return [];
-// }
-// url = base + list.shift();
-// while (list.length) {
-// newPart = list.shift();
-// newLength = url.length + 1 + newPart.length;
-// if (newLength > MAX_URL_LENGTH) {
-// urls.push(url);
-// url = base + newPart;
-// } else {
-// url += '&' + newPart;
-// }
-// }
-// urls.push(url);
-// return urls;
-// },
-
-
-
-// // this also pulls in dependencies
-// createYuiLibComboUrl: function(modules, filter) {
-// var required = {},
-// comboJsParts = [],
-// comboCssParts = [],
-// loader,
-// filterDef,
-// filterDefSearchExp,
-// i,
-// name,
-// info,
-// filteredPath,
-// combo = { js: [], css: [] },
-// config = this.appConfig && this.appConfig.yui && this.appConfig.yui.config;
-
-// filter = filter || 'min';
-
-// loader = new Y.Loader((config || {}));
-// for (i = 0; i < modules.length; i += 1) {
-// name = modules[i];
-// required[name] = true;
-// }
-// loader.ignoreRegistered = true;
-// loader.calculate({required: required});
-
-// // workaround for a bug fixed in yui-3.5.0
-// Object.keys(loader.moduleInfo).forEach(function(module) {
-// var m = loader.moduleInfo[module];
-// YUI.Env._renderedMods[module] = m;
-// });
-
-// filterDef = loader.FILTER_DEFS[filter.toUpperCase()];
-// if (filterDef) {
-// filterDefSearchExp = new RegExp(filterDef.searchExp);
-// }
-
-// for (i = 0; i < loader.sorted.length; i += 1) {
-// name = loader.sorted[i];
-// if (('parallel' !== name) && (name.indexOf('nodejs') === -1)) {
-// info = loader.moduleInfo[name];
-// if (info) {
-// filteredPath = (filterDef) ?
-// info.path.replace(filterDefSearchExp,
-// filterDef.replaceStr) :
-// info.path;
-
-// if ('lang/datatype-date' === name) {
-// // this one is messed up
-// filteredPath = 'datatype/lang/datatype-date.js';
-// }
-
-// if ('js' === info.type) {
-// comboJsParts.push(loader.root + filteredPath);
-// } else if ('css' === info.type) {
-// comboCssParts.push(loader.root + filteredPath);
-// }
-// }
-// }
-// }
-// combo.js = this._createURLlist(loader.comboBase, comboJsParts);
-// combo.css = this._createURLlist(loader.comboBase, comboCssParts);
-// return combo;
-// }
-// };
-
-// Y.namespace('mojito').Loader = Loader;
-
-}, '0.1.0', {requires: [
- 'get',
- 'mojito'
-]});
View
217 lib/app/autoload/logger.common.js
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-
-/*jslint anon:true, sloppy:true, nomen:true*/
-/*global YUI*/
-
-
-YUI.add('mojito-logger', function(Y, NAME) {
-
- return;
-
-// // TODO: [Issue 70] Clean up the logger implementation.
-
-// var isYuiLog = /^yui/,
-// LOG_LEVEL = 'info',
-// logNothingAtAllEver = false,
-// defaults = {
-// writer: null, //assigned below
-// formatter: null, //assigned below
-// timestamp: true,
-// level: LOG_LEVEL,
-// defaultLevel: 'info',
-// yui: false,
-// buffer: false,
-// maxBufferSize: 1024,
-// order: [
-// 'DEBUG', 'MOJITO', 'INFO', 'WARN', 'ERROR', 'NONE'
-// ],
-// filter: {
-// DEBUG: true,
-// MOJITO: true,
-// INFO: true,
-// WARN: true,
-// ERROR: true,
-// NONE: true
-// }
-// };
-
-
-// defaults.writer = function(data) {
-// var i = 0;
-// if (!console || !console.log) {
-// // not much to do if I can't console.log. Sorry, IE6
-// return;
-// }
-// if (Y.Lang.isArray(data)) {
-// // this is a flush of many logs
-// for (i = 0; i < data.length; i += 1) {
-// console.log(data[i]);
-// }
-// } else {
-// console.log.apply(console, arguments);
-// }
-// };
-
-
-// defaults.formatter = function(msg, lvl, source, timestamp, opts, id) {
-// var ts = opts.timestamp ? '(' + timestamp + ') ' : '',
-// code = '',
-// stack = '';
-
-// if (msg instanceof Error) {
-// if (msg.code) {
-// code = ' ' + msg.code;
-// }
-// if (msg.stack) {
-// stack = '\n' + msg.stack;
-// }
-// msg = 'Error' + code + ': ' + msg.message + stack;
-// } else if (Y.Lang.isObject(msg)) {
-// msg = Y.JSON.stringify(msg, null, 2);
-// }
-// source = source ? source + ': ' : '';
-// return '[' + lvl.toUpperCase() + '] ' + ts + source + msg;
-// };
-
-
-// function Logger(opts, id) {
-// var cnt = 0,
-// order,
-// lvl;
-
-// this._opts = Y.merge(defaults, opts);
-// this._buffer = [];
-
-// if (id) {
-// this._id = id;
-// }
-
-// order = this._opts.order || [];
-// lvl = this._opts.level.toLowerCase();
-
-// for (cnt = 0; cnt < order.length; cnt += 1) {
-// this._opts.filter[order[cnt]] = true;
-// }
-// cnt = 0;
-// while (cnt <= order.length) {
-// if (order[cnt] && order[cnt].toLowerCase() !== lvl) {
-// this._opts.filter[order[cnt]] = false;
-// } else {
-// break;
-// }
-// cnt += 1;
-// }
-
-// //Hmm... If the count is the same length as the order list we mean NONE
-// if (cnt === order.length) {
-// logNothingAtAllEver = true;
-// }
-
-// if (this._opts.filter.DEBUG) {
-// if (!YUI._mojito) {
-// YUI._mojito = {};
-// }
-// YUI._mojito.DEBUG = true;
-// }
-// }
-
-
-// Logger.prototype = {
-
-// log: function(msg, lvl, source) {
-
-// var level,
-// isYui,
-// baseLevel,
-// now;
-
-// if (logNothingAtAllEver) {
-// return;
-// }
-
-// now = new Date().getTime();
-
-// // flush-fast if msg is {flush: true}
-// if (Y.Lang.isObject(msg) && msg.flush === true) {
-// return this.flush();
-// }