Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'develop' into yaf-develop

Conflicts:
	docs/dev_guide/api_overview/mojito_client_obj.rst
	docs/dev_guide/api_overview/mojito_rest_lib.rst
	docs/dev_guide/topics/mojito_framework_mojits.rst
	package.json
  • Loading branch information...
commit f5818a5f003d0c8977caaf53a1ba9f5938fbbba7 2 parents 811b32a + 0ec33de
Drew Folta drewfish authored
9 .gitignore
View
@@ -1,12 +1,13 @@
.DS_Store
+.lock-wscript
+.svn/
+*.bak
+*~
node_modules
!tests/fixtures/packages/node_modules
!tests/fixtures/packages/node_modules/*/node_modules
-artifacts
arrowreport
+artifacts
flatfile
-.*.swp
-*~
-.svn
test_descriptor-report.json
test_descriptor-report.xml
19 .npmignore
View
@@ -1,13 +1,14 @@
-artifacts
-examples
-artifacts
-tests
-Makefile
+.DS_Store
+.git/
.lock-wscript
.svn/
-.git/
-*~
*.bak
-.DS_Store
+*~
+/tests
+arrowreport
+artifacts
+examples
+flatfile
+Makefile
test_descriptor-report.json
-test_descriptor-report.xml
+test_descriptor-report.xml
2  docs/dev_guide/api_overview/mojito_client_obj.rst
View
@@ -6,7 +6,7 @@ Client Object
When Mojito starts up, the global object ``Y.mojito.client`` that represents the client runtime is
created. The ``client`` object can be used to pause and resume mojits running within the page.
-See `Class Y.mojito.Client <../../api/Y.mojito.Client.html>`_ in the
+See `Class Y.mojito.Client <../../api/classes/Y.mojito.Client.html>`_ in the
`Mojito API Reference <../../api/>`_ for more details.
Pausing Mojits
6 docs/dev_guide/api_overview/mojito_rest_lib.rst
View
@@ -5,15 +5,15 @@ REST Library
============
Mojito has a library to make it easier to make a REST calls to Web services from your model. For
-implementation details, see `Class Y.mojito.lib.REST <../../api/Y.mojito.lib.REST.html>`_
+implementation details, see `Class Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_
in the Mojito API documentation.
Including Library
#################
To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array, which
-instructs YUI to load the library. Once the library is loaded, you can
-use `Y.mojito.lib.REST <../../api/Y.mojito.lib.REST.html>`_ to make REST calls.
+instructs YUI to load the library. Once the library is loaded, you can use
+`Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_ to make REST calls..
.. code-block:: javascript
24 docs/dev_guide/reference/mojito_cmdline.rst
View
@@ -81,14 +81,15 @@ Testing
#######
Unit tests are run using YUI Test invoked using the Mojito command-line tool. Test output is written
-to the console and also to the file ``$CWD/artifacts/test/result.xml``. Note that it is not (yet)
-possible to specify an alternative output location.
+to the console and also to the file ``{CWD}/artifacts/test/result.xml``, where ``{CWD}`` is
+the current working directory. Note that it is not (yet) possible to specify an alternative output
+location.
- To run tests for the Mojito framework itself:
``$ mojito test``
- Output is written to ``$CWD/artifacts/test/result.xml``, where ``$CWD`` is the current working
+ Output is written to ``{CWD}/artifacts/test/result.xml``, where ``{CWD}`` is the current working
directory.
- To run tests for an application:
@@ -111,7 +112,7 @@ Code coverage is invoked in the same way as unit testing, but with the added opt
or ``-c``. To run code coverage tests, you need to have Java installed.
Coverage results are written to the console and also to file in the directory
-``$CWD/artifacts/framework/coverage/``. As with unit tests, it is not possible to specify an
+``{CWD}/artifacts/framework/coverage/``. As with unit tests, it is not possible to specify an
alternative output location.
- To run code coverage for the Mojito framework itself:
@@ -153,8 +154,8 @@ output location.
``$ mojito jslint``
- Output is written to ``$CWD/artifacts/framework/jslint/``, where ``$CWD`` is the current working
- directory.
+ Output is written to ``{CWD}/artifacts/framework/jslint/``, where ``{CWD}`` is the current
+ working directory.
- To run JSLint on an application, including all of its (owned) mojits:
@@ -182,7 +183,7 @@ location.
``$ mojito docs mojito``
- Output is written to ``$CWD/artifacts/docs/mojito/``, where ``$CWD`` is the current working
+ Output is written to ``{CWD}/artifacts/docs/mojito/``, where ``{CWD}`` is the current working
directory.
- To generate documentation for an application, including all of its (owned) mojits, run the
@@ -259,7 +260,7 @@ to generate.
Compile System
##############
-Mojito comes with a compile command for generating creates files to optimize an application for
+Mojito comes with a compile command for generating files to optimize an application for
production.
.. _compile_sys-syntax
@@ -343,8 +344,8 @@ The commands below compile inline CSS, views, and YUI modules.
Dependency Graphs
#################
-The command below generates the Graphviz file ``$CWD/artifacts/gv/yui.client.dot`` that describes
-the YUI module dependencies.
+The command below generates the Graphviz file ``{CWD}/artifacts/gv/yui.client.dot`` (``{CWD}`` represents
+the current working directory) that describes the YUI module dependencies.
``$ mojito gv``
@@ -352,7 +353,8 @@ The ``mojito gv`` command has the following options:
- ``--client`` - inspects the files that have ``client`` and ``common`` as the affinity. The default
is just to inspect files that have ``server`` and ``common`` as the affinity. For example, using
- the ``--client`` option, the file ``controller.client.js`` and ``controller.common.js`` will be inspected.
+ the ``--client`` option, the file ``controller.client.js`` and ``controller.common.js`` will be
+ inspected.
- ``--framework`` - also inspects the Mojito framework files.
.. note:: To render the Graphviz files into GIF images, you need the `Graphviz - Graph Visualization
118 docs/dev_guide/topics/mojito_framework_mojits.rst
View
@@ -7,31 +7,39 @@ Framework Mojits
Introduction
############
-Mojito comes with the built-in utility mojits that make developing applications easier. Mojito currently comes with the ``HTMLFrameMojit`` that constructs Web pages
-from the skeleton HTML to the styling and content and the ``LazyLoadMojit`` that allows you to lazily load mojit code. Mojito plans to offer additional framework mojits
-in the future.
+Mojito comes with the built-in utility mojits that make developing applications easier. Mojito
+currently comes with the ``HTMLFrameMojit`` that constructs Web pages from the skeleton HTML to the
+styling and content and the ``LazyLoadMojit`` that allows you to lazily load mojit code. Mojito
+plans to offer additional framework mojits in the future.
HTMLFrameMojit
##############
-The ``HTMLFrameMojit`` builds the HTML skeleton of a Web page. When you use ``HTMLFrameMojit`` the ``<html>``, ``<head>``, and ``<body>`` elements are automatically created
-and the content from child mojits are inserted into the ``<body>`` element. The ``HTMLFrameMojit`` can also automatically insert assets such as CSS and JavaScript files
-into either the ``<head>`` or ``<body>`` elements.
+The ``HTMLFrameMojit`` builds the HTML skeleton of a Web page. When you use ``HTMLFrameMojit`` the
+``<html>``, ``<head>``, and ``<body>`` elements are automatically created and the content from child
+mojits are inserted into the ``<body>`` element. The ``HTMLFrameMojit`` can also automatically
+insert assets such as CSS and JavaScript files into either the ``<head>`` or ``<body>`` elements.
-Because it builds the Web page from the framework to the content and styling, the ``HTMLFrameMojit`` must be the top-level mojit in a Mojito application. As the top-level
-or parent mojit, the ``HTMLFrameMojit`` may have one or more child mojits.
+Because it builds the Web page from the framework to the content and styling, the ``HTMLFrameMojit``
+must be the top-level mojit in a Mojito application. As the top-level or parent mojit, the
+``HTMLFrameMojit`` may have one or more child mojits.
-To create a Mojito application that uses the ``HTMLFrameMojit``, see the code examples `Using the HTML Frame Mojit <../code_exs/htmlframe_view.html>`_
+To create a Mojito application that uses the ``HTMLFrameMojit``, see the code examples
+`Using the HTML Frame Mojit <../code_exs/htmlframe_view.html>`_
and `Attaching Assets with HTMLFrameMojit <../code_exs/framed_assets.html>`_.
Configuration
=============
-As with defining instances of other mojit types, you define an instance of the ``HTMLFrameMojit`` in `configuration object <../intro/mojito_configuring.html#configuration-object>`_
-of ``application.json``. Because ``HTMLFrameMojit`` must be the top-level mojit, its instance cannot have a parent instance, but may have one or more child instances.
+As with defining instances of other mojit types, you define an instance of the ``HTMLFrameMojit`` in
+`configuration object <../intro/mojito_configuring.html#configuration-object>`_ of
+``application.json``. Because ``HTMLFrameMojit`` must be the top-level mojit, its instance cannot
+have a parent instance, but may have one or more child instances.
-In the example ``application.json`` below, ``frame`` is an instance of ``HTMLFrameMojit`` that has the ``child`` instance of the ``framed`` mojit. After the HTML skeleton is created,
-the ``HTMLFrameMojit`` will insert the value of the ``title`` property into the ``<title>`` element and the content created by the ``frame`` mojit into the ``<body>`` element.
+In the example ``application.json`` below, ``frame`` is an instance of ``HTMLFrameMojit`` that has
+the ``child`` instance of the ``framed`` mojit. After the HTML skeleton is created,
+the ``HTMLFrameMojit`` will insert the value of the ``title`` property into the ``<title>`` element
+and the content created by the ``frame`` mojit into the ``<body>`` element.
.. code-block:: javascript
@@ -52,8 +60,10 @@ the ``HTMLFrameMojit`` will insert the value of the ``title`` property into the
}
]
-To have multiple child instances, the ``HTMLFrameMojit`` instance must use the ``children`` object to specify the child instances. In this example ``application.json``,
-the ``page`` instance of ``HTMLFrameMojit`` uses the ``children`` object to specify three child instances that can create content for the rendered view.
+To have multiple child instances, the ``HTMLFrameMojit`` instance must use the ``children`` object
+to specify the child instances. In this example ``application.json``, the ``page`` instance of
+``HTMLFrameMojit`` uses the ``children`` object to specify three child instances that can create
+content for the rendered view.
.. code-block:: javascript
@@ -91,7 +101,8 @@ the ``page`` instance of ``HTMLFrameMojit`` uses the ``children`` object to spec
Deploying to Client
===================
-To configure Mojito to deploy code to the client, you set the ``deploy`` property of the `config <../intro/mojito_configuring.html#configuration-object>`_ object to ``true``
+To configure Mojito to deploy code to the client, you set the ``deploy`` property of the
+`config <../intro/mojito_configuring.html#configuration-object>`_ object to ``true``
as shown below.
.. code-block:: javascript
@@ -121,18 +132,23 @@ The following is deployed to the client:
- Mojito framework
- binders (and their dependencies)
-When a binder invokes its controller, if the controller has the ``client`` or ``common`` affinity, then the controller and its dependencies are deployed to the client as well.
-If the affinity of the controller is ``server``, the invocation occurs on the server. In either case, the binder is able to transparently invoke the controller.
+When a binder invokes its controller, if the controller has the ``client`` or ``common`` affinity,
+then the controller and its dependencies are deployed to the client as well. If the affinity of the
+controller is ``server``, the invocation occurs on the server. In either case, the binder is able to
+transparently invoke the controller.
Adding Assets with HTMLFrameMojit
=================================
-You specify the assets for ``HTMLFrameMojit`` just as you would specify assets for any mojit. The basic difference is that ``HTMLFrameMojit`` will automatically attach ``<link>`` elements
-for CSS and ``<script>`` elements for JavaScript files to the HTML page. When using assets with other mojits, you have to manually add ``<link>`` elements that refer to assets to templates.
-See `Assets <./mojito_assets.html>`_ for general information about using assets in Mojito.
+You specify the assets for ``HTMLFrameMojit`` just as you would specify assets for any mojit. The
+basic difference is that ``HTMLFrameMojit`` will automatically attach ``<link>`` elements for CSS
+and ``<script>`` elements for JavaScript files to the HTML page. When using assets with other mojits,
+you have to manually add ``<link>`` elements that refer to assets to templates. See
+`Assets <./mojito_assets.html>`_ for general information about using assets in Mojito.
-In the example ``application.json`` below, the ``HTMLFrameMojit`` instance ``frame`` has one child mojit with a CSS asset. Because the assets are listed in the ``top`` object,
-the ``HTMLFrameMojit`` will attach the ``<link>`` element pointing to ``index.css`` to the ``<head>`` element.
+In the example ``application.json`` below, the ``HTMLFrameMojit`` instance ``frame`` has one child
+mojit with a CSS asset. Because the assets are listed in the ``top`` object, the ``HTMLFrameMojit``
+will attach the ``<link>`` element pointing to ``index.css`` to the ``<head>`` element.
.. code-block:: javascript
@@ -159,7 +175,8 @@ the ``HTMLFrameMojit`` will attach the ``<link>`` element pointing to ``index.cs
}
]
-The rendered view that was constructed by the ``HTMLFrameMojit`` should look similar to the HTML below.
+The rendered view that was constructed by the ``HTMLFrameMojit`` should look similar to the HTML
+below.
.. code-block:: html
@@ -181,15 +198,19 @@ The rendered view that was constructed by the ``HTMLFrameMojit`` should look sim
LazyLoadMojit
#############
-``LazyLoadMojit`` allows you to defer the loading of a mojit instance by first dispatching the ``LazyLoadMoit`` as a proxy to the client. From the client,
-``LazyLoadMojit`` can then request Mojito to load the proxied mojit. This allows your Mojito application to load the page quickly and then lazily load parts of the page.
+``LazyLoadMojit`` allows you to defer the loading of a mojit instance by first dispatching the
+``LazyLoadMoit`` as a proxy to the client. From the client, ``LazyLoadMojit`` can then request
+Mojito to load the proxied mojit. This allows your Mojito application to load the page quickly and
+then lazily load parts of the page.
How Does It Work?
=================
-The ``LazyLoadMojit`` is really a proxy mojit that dispatches it's binder and an empty DOM node to the client. From the client, the binder sends a request to the controller
-to execute the code of the proxied (original) mojit. The output from the executed mojit is then returned to the binder of the ``LazyLoadMojit``, which attaches the output
-to the empty DOM node. The binder of ``LazyLoadMojit`` destroys itself, leaving the DOM intact with the new content.
+The ``LazyLoadMojit`` is really a proxy mojit that dispatches it's binder and an empty DOM node to
+the client. From the client, the binder sends a request to the controller to execute the code of
+the proxied (original) mojit. The output from the executed mojit is then returned to the binder of
+the ``LazyLoadMojit``, which attaches the output to the empty DOM node. The binder of
+``LazyLoadMojit`` destroys itself, leaving the DOM intact with the new content.
Configuring Lazy Loading
========================
@@ -201,8 +222,9 @@ To use the ``LazyLoadMojit``, the ``application.json`` must do the following:
- create a container mojit that has children mojit instances (``"children": { ... }``)
- defer the dispatch of the mojit instance that will be lazily loaded (``"defer": true``)
-In the example ``application.json`` below, the child mojit instance ``myLazyMojit`` is configured to be lazily loaded. The action (``hello``) of the proxied mojit is
-also configured to be executed after lazy loading is complete.
+In the example ``application.json`` below, the child mojit instance ``myLazyMojit`` is configured to
+be lazily loaded. The action (``hello``) of the proxied mojit is also configured to be executed
+after lazy loading is complete.
.. code-block:: javascript
@@ -238,22 +260,28 @@ also configured to be executed after lazy loading is complete.
Example
=======
-This example shows you application configuration as well as the code for the parent mojit and the child mojit that is lazy loaded. If you were to run this lazy load example,
-you would see the content of the parent mojit first and then see the child mojit's output loaded in the page.
+This example shows you application configuration as well as the code for the parent mojit and the
+child mojit that is lazy loaded. If you were to run this lazy load example, you would see the
+content of the parent mojit first and then see the child mojit's output loaded in the page.
Application Configuration
-------------------------
-The application configuration for this example (shown below) meets the requirements for using ``LazyLoadMojit``:
+The application configuration for this example (shown below) meets the requirements for using
+``LazyLoadMojit``:
- creates the ``frame`` mojit instance of type ``HTMLFrameMojit``
- sets ``"deploy"`` to ``true`` for ``frame`` so that the code is deployed to the client
-- creates the ``child`` mojit instance that has the ``children`` object specifying child mojit instance
-- configures the ``myLazyMojit`` instance to defer being dispatched, which causes it to be lazily loaded by ``LazyLoadMojit``
+- creates the ``child`` mojit instance that has the ``children`` object specifying child mojit
+ instance
+- configures the ``myLazyMojit`` instance to defer being dispatched, which causes it to be lazily
+ loaded by ``LazyLoadMojit``
-In this ``application.json``, the ``parent`` mojit instance has the one child ``myLazyMojit``. The ``myLazyMojit`` mojit instance of type ``LazyChild`` is the mojit that
-will be lazily loaded by ``LazyLoadMojit``. In a production application, you could configure the application to have many child instances that are lazily loaded after
-the parent mojit instance is already loaded onto the page.
+In this ``application.json``, the ``parent`` mojit instance has the one child ``myLazyMojit``.
+The ``myLazyMojit`` mojit instance of type ``LazyChild`` is the mojit that will be lazily loaded by
+``LazyLoadMojit``. In a production application, you could configure the application to have many
+child instances that are lazily loaded after the parent mojit instance is already loaded onto the
+page.
.. code-block:: javascript
@@ -304,23 +332,25 @@ The ``Container`` mojit uses ``ac.composite.done`` to execute its child mojits.
};
}, '0.0.1', {requires: ['mojito']});
-Instead of waiting for the child mojit to execute, the partially rendered view of the ``Container`` mojit is immediately sent to the client. After the child mojit is lazily loaded,
-the content of the executed child replaces the Handlebars expression ``{{{myLazyChild}}}``.
+Instead of waiting for the child mojit to execute, the partially rendered view of the ``Container``
+mojit is immediately sent to the client. After the child mojit is lazily loaded, the content of the
+executed child replaces the Handlebars expression ``{{{myLazyMojit}}}``.
.. code-block:: html
<div id="{{mojit_view_id}}">
<h1>Lazy Loading</h1>
<hr/>
- {{{myLazyChild}}}
+ {{{myLazyMojit}}
<hr/>
</div>
LazyChild Mojit
---------------
-The ``LazyLoadMojit`` in the ``application.json`` is configured to lazily load the mojit instance ``myLazyChild`` and then call the action ``hello``. Thus, the ``index`` function
-in the ``LazyChild`` mojit below is never called.
+The ``LazyLoadMojit`` in the ``application.json`` is configured to lazily load the mojit instance
+``myLazyMojit`` and then call the action ``hello``. Thus, the ``index`` function in the
+``LazyChild`` mojit below is never called.
.. code-block:: javascript
22 lib/tests/autoload/app/addons/view-engines/mu-tests.server.js
View
@@ -122,14 +122,15 @@ YUI.add('mojito-mu-tests', function(Y, NAME) {
buffer += d;
},
done: function(d, m) {
- doneCount += 1;
- buffer += d;
- A.isTrue(2 === flushCount, 'wrong flushCount: ' + flushCount);
- A.isTrue(1 === doneCount, 'wrong doneCount: ' + doneCount);
- A.areEqual("<div>bar</div><div>bar</div><div>bar</div>",
- buffer,
- 'wrong buffer');
- self.resume();
+ self.resume(function () {
+ doneCount += 1;
+ buffer += d;
+ A.isTrue(2 === flushCount, 'wrong flushCount: ' + flushCount);
+ A.isTrue(1 === doneCount, 'wrong doneCount: ' + doneCount);
+ A.areEqual("<div>bar</div><div>bar</div><div>bar</div>",
+ buffer,
+ 'wrong buffer');
+ });
}
};
meta = { view: { cacheTemplates: false } };
@@ -141,10 +142,7 @@ YUI.add('mojito-mu-tests', function(Y, NAME) {
muAdapter.render(data, mojitType, tmpl, adapter, meta, true);
muAdapter.render(data, mojitType, tmpl, adapter, meta);
- function waitFn() {
- self.wait(waitFn, 1000);
- }
- waitFn();
+ this.wait(2000);
}
}));
2  package.json
View
@@ -20,7 +20,7 @@
"async": "*",
"colors": "*",
"combohandler": "0.1.x",
- "commander": "~1.0.1",
+ "commander": "1.0.1",
"connect": "1.8.2",
"express": "2.5.2",
"glob": "~3.1.11",
19 tests/run.js
View
@@ -1,11 +1,13 @@
#!/usr/bin/env node
var fs = require('fs'),
+ libpath = require('path'),
program = require('commander'),
async = require('async'),
child = require('child_process'),
cwd = __dirname,
pids = [],
+ pidNames = {},
returnVal = 0;
program.command('test')
@@ -78,6 +80,7 @@ function startArrowServer (callback) {
});
p.stdout.on('data', listener);
pids.push(p.pid);
+ pidNames[p.pid] = 'arrow_server';
timeout = setTimeout(function () {
p.stdout.removeListener('data', listener); // Stop printing output from arrow_server
callback(null);
@@ -158,6 +161,7 @@ function startArrowSelenium (callback) {
var p = runCommand(cwd+"/func/applications/frameworkapp/common", "arrow_selenium", ["--open=firefox"]);
setTimeout(function () {
pids.push(p.pid);
+ pidNames[p.pid] = 'arrow_selenium';
callback(null);
}, 10000);
}
@@ -169,7 +173,7 @@ function runFuncTests (callback) {
var cmd = runCommand(
cwd + '/func/',
"arrow",
- [cwd + "/func/**/test_descriptor.json", "--browser=firefox", "--reuseSession", "--report=true", "--reportFolder=" + arrowReportDir],
+ [cwd + "/func/**/*_descriptor.json", "--browser=firefox", "--reuseSession", "--report=true", "--reportFolder=" + arrowReportDir],
function (code) {
callback(code);
}
@@ -182,8 +186,13 @@ function runFuncTests (callback) {
function finalize (err, results) {
for(var i=0; i < pids.length; i++) {
- console.log('Shutting down pid ' + pids[i]);
- process.kill(pids[i]);
+ console.log('Shutting down pid ' + pids[i] + ' -- ' + pidNames[pids[i]]);
+ try {
+ process.kill(pids[i]);
+ }
+ catch(e) {
+ console.log('FAILED to shut down pid ' + pids[i] + ' -- ' + pidNames[pids[i]]);
+ }
}
if (err) {
console.log(err);
@@ -234,6 +243,7 @@ function runMojitoApp (basePath, path, port, params, callback) {
console.log('Starting ' + path + ' at port ' + port + ' with params ' + (params || 'empty'));
var p = runCommand(basePath + '/' + path, "mojito", ["start", port, "--context", params], function () {});
pids.push(p.pid);
+ pidNames[p.pid] = libpath.basename(path) + ':' + port + (params ? '?' + params : '');
// Give each app a second to start
setTimeout(function () { callback(null) }, 1000);
}
@@ -243,6 +253,7 @@ function runStaticApp (basePath, path, port, params, callback) {
console.log('Starting static server for ' + path + ' at port ' + port);
var p = runCommand(basePath + '/' + path, "node", [cwd + "/base/staticServer.js", port], function () {});
pids.push(p.pid);
+ pidNames[p.pid] = 'static ' + libpath.basename(path) + ':' + port;
// Give each app a second to start
setTimeout(function () { callback(null) }, 1000);
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.