Permalink
Browse files

Merge pull request #877 from add0n/develop-yaf

sync up
  • Loading branch information...
2 parents f44aa7d + 83966df commit 56df54ee0fc5bcd0d8595cabcbacafac75fb551b @isao isao committed Jan 4, 2013
Showing 502 changed files with 4,527 additions and 14,008 deletions.
View
@@ -9,15 +9,8 @@ future.
-Currently Deprecated
-====================
-
-
-### Deprecated but Available
-
-* (2012-08-14) Controllers that declare themselves using `Y.mojito.controller = {...}`
-should be changed to use `Y.namespace('mojito.controllers')[NAME] = {...}`. The previously
-used pattern will clobber the controllers if you are using `shareYUIInstance: true`.
+Deprecated but Available
+========================
* (2012-08-13) Files ending in `.mu.html` will eventually not be rendered
out-of-the-box by Mojito. All downstream projects should use the Handlebars
@@ -27,61 +20,209 @@ by default. To rename all views in your project, run the following in your proje
root folder:
`find . -name "*.mu.html" -exec sh -c 'mv "$1" "$(echo "$1" | sed s/mu.html\$/hb.html/)"' _ {} \;`
-* (2012-04-23) The `.guid` member of Mojito metadata (such as binder metadata)
-is going away. Often there's an associated member which more specifically
-expresses the intent of the unique ID (for example `.viewId` or `.instanceId`).
-* (2012-04-23) `ac.dispatch()` will be going away. (This already emits a
-warning.) Currently the best alternative is `ac._dispatch()`.
+Deprecated with Warnings
+========================
+
+* (2012-12-05) the `mojito compile` command will be removed in future releases, in favor of [Shaker](/yahoo/mojito-shaker).
+* (2012-04-23) `ac.dispatch()` will be going away.
+Currently the best alternative is `ac._dispatch()`.
+
+
+Removed
+=======
+
+### (0.5.0) Mojito `compile` command line tool no longer needs a `rollup` command
+
+Javascript file concatenation/combo'ing of mojito files is now built-in.
+
+### (0.5.0) Mojito No Longer Adds Common ActionContext Addons
+
+In the past, a subset of the addons provided by Mojito framework were attached on every `ActionContext` object (which are created per request, per mojit instance in the page).
+The specific list was `['mojito-config-addon', 'mojito-url-addon', 'mojito-assets-addon', 'mojito-cookie-addon', 'mojito-params-addon', 'mojito-composite-addon']`.
+This resulted in overhead for every mojit in the page.
+As part of 0.5.0, all requirements have to be specified in the controller definition. e.g:
+
+ YUI.add('Foo', function(Y, NAME) {
+
+ Y.namespace('mojito.controllers')[NAME] = {
+
+ index: function(ac) {
+ // ac.params.* is now available
+ }
+
+ };
+
+ }, '0.0.1', {requires: ['mojito', 'mojito-params-addon']});
+
+As of 0.5.0, no addon is attached unless it is required. The only public members of `ActionContent` object are `ac.done`, `ac.error`, and `ac.flush`.
+
+Recommendations to upgrade:
+
+* check every controller in your app, and check if it is using `ac.*`, and add the corresponding requirements.
+* the most common addons are: config, params, url, assets.
+
+
+
+### (0.5.0) Access to Models via a Property
+
+Models are no longer computed and attached to `ActionContext` by default.
+In other words, `ac.models.foo` is no longer a valid way to access a model.
+Computing and attaching models automatically, even when they were not really needed, added overhead during the page rendering process.
+Instead, we want Mojito to be more strict in defining and exposing structures automatically.
+
+In 0.5.0, if you need to use a model in a controller (defined at the mojit level, or at the application level), you need to:
+
+* require a new addon called `mojito-models-addon` in your controller.
+* require the module in your controller.
+* use `ac.models.get('foo')` to get a reference of the model.
+
+Here is an example:
+
+ YUI.add('DemoModelFoo', function(Y, NAME) {
+ Y.namespace('mojito.models')[NAME] = {
+ init: function(config) {
+ this.config = config;
+ },
+ getData: function(callback) {}
+ };
+ }, '0.0.1', {requires: []});
+
+ YUI.add('Foo', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function(ac) {
+ ac.models.get('DemoModelFoo').getData(function (data) {
+ // data from model available here
+ });
+ }
+ };
+
+ }, '0.0.1', {requires: ['mojito', 'mojito-models-addon', 'DemoModelFoo']});
+
+> Note: the model name doesn't have to match the yui module name for the model anymore.
+
+
+
+### (0.5.0) `init` Method in Controllers
+
+The `init` method on the controller is now deprecated and should be removed.
+In many cases, the `init` method was just storing a reference of the `config` parameter to use it later on.
+This is no longer available, and the `init` method will not be executed.
+
+If you need to access the mojit `config` in an actions, you should:
+
+* require `mojito-config-addon` in the controller.
+* use `ac.config.get()` to get the `config`
+
+> Note: do not try to store a reference of that config, as it is not safe, More details below.
+
+
+
+### (0.5.0) `ac.app.*`
+
+For performance reasons, to avoid computing app config per mojit instance, per request, when the majority of the time it is not needed, we completed the transition to `mojito-config-addon` add-on.
+This change affects `ac.app.*`, specifically `ac.app.config` which was commonly used to access the computed `application.json` configuration per `context`.
+If you need to access the application `config` in an action or another add-on, you should:
+
+* require `mojito-config-addon` in the controller.
+* use `ac.config.getAppConfig()` to get the former `ac.app.config`
+
+
+
+### (0.5.0) Controllers Can No Longer Run Forever
+
+Mojito now imposes a timeout on the dispatch of the action in the controllers.
+Starting with 0.5.0 there is a "reaper" which imposes a timeout.
+Actions must call `ac.done()` or `ac.error()` before the timer expires or the system will log a warning and invoke `ac.error()` with a timeout error.
+
+This can be configured by the `actionTimeout` setting in `application.json`.
+It contains the maximum number of milliseconds that a controller action is allowed to run before the action is timed out.
+The default value is `60000` (60 seconds).
+
+
+
+### (0.5.0) Mojit and AC Addon Naming Conventions
+
+Mojito is more restrictive in how you names mojits and add-ons. There are 4 new rules:
+
+* `addon` namespace should match the filename. E.g. `ac.foo` corresponds to `addons/ac/foo.common.js`.
+* The name of the mojit, which is the name of the folder, should match the language bundle, including the filename of the bundle and its definition. E.g. `Foo` mojit can have `lang/Foo_da-DK.js`, and the content should be `YUI.add('lang/Foo_da-DK', function (Y) { Y.Intl.add('Foo', 'da-DK', {}); });`
+* Controller YUI module name should be same as directory.
+* YUI modules need to have unique names, regardless of selector.
+
+
+
+### (0.5.0) `log` Config in `application.json`
+
+In previous versions, the console log was separated for client and server, and between Mojito and YUI.
+We decided to leverage the YUI Logger, and unify this setting under a single configuration, actually the YUI configuration in `application.json`:
+ "log": {
+ "client": {
+ "level": "error",
+ "yui": false
+ },
+ "server": {
+ "level": "error",
+ "yui": false
+ }
+ }
-### Deprecated with Warnings
-nothing for mojito 0.3
+is now:
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "error"
+ }
+ }
-### Removed
-nothing for mojito 0.3
+and we recommend this setting for production:
+ "yui": {
+ "config": {
+ "debug": false,
+ "logLevel": "none"
+ }
+ }
+To customize this for client or server, you can use the runtime context.
+Also, you can now use `logExclude` and `logInclude`.
+More information at http://yuilibrary.com/yui/docs/api/classes/config.html.
-Deprecation Process
-===================
-A feature will move through the following phases, at a well-defined pace.
-### "Deprecated but Available" Phase
+### (0.5.0) Other Settings in `application.json`
-* The documentation is updated to mark the feature as "deprecated".
-* The feature will be in this phase until the end of the quarter year.
-(It's possible that a feature won't spend much time in this phase, if it is
-deprecated near the end of the quarter.)
+The following are gone:
+* `embedJsFilesInHtmlFrame`
+* `shareYUIInstance`
+* in the `yui` section:
+ * `base`
+ * `dependencyCalculations`
+ * `extraModules`
+ * `loader`
+ * `url`
+ * `urlContains`
-### "Deprecated with Warning" Phase
-* The feature is removed from the documentation.
-* Mojito emits a warning (if possible) if the feature is used.
-* The feature will spend a full quarter in this phase.
+### (0.5.0) `mojito test` No Longer Tests the Framework
-### "Removed" Phase
+In the past, `mojito test` without any other parameter was running all unit tests for mojito framework, and this is no longer the case.
+We moved all the tests to `arrow`, more details here: https://github.com/yahoo/mojito/tree/develop/tests
-* The feature (and warning) is removed from Mojito.
+You can continue using `mojito test app path/to/app` and `mojito test mojit path/to/mojit`, and the behavior is still the same.
+> Note: this change is only relevant for contributors.
-### Example
-* On 2012-04-19 (Q2), Mojito deprecates the "foo" feature by saying so in the
-documentation. This event is also mentioned in an email and/or blog post for
-the next release. It's also added to this DEPRECATIONS.md document.
-* On the next release after 2012-06-30 (end of Q2), Mojito removes
-documentation for feature "foo" and adds a warning if someone tries to use
-feature "foo". It is still documented in this DEPRECATIONS.md document.
+### (0.5.0) `.guid`
+The `.guid` member of Mojito metadata (such as binder metadata) is now gone.
+Often there's an associated member which more specifically expresses the intent of the unique ID (for example `.viewId` or `.instanceId`).
-* On the next releaes after 2012-09-30 (end of Q3), Mojito removes feature
-"foo" (and the associated warnings). It is mentioned as "removed" in this
-DEPRECATIONS.md document.
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
+Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
View
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
+ * Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
@@ -35,7 +35,7 @@ Log Configuration
Logging is configured in the ``application.json`` file with the ``yui.config``
object. With the ``yui.config`` object, you can configure the log levels and some
elements of the output for logs. See the
-`config object <intro/mojito_configuring.html#yui_config>`_ for the
+`config object <../intro/mojito_configuring.html#yui_config>`_ for the
configurations that can be set.
@@ -19,7 +19,7 @@ page views and browser sessions.
The following topics will be covered:
-- adding YUI modules to the ``autoload`` directory
+- adding YUI modules to the ``yui_modules`` directory
- accessing YUI modules from a mojit
.. _code_exs-incl_yui_mods-notes:
@@ -38,9 +38,9 @@ Location
########
To add YUI modules that all your mojits can access, place the modules in the
-``autoload`` directory under the application directory. For example, YUI
+``yui_modules`` directory under the application directory. For example, YUI
modules in the ``hello_world`` application would be placed in
-``hello_world/autoload``.
+``hello_world/yui_modules``.
.. _yui_mod_impl_add-naming:
@@ -70,15 +70,15 @@ the module identified by the string ``'gallery-storage-lite'``.
YUI.add('gallery-storage-lite', function (Y) {
...
- }, '1.0.0', { requires: ['event-base', 'event-custom', 'event-custom-complex', 'json']});
+ }, '1.0.0', { requires: [ 'event-base', 'event-custom', 'event-custom-complex', 'json']});
.. _yui_mod_impl-using:
Using a YUI Module from Mojits
------------------------------
-After registered YUI modules have been added to the ``autoload`` directory, you
+After registered YUI modules have been added to the ``yui_modules`` directory, you
can load them into your mojit code by listing them as dependencies in the
``requires`` array. In the binder ``index.js`` below, you can see that the
Storage Lite module that we created and registered in :ref:`registering_module`
@@ -95,7 +95,7 @@ is listed as a dependency in the ``requires`` array.
...
}
};
- // See autoload/storage-lite.client.js
+ // See yui_modules/storage-lite.client.js
}, '0.0.1', {requires: [ 'gallery-storage-lite' ]});
In the ``bind`` method, ``Y.StorageLite.getItem`` and ``Y.StorageLite.setItem``
@@ -177,12 +177,12 @@ To set up and run ``yui_module``:
}
]
-#. Create the autoload directory for storing the Storage Lite module.
+#. Create the ``yui_modules`` directory for storing the Storage Lite module.
- ``$ mkdir autoload``
-#. Get the Storage Lite module and place it in the ``autoload`` directory.
+ ``$ mkdir yui_modules``
+#. Get the Storage Lite module and place it in the ``yui_modules`` directory.
- ``$ wget -O autoload/storage-lite.client.js https://raw.github.com/rgrove/storage-lite/master/src/storage-lite.js --no-check-certificate``
+ ``$ wget -O yui_modules/storage-lite.client.js https://raw.github.com/rgrove/storage-lite/master/src/storage-lite.js --no-check-certificate``
#. Change to ``mojits/Notepad``.
#. Replace the code in ``controller.server.js`` with the following:
@@ -227,7 +227,7 @@ To set up and run ``yui_module``:
};
}, '0.0.1', {
requires: [
- 'gallery-storage-lite' //see autoload/storage-lite.client.js
+ 'gallery-storage-lite' //see yui_modules/storage-lite.client.js
]
});
Oops, something went wrong.

0 comments on commit 56df54e

Please sign in to comment.