Skip to content

Commit

Permalink
docs: amend mod_development documentation with the new file scanning …
Browse files Browse the repository at this point in the history
…methods.

(cherry picked from commit 2b7ba18)
  • Loading branch information
mworrell committed Jul 2, 2015
1 parent 5c85775 commit 4f6d746
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 17 deletions.
28 changes: 27 additions & 1 deletion doc/dev/releasenotes/rel_0.13.0.rst
Expand Up @@ -18,6 +18,7 @@ Major changes are:
* More strict sanitization of content
* Social integration with Twitter, Facebook, LinkedIn, and Instagram
* *is_dependent* Resources
* Refactored automatic compile and load of changed files

This release also incorporates all fixes in the 0.12.x branch.

Expand Down Expand Up @@ -161,6 +162,30 @@ in the context of another resource. If that referring resource is deleted then t
depending resources are deleted as well.


Automatic compile and load of changed files
-------------------------------------------

The core system now starts either ``inotify-tools`` or ``fswatch``, depending on
which one is available. You have to install one of these to enable auto-compile
and auto-load of changed files.

These are watching for any change to files in Zotonic and the sites.

If a file is changed then Zotonic will:

* Recompile if a .erl file changed
* Regenerate css if a .sass, .less or .scss file changed
* Regenerate js if a .coffee file changed
* Reindex the module index if a lib file changed (.css, .js, etc)
* Reload translations if a .po file changed
* Reload a module if a .beam file changed
* Reload dispatch rules if a dispatch file changed

If a Zotonic module is reloaded then it will be automatically restarted it the
function exports or the ``mod_schema`` is changed.



Commits since 0.12.0
--------------------

Expand Down Expand Up @@ -470,7 +495,7 @@ Maas-Maarten Zeeman (43):
* mod_base: Make synchronous ajax requests when the page is unloading
* mod_search: Make it possible to pass rsc_lists as parameter to hasanyobject.

Marc Worrell (312):
Marc Worrell (313):
* smtp: Initialize e-mail server settings on startup. This is needed now that disc_copies are used.
* mod_survey: evaluate empty jump conditions to 'true'
* mod_menu: fix for passing the item_template option to the server when adding items.
Expand Down Expand Up @@ -783,6 +808,7 @@ Marc Worrell (312):
* Lock deps
* docs: 0.13.0 release notes and some extra (minimal) documentation.
* docs: add tentatve 0.13.0 release date
* core: determine mime type of attachments if it was not given.

Marco Wessel (4):
* Allow configuration of db creation and installation
Expand Down
52 changes: 36 additions & 16 deletions doc/ref/modules/mod_development.rst
Expand Up @@ -3,9 +3,6 @@

Presents various tools for development.

.. note:: **Do not enable this module on production systems, as it severely impacts performance.**


Admin page
----------

Expand Down Expand Up @@ -64,21 +61,43 @@ With this it is possible to see for a request path which dispatch rules are matc
Automatic recompilation
-----------------------

When this module is enabled, it runs a watcher program in the
background, which watches files in Zotonic and its site for
changes. If it detects changes, it performs certain actions. See below
for platform-specific installation instructions.
The core Zotonic system starts either ``inotify-tools`` or ``fswatch``, depending on
which one is available. You have to install one of these to enable auto-compile
and auto-load of changed files.

.. note:: The system can only scan for changed files if either ``inotify-tools`` or ``fswatch`` is installed.

See below for platform-specific installation instructions.

* If an `.erl` file changes, it recompiles and reloads the file
on-the-fly. When a module exports notifier functions (`observe_...`
or `pid_observe_...` functions), these are re-registered with the
notification system automatically.
If a changed file is detected then Zotonic will:

* If an `.erl` file changes then the file is recompiled.

* If a `.scss` or `.sass` file changes then ``sass`` is called to compile
it to its `.css` equivalent.

* If a `.scss` or `.less` file is touched, it calls ``lessc`` to compile
* If a `.less` file changes then ``lessc`` is called to compile
it to its `.css` equivalent.

* If a template file is added, or a dispatch rule changed, it flushes
the cache so the template file or the dispatch rule is found.
* If a `.coffee` file changes then ``coffee`` is called to compile
it to its `.js` equivalent.

* If a lib file changes then the module indexer will be called so that any
removed or added templates will be handled correctly.

* If a template file changes then the module indexer will be called so that any
removed or added template will be handled correctly.

* If a dispatch file changes then all dispatch rules are reloaded.

* If a beam file changes then the module will be loaded. If the beam file is
a Zotonic module then it will be automatically restarted if either the
function exports or the ``mod_schema`` changed.

* If the .yrl definition of the template parser changes, then the .erl version
of the parser is regenerated. (This will trigger a compile, which triggers a
beam load).


Linux installation
...................................................
Expand All @@ -89,10 +108,11 @@ uses ``notify-send``::
sudo apt-get install inotify-tools libnotify-bin

MacOS X installation

Mac OS X installation
........................................

On MacOS X (version 10.8 and higher), we use the external programs ``fswatch`` and
On Mac OS X (version 10.8 and higher), we use the external programs ``fswatch`` and
``terminal-notifier``::

sudo brew install fswatch
Expand Down

0 comments on commit 4f6d746

Please sign in to comment.