Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

[docs] Changed the autoload directory to yui modules directory, but left notes that both can be used. #821

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/dev_guide/code_exs/yui_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:

Expand Down Expand Up @@ -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`
Expand All @@ -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``
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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
]
});

Expand Down
26 changes: 13 additions & 13 deletions docs/dev_guide/intro/mojito_apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ globally available to all mojits. Those marked with an asterisk are not created
- ``assets`` - general directory containing CSS files for all mojits.
- ``application.json`` - application configuration file that lets you specify
the port and the mojits used by the application.
- ``autoload`` - directory of JavaScript files that contain YUI modules added
with ``YUI.add``. These files aren't actually *auto-loaded*, but are merely
automatically included if required by a YUI module.
- ``yui_modules`` - directory of JavaScript files that contain YUI modules added
with ``YUI.add``. These files are automatically included if required by a
YUI module.
- ``default.json`` - file that sets default values for all specifications.
- ``mojits`` - directory storing the mojits. See `Mojit Files and Directories`_
for a description of the directory contents.
Expand Down Expand Up @@ -94,10 +94,10 @@ is available.
- ``actions`` - directory of JavaScript files containing methods to add to the
controller. Actions are useful for maintaining large controllers.
- ``assets`` - directory for storing CSS or JavaScript files.
- ``autoload`` - directory containing JavaScript files that contain YUI
modules added with ``YUI.add``. These files aren't actually *autoloaded*,
but are merely automatically included if required by a YUI module. Both
the application directory and mojit directory can have ``autoload`` directories.
- ``yui_modules`` - directory containing JavaScript files that contain YUI
modules added with ``YUI.add``. These files are automatically included if required by a
YUI module. Both the application directory and mojit directory can have ``yui_modules``
directories.
- ``binders`` - directory containing event binding files for the mojit.
- ``controller.server.js`` - the mojit controller that runs on the server. You
can also create the file ``controller.client.js`` to have a mojit controller
Expand All @@ -117,11 +117,11 @@ is available.
- ``{model_name}.{affinity}-tests.js`` - the unit tests for the mojit
models.
- ``{module_name}.{affinity}-tests.js`` - the unit tests for YUI modules,
which are located in ``mojits/{mojit_name}/autoload`` directory.
which are located in ``mojits/{mojit_name}/yui_modules`` directory.
- Example of module and corresponding test:
- ``{app_name}/mojits/{mojit_name}/autoload/{module_name}.{affinity}.js``
- ``{app_name}/mojits/{mojit_name}/yui_modules/{module_name}.{affinity}.js``

- ``{app_name}/mojits/{mojit_name}/tests/autoload/{module_name}.{affinity}-tests.js``
- ``{app_name}/mojits/{mojit_name}/tests/yui_modules/{module_name}.{affinity}-tests.js``

- ``views`` - directory containing the templates.

Expand All @@ -147,13 +147,13 @@ rendering engine.
|-- application.json
|-- assets/
| `-- favicon.icon
|-- autoload/
|-- yui_modules/
| `-- *.{affinity}.js
|-- index.js
|-- mojits/
| `-- [mojit_name]
| |-- assets/
| |-- autoload/
| |-- yui_modules/
| | `-- *.{affinity}.js
| |-- binders/
| | `-- {view_name}.js
Expand All @@ -165,7 +165,7 @@ rendering engine.
| |-- models/
| | `-- {model_name}.{affinity}.js
| |-- tests/
| | |-- autoload/
| | |-- yui_modules/
| | | `-- {module_name}.{affinity}-tests.js
| | |-- controller.{affinity}-tests.js
| | `-- models/
Expand Down
10 changes: 5 additions & 5 deletions docs/dev_guide/intro/mojito_configuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ configuration Object
| | | | to cache the view. Note that not all view engines |
| | | | support caching. |
+--------------------------------------------------------+----------------------+-------------------+--------------------------------------------------------+
| ``deferAllOptionalAutoloads`` | boolean | false | Specifies whether optional YUI modules found in |
| | | | the ``/autoload/`` directories are not shipped to |
| | | | the client. This is an optimization setting and |
| | | | should generally only be set if you are building |
| | | | an offline application. |
| ``deferAllOptionalAutoloads`` | boolean | false | Specifies whether optional YUI modules found in the |
| | | | ``/autoload/`` and ``/yui_modules/`` directories are |
| | | | not shipped to the client. This is an optimization |
| | | | setting and should generally only be set if you are |
| | | | building an offline application. |
+--------------------------------------------------------+----------------------+-------------------+--------------------------------------------------------+
| ``middleware`` | array of strings | [] | A list of paths to the Node.js module that exports |
| | | | a Connect middleware function. |
Expand Down
7 changes: 0 additions & 7 deletions docs/dev_guide/reference/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ assets
application. See `Mojito Developer Topics: Assets <../topics/mojito_assets.html>`_ to
learn how to use assets in Mojito applications.

autoload
--------

A directory of a Mojito application containing JavaScript files that use YUI modules
added with ``YUI.add``. These files aren't actually *auto-loaded*, but are merely
automatically included if required by a YUI module.


binder
------
Expand Down
8 changes: 4 additions & 4 deletions docs/dev_guide/reference/mojito_troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Issues
called? <moj_binder_init>`
* :ref:`I am getting Handlebars rendering errors. Is this a client-side or server-side
issue with Handlebars and can it be fixed? <handlebars_rendering_error>`
* :ref:`Why can't my controller access the YUI modules in the "autoload" directory?
<controller_access_autoload>`
* :ref:`Why can't my controller access the YUI modules in the "yui_modules" directory?
<controller_access_yui_modules>`
* :ref:`Why am I getting the error message "EADDRINUSE, Address already in use" when I try
to start Mojito? <eaddriuse_err>`
* :ref:`When I execute child mojits with "composite.execute", the views are being rendered,
Expand Down Expand Up @@ -148,9 +148,9 @@ prototype so that your templates can be rendered. Try doing the following:

------------

.. _controller_access_autoload:
.. _controller_access_yui_modules:

**Q:** *Why can't my controller access the YUI modules in the "autoload" directory?*
**Q:** *Why can't my controller access the YUI modules in the "yui_modules" directory?*

**A:**
A common problem is that the YUI module is missing the
Expand Down
8 changes: 4 additions & 4 deletions docs/dev_guide/topics/mojito_assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ the ``<meta>`` tag and the ``addCss`` method adds the device-specific CSS.
YUI Assets
==========

YUI modules should be placed in the ``autoload`` directory and **not**
YUI modules should be placed in the ``yui_modules`` directory and **not**
the ``assets`` directory. When your mojit code wants to use one of the YUI
modules in the ``autoload`` directory, you add the module name in the
modules in the ``yui_modules`` directory, you add the module name in the
``requires`` array, and Mojito will automatically load the module.

For example, to use a YUI module called ``substitute`` in your mojit
controller, you would place the ``substitute.js`` file in the
``autoload`` directory and then add the module name in the ``requires``
``yui_modules`` directory and then add the module name in the ``requires``
array as seen in the example mojit controller below.

.. code-block:: javascript
Expand Down Expand Up @@ -296,7 +296,7 @@ be a child of the `HTMLFrameMojit <../topics/mojito_frame_mojits.html#htmlframem

When you run ``mojito compile inlinecss``, the CSS files in
``/mojits/{mojit_name}/assets/`` are compiled into the YUI module
``/mojits/{mojit_name}/autoload/compiled/inlinecss.common.js``.
``/mojits/{mojit_name}/yui_modules/compiled/inlinecss.common.js``.
Mojito will use the compiled CSS and insert inline CSS into the ``<head>``
element of the rendered view. See also
`Compiling Inline CSS <../reference/mojito_cmdline.html#compiling-inline-css>`_.
6 changes: 3 additions & 3 deletions docs/dev_guide/topics/mojito_extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ Location of YUI Modules

Application-level YUI modules should be placed in the following directory:

``{app_dir}/autoload/``
``{app_dir}/yui_modules/``

Mojit-level YUI modules should be placed in the following directory:

``{mojit_dir}/autoload/``
``{mojit_dir}/yui_modules/``


.. _libraries_yui-using:
Expand All @@ -343,7 +343,7 @@ for the ``UID`` namespace. This will let you create an instance, and the
``prototype`` object then allows you to access the method ``log`` from that
instance.

``{mojit_dir}/autoload/hello-uid.server.js``
``{mojit_dir}/yui_modules/hello-uid.server.js``

.. code-block:: javascript

Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/topics/mojito_resource_store.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ The |RS| comes with the following four built-in addons:
- calculates the asset URL base for each mojit
- ``yui``
- registers new resource type ``yui-module`` found in the directories
``autoload`` or ``yui_modules``
``yui_modules`` or ``autoload``
- registers new resource type ``yui-lang`` found in the ``lang`` directory
- calculates the ``yui`` metadata for resource versions that are YUI modules
- pre-calculates corresponding YUI module dependencies when resources are
Expand Down
4 changes: 2 additions & 2 deletions docs/dev_guide/topics/mojito_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Conventions

- ``{app_name}/tests`` - application tests
- ``{app_name}/mojits/{mojit_name}/tests`` - mojit tests
- ``{app_name}/autoload/{yui_module}/tests`` - tests for
- ``{app_name}/yui_modules/{yui_module}/tests`` - tests for
application-level YUI modules
- ``{app_name}/mojits/{mojit_name}/autoload/{yui_module}/tests`` - tests for
- ``{app_name}/mojits/{mojit_name}/yui_modules/{yui_module}/tests`` - tests for
mojit-level YUI modules
- Syntax for the name of the test file: ``{yui_module}.{affinity}-tests.js``

Expand Down
6 changes: 3 additions & 3 deletions examples/developer-guide/yui_module/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Create project and mojit
mojito create app simple yui_module
mojito create mojit simple Notepad

Put a YUI Gallery Module in ./yui_module/autoload AND rename it to include an affinity:
Put a YUI Gallery Module in ./yui_modules/ AND rename it to include an affinity:

mkdir ./yui_module/autoload
wget -O ./yui_module/autoload/storage-lite.client.js \
mkdir ./yui_modules/
wget -O ./yui_modules/storage-lite.client.js \
https://raw.github.com/rgrove/storage-lite/master/src/storage-lite.js

Edit application.json "specs":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ YUI.add('NotepadBinderIndex', function (Y, NAME) {
};

}, '0.0.1', {requires: [
'gallery-storage-lite' //see autoload/storage-lite.client.js
'gallery-storage-lite' //see yui_modules/storage-lite.client.js
]});
2 changes: 1 addition & 1 deletion examples/developer-guide/yui_module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yui_module",
"description": "example mojit showing how to load YUI modules that are in the autoload directory.",
"description": "example mojit showing how to load YUI modules that are in the yui_modules directory.",
"version": "0.0.1",
"author": {
"name": "Isao Yagi",
Expand Down