You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by sarangan12 <gi...@git.apache.org> on 2016/02/05 20:32:54 UTC

[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

GitHub user sarangan12 opened a pull request:

    https://github.com/apache/cordova-docs/pull/489

    CB-10353: Make Hooks guide a reference

    Making Hooks guide a reference
    
    @nikhilkh @axemclion @rakatyal Can you review this PR?

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sarangan12/cordova-docs CB-10353

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-docs/pull/489.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #489
    
----
commit 8375e2d37dfeeb47afc400469602d29b2a86d032
Author: Sarangan Rajamanickam <sa...@microsoft.com>
Date:   2016-02-04T18:38:54Z

    CB-10353: Make Hooks guide a reference
    
    Making Hooks guide a reference

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-180589385
  
    No we shouldn't. I didn't see anything in the diff on that so was curious. Also do you think it's a good idea to add another sample usage for iOS/windows?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52084953
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -20,63 +20,193 @@ license: >
     title: Hooks Guide
     ---
     
    -# Hooks Guide
    +# Hooks
    +
    +## Introduction
     
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +Cordova hooks allow you to perform special activities around cordova commands. For example, 
    +you may have a custom tool that checks for code formatting in your javascript file. And, you 
    +would like to run this tool before every build. In such a case, you could use a 
    +'before_build' hook and instruct the cordova run time to run the custom tool to be invoked 
    +before every build. 
    +
    +There are 2 types of hooks:
    +
    +- Application hooks
    +- Plugins hooks
    +
    +### Application hooks
    +
    +These hooks are related to the application. For example, hooks such as `before_build`, 
    +`after_build`, etc applies to your application. 
    +
    +### Plugin hooks
    +
    +These hooks are related to the plugins of your application. For example, hooks such as 
    +`before_plugin_add`, `after_plugin_add`, etc applies to plugin related activities. These
    +hooks can be associated with all plugins within your application or be specific to only 
    +one plugin. 
    +
    +Cordova supports the following hook types:
    +
    +<!-- START HTML -->
    +
    +<table class="hooks" width="100%">
    +    <thead>
    +        <tr>
    +            <th>Hook Type</th>
    +            <th>Associated Cordova Command</th>
    +            <th>Description</th>
    +        </tr>
    +    </thead>
    +    <tbody>
    +        <tr>
    +            <th colspan="3" class="sd">Application hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformadd">before_platform_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform add</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after adding a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformadd">after_platform_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformrm">before_platform_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform rm</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after removing a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformrm">after_platform_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformls">before_platform_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform ls</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after listing the installed and available platforms.</td>
    +        </tr>        
    +        <tr>
    +            <th data-col="afterplatformls">after_platform_ls</th>
    +        </tr>        
    +        <tr>
    +            <th data-col="beforeprepare">before_prepare</th>
    +            <td data-col="code" rowspan="2"><code>cordova prepare</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after preparing your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterprepare">after_prepare</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforecompile">before_compile</th>
    +            <td data-col="code" rowspan="2"><code>cordova compile</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after compiling your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="aftercompile">after_compile</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforebuild">before_build</th>
    +            <td data-col="code" rowspan="2"><code>cordova build</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after building your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterbuild">after_build</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeemulate">before_emulate</th>
    +            <td data-col="code" rowspan="2"><code>cordova emulate</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after emulating your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afteremulate">after_emulate</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforerun">before_run</th>
    +            <td data-col="code" rowspan="2"><code>cordova run</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after running your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterrun">after_run</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeserve">before_serve</th>
    +            <td data-col="code" rowspan="2"><code>cordova serve</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after serving your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterserve">after_serve</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeclean">before_clean</th>
    +            <td data-col="code" rowspan="2"><code>cordova clean</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after cleaning your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterclean">after_clean</th>
    +        </tr>
    +        <tr>
    +            <th data-col="prepackage">pre_package</td>
    +            <td data-col="code">N/A</td>
    +            <td data-col="description">Applicable to Windows 8 and Windows Phone only. This hook is deprecated.</td>
    +        </tr>
    +        <tr>
    +            <th colspan="3" class="sd">Plugin hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginadd">before_plugin_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after adding a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginadd">after_plugin_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginrm">before_plugin_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after removing a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginrm">after_plugin_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginls">before_plugin_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin ls</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after listing the plugins in your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginls">after_plugin_ls</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginsearch">before_plugin_search</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin search</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after a plugin search.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginsearch">after_plugin_search</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplugininstall">before_plugin_install</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after installing a plugin (to the platforms).</td>
    --- End diff --
    
    It will be nice to comment on how `add` and `install` are different for plugins.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-180541475
  
    Are we getting rid of the 'Sample usage' section?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52063845
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -22,61 +22,191 @@ title: Hooks Guide
     
     # Hooks Guide
     
    +## Introduction
    +
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +There may be special activities that you would like to perform before invoking 
    +cordova commands. For example, you may have a custom tool that checks for code formatting 
    +in your javascript file. And, you would like to run this tool before every build. In such
    +a case, you could use a 'before_build' hook and instruct the cordova run time to run the 
    +custom tool to be invoked before every build. 
    +
    +There are 2 types of hooks:
    +
    +- Application specific hooks
    +- Plugins related hooks
    --- End diff --
    
    Plugins specific hooks. Should we rename these to 'Application hooks' and 'Plugin hooks'? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52079856
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,28 +307,51 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +
    +
    +
     __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    --- End diff --
    
    No colon after e.g.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52080185
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -115,41 +247,38 @@ As a plugin developer you can define hook scripts using `<hook>` elements in a `
         <hook type="before_plugin_install" src="scripts/beforeInstall.js" />
         <hook type="after_build" src="scripts/afterBuild.js" />
     
    -    <platform name="wp8">
    -        <hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" />
    -        <hook type="before_build" src="scripts/wp8BeforeBuild.js" />
    +    <platform name="android">
    +        <hook type="before_plugin_install" src="scripts/androidBeforeInstall.js" />
    +        <hook type="before_build" src="scripts/androidBeforeBuild.js" />
             ...
         </platform>
     
    -`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled.
    +`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired 
    +exclusively for the plugin being installed/uninstalled.
     
    -## Script Interface
    +### Order of Hooks execution
    +
    +Hook scripts could be defined by adding them to the special predefined folder 
    --- End diff --
    
    Hook scripts *can*...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-187435699
  
    LGTM!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by sarangan12 <gi...@git.apache.org>.
Github user sarangan12 commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-180586418
  
    @rakatyal Why do we want to remove Sample Usage? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52085944
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -20,63 +20,193 @@ license: >
     title: Hooks Guide
     ---
     
    -# Hooks Guide
    +# Hooks
    +
    +## Introduction
     
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +Cordova hooks allow you to perform special activities around cordova commands. For example, 
    +you may have a custom tool that checks for code formatting in your javascript file. And, you 
    +would like to run this tool before every build. In such a case, you could use a 
    +'before_build' hook and instruct the cordova run time to run the custom tool to be invoked 
    +before every build. 
    +
    +There are 2 types of hooks:
    +
    +- Application hooks
    +- Plugins hooks
    +
    +### Application hooks
    +
    +These hooks are related to the application. For example, hooks such as `before_build`, 
    +`after_build`, etc applies to your application. 
    +
    +### Plugin hooks
    +
    +These hooks are related to the plugins of your application. For example, hooks such as 
    +`before_plugin_add`, `after_plugin_add`, etc applies to plugin related activities. These
    +hooks can be associated with all plugins within your application or be specific to only 
    +one plugin. 
    +
    +Cordova supports the following hook types:
    +
    +<!-- START HTML -->
    +
    +<table class="hooks" width="100%">
    +    <thead>
    +        <tr>
    +            <th>Hook Type</th>
    +            <th>Associated Cordova Command</th>
    +            <th>Description</th>
    +        </tr>
    +    </thead>
    +    <tbody>
    +        <tr>
    +            <th colspan="3" class="sd">Application hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformadd">before_platform_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform add</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after adding a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformadd">after_platform_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformrm">before_platform_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform rm</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after removing a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformrm">after_platform_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformls">before_platform_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform ls</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after listing the installed and available platforms.</td>
    +        </tr>        
    +        <tr>
    +            <th data-col="afterplatformls">after_platform_ls</th>
    +        </tr>        
    +        <tr>
    +            <th data-col="beforeprepare">before_prepare</th>
    +            <td data-col="code" rowspan="2"><code>cordova prepare</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after preparing your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterprepare">after_prepare</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforecompile">before_compile</th>
    +            <td data-col="code" rowspan="2"><code>cordova compile</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after compiling your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="aftercompile">after_compile</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforebuild">before_build</th>
    +            <td data-col="code" rowspan="2"><code>cordova build</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after building your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterbuild">after_build</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeemulate">before_emulate</th>
    +            <td data-col="code" rowspan="2"><code>cordova emulate</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after emulating your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afteremulate">after_emulate</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforerun">before_run</th>
    +            <td data-col="code" rowspan="2"><code>cordova run</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after running your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterrun">after_run</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeserve">before_serve</th>
    +            <td data-col="code" rowspan="2"><code>cordova serve</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after serving your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterserve">after_serve</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeclean">before_clean</th>
    +            <td data-col="code" rowspan="2"><code>cordova clean</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after cleaning your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterclean">after_clean</th>
    +        </tr>
    +        <tr>
    +            <th data-col="prepackage">pre_package</td>
    +            <td data-col="code">N/A</td>
    +            <td data-col="description">Applicable to Windows 8 and Windows Phone only. This hook is deprecated.</td>
    +        </tr>
    +        <tr>
    +            <th colspan="3" class="sd">Plugin hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginadd">before_plugin_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after adding a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginadd">after_plugin_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginrm">before_plugin_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after removing a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginrm">after_plugin_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginls">before_plugin_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin ls</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after listing the plugins in your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginls">after_plugin_ls</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginsearch">before_plugin_search</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin search</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after a plugin search.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginsearch">after_plugin_search</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplugininstall">before_plugin_install</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after installing a plugin (to the platforms).</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplugininstall">after_plugin_install</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginuninstall">before_plugin_uninstall</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td data-col="description">To be executed before uninstalling a plugin (from the platforms).</td>
    +        </tr>
    +    </tbody>
    +</table>
    +
    +<!-- END HTML -->
     
     ## Ways to define hooks
    -### Via `/hooks` directory
     
    -__Note__: this method is considered deprecated in favor of the hook elements in config.xml and plugin.xml.
    +### Via `/hooks` directory
    --- End diff --
    
    Let's not keep the deprecated option as the first way to define a hook. Also, in the title it will be great to add `(Deprecated)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52085942
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -20,63 +20,193 @@ license: >
     title: Hooks Guide
     ---
     
    -# Hooks Guide
    +# Hooks
    +
    +## Introduction
     
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +Cordova hooks allow you to perform special activities around cordova commands. For example, 
    +you may have a custom tool that checks for code formatting in your javascript file. And, you 
    +would like to run this tool before every build. In such a case, you could use a 
    +'before_build' hook and instruct the cordova run time to run the custom tool to be invoked 
    +before every build. 
    +
    +There are 2 types of hooks:
    +
    +- Application hooks
    +- Plugins hooks
    +
    +### Application hooks
    +
    +These hooks are related to the application. For example, hooks such as `before_build`, 
    +`after_build`, etc applies to your application. 
    +
    +### Plugin hooks
    +
    +These hooks are related to the plugins of your application. For example, hooks such as 
    +`before_plugin_add`, `after_plugin_add`, etc applies to plugin related activities. These
    +hooks can be associated with all plugins within your application or be specific to only 
    +one plugin. 
    +
    +Cordova supports the following hook types:
    +
    +<!-- START HTML -->
    +
    +<table class="hooks" width="100%">
    +    <thead>
    +        <tr>
    +            <th>Hook Type</th>
    +            <th>Associated Cordova Command</th>
    +            <th>Description</th>
    +        </tr>
    +    </thead>
    +    <tbody>
    +        <tr>
    +            <th colspan="3" class="sd">Application hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformadd">before_platform_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform add</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after adding a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformadd">after_platform_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformrm">before_platform_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform rm</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after removing a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformrm">after_platform_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformls">before_platform_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform ls</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after listing the installed and available platforms.</td>
    +        </tr>        
    +        <tr>
    +            <th data-col="afterplatformls">after_platform_ls</th>
    +        </tr>        
    +        <tr>
    +            <th data-col="beforeprepare">before_prepare</th>
    +            <td data-col="code" rowspan="2"><code>cordova prepare</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after preparing your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterprepare">after_prepare</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforecompile">before_compile</th>
    +            <td data-col="code" rowspan="2"><code>cordova compile</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after compiling your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="aftercompile">after_compile</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforebuild">before_build</th>
    +            <td data-col="code" rowspan="2"><code>cordova build</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after building your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterbuild">after_build</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeemulate">before_emulate</th>
    +            <td data-col="code" rowspan="2"><code>cordova emulate</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after emulating your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afteremulate">after_emulate</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforerun">before_run</th>
    +            <td data-col="code" rowspan="2"><code>cordova run</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after running your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterrun">after_run</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeserve">before_serve</th>
    +            <td data-col="code" rowspan="2"><code>cordova serve</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after serving your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterserve">after_serve</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeclean">before_clean</th>
    +            <td data-col="code" rowspan="2"><code>cordova clean</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after cleaning your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterclean">after_clean</th>
    +        </tr>
    +        <tr>
    +            <th data-col="prepackage">pre_package</td>
    +            <td data-col="code">N/A</td>
    +            <td data-col="description">Applicable to Windows 8 and Windows Phone only. This hook is deprecated.</td>
    +        </tr>
    +        <tr>
    +            <th colspan="3" class="sd">Plugin hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginadd">before_plugin_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after adding a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginadd">after_plugin_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginrm">before_plugin_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after removing a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginrm">after_plugin_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginls">before_plugin_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin ls</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after listing the plugins in your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginls">after_plugin_ls</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginsearch">before_plugin_search</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin search</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after a plugin search.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginsearch">after_plugin_search</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplugininstall">before_plugin_install</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after installing a plugin (to the platforms).</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplugininstall">after_plugin_install</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginuninstall">before_plugin_uninstall</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td data-col="description">To be executed before uninstalling a plugin (from the platforms).</td>
    +        </tr>
    +    </tbody>
    +</table>
    +
    +<!-- END HTML -->
     
     ## Ways to define hooks
    -### Via `/hooks` directory
     
    -__Note__: this method is considered deprecated in favor of the hook elements in config.xml and plugin.xml.
    +### Via `/hooks` directory
    --- End diff --
    
    Let's not keep the deprecated option as the first way to define a hook. Also, in the title it will be great to add `(Deprecated)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52085523
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -20,63 +20,193 @@ license: >
     title: Hooks Guide
     ---
     
    -# Hooks Guide
    +# Hooks
    +
    +## Introduction
     
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +Cordova hooks allow you to perform special activities around cordova commands. For example, 
    +you may have a custom tool that checks for code formatting in your javascript file. And, you 
    +would like to run this tool before every build. In such a case, you could use a 
    +'before_build' hook and instruct the cordova run time to run the custom tool to be invoked 
    +before every build. 
    +
    +There are 2 types of hooks:
    +
    +- Application hooks
    +- Plugins hooks
    +
    +### Application hooks
    +
    +These hooks are related to the application. For example, hooks such as `before_build`, 
    +`after_build`, etc applies to your application. 
    +
    +### Plugin hooks
    +
    +These hooks are related to the plugins of your application. For example, hooks such as 
    +`before_plugin_add`, `after_plugin_add`, etc applies to plugin related activities. These
    +hooks can be associated with all plugins within your application or be specific to only 
    +one plugin. 
    +
    +Cordova supports the following hook types:
    +
    +<!-- START HTML -->
    +
    +<table class="hooks" width="100%">
    +    <thead>
    +        <tr>
    +            <th>Hook Type</th>
    +            <th>Associated Cordova Command</th>
    +            <th>Description</th>
    +        </tr>
    +    </thead>
    +    <tbody>
    +        <tr>
    +            <th colspan="3" class="sd">Application hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformadd">before_platform_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform add</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after adding a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformadd">after_platform_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformrm">before_platform_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform rm</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after removing a platform.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplatformrm">after_platform_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplatformls">before_platform_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova platform ls</code></td>
    +            <td rowspan="2" class="description" data-col="description">To be executed before and after listing the installed and available platforms.</td>
    +        </tr>        
    +        <tr>
    +            <th data-col="afterplatformls">after_platform_ls</th>
    +        </tr>        
    +        <tr>
    +            <th data-col="beforeprepare">before_prepare</th>
    +            <td data-col="code" rowspan="2"><code>cordova prepare</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after preparing your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterprepare">after_prepare</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforecompile">before_compile</th>
    +            <td data-col="code" rowspan="2"><code>cordova compile</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after compiling your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="aftercompile">after_compile</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforebuild">before_build</th>
    +            <td data-col="code" rowspan="2"><code>cordova build</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after building your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterbuild">after_build</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeemulate">before_emulate</th>
    +            <td data-col="code" rowspan="2"><code>cordova emulate</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after emulating your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afteremulate">after_emulate</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforerun">before_run</th>
    +            <td data-col="code" rowspan="2"><code>cordova run</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after running your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterrun">after_run</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeserve">before_serve</th>
    +            <td data-col="code" rowspan="2"><code>cordova serve</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after serving your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterserve">after_serve</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeclean">before_clean</th>
    +            <td data-col="code" rowspan="2"><code>cordova clean</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after cleaning your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterclean">after_clean</th>
    +        </tr>
    +        <tr>
    +            <th data-col="prepackage">pre_package</td>
    +            <td data-col="code">N/A</td>
    +            <td data-col="description">Applicable to Windows 8 and Windows Phone only. This hook is deprecated.</td>
    +        </tr>
    +        <tr>
    +            <th colspan="3" class="sd">Plugin hooks</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginadd">before_plugin_add</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after adding a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginadd">after_plugin_add</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginrm">before_plugin_rm</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after removing a plugin.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginrm">after_plugin_rm</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginls">before_plugin_ls</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin ls</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after listing the plugins in your application.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginls">after_plugin_ls</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginsearch">before_plugin_search</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin search</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after a plugin search.</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterpluginsearch">after_plugin_search</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforeplugininstall">before_plugin_install</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin add</code></td>
    +            <td rowspan="2" data-col="description">To be executed before and after installing a plugin (to the platforms).</td>
    +        </tr>
    +        <tr>
    +            <th data-col="afterplugininstall">after_plugin_install</th>
    +        </tr>
    +        <tr>
    +            <th data-col="beforepluginuninstall">before_plugin_uninstall</th>
    +            <td data-col="code" rowspan="2"><code>cordova plugin rm</code></td>
    +            <td data-col="description">To be executed before uninstalling a plugin (from the platforms).</td>
    --- End diff --
    
    The important comment on how hooks from `plugin.xml` get executed is missing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52065065
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -158,7 +287,7 @@ module.exports = function(context) {
       "opts": {
         "projectRoot":"C:\\path\\to\\the\\project",
         "cordova": {
    -      "platforms": ["wp8"],
    +      "platforms": ["android"],
           "plugins": ["com.plugin.withhooks"],
    --- End diff --
    
    This uses old ID format. Instead use "plugin-withhooks".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52085107
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,28 +307,51 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +
    +
    +
     __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    +------------------------------|--------------------------------------------
    +CORDOVA_VERSION               | The version of the Cordova-CLI.
    +CORDOVA_PLATFORMS             | Comma separated list of platforms that the command applies to (e.g.: android, ios).
    +CORDOVA_PLUGINS               | Comma separated list of plugin IDs that the command applies to (e.g.: cordova-plugin-file-transfer, cordova-plugin-file)
    +CORDOVA_HOOK                  | Path to the hook that is being executed.
    +CORDOVA_CMDLINE               | The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
     
     If a script returns a non-zero exit code, then the parent cordova command will be aborted.
     
    -Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
    +__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see [Javascript](#link-javascript) section above.
    --- End diff --
    
    Add a `>` before it to make it show up as block-quoted.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52080114
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,28 +307,51 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +
    +
    +
     __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    +------------------------------|--------------------------------------------
    +CORDOVA_VERSION               | The version of the Cordova-CLI.
    +CORDOVA_PLATFORMS             | Comma separated list of platforms that the command applies to (e.g.: android, ios).
    +CORDOVA_PLUGINS               | Comma separated list of plugin IDs that the command applies to (e.g.: cordova-plugin-file-transfer, cordova-plugin-file)
    +CORDOVA_HOOK                  | Path to the hook that is being executed.
    +CORDOVA_CMDLINE               | The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
     
     If a script returns a non-zero exit code, then the parent cordova command will be aborted.
     
    -Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
    +__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see [Javascript](#link-javascript) section above.
    +
    +#### Windows Quirks
    +
    +If you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
    --- End diff --
    
    This sentence reads awkwardly and should be rephrased.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-187337715
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52063505
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -22,61 +22,191 @@ title: Hooks Guide
     
     # Hooks Guide
    --- End diff --
    
    Let's just call it 'Hooks' since this will be placed inside reference folder.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by sarangan12 <gi...@git.apache.org>.
Github user sarangan12 commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r53701491
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,30 +326,44 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    -__Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +> __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    +------------------------------|--------------------------------------------
    +CORDOVA_VERSION               | The version of the Cordova-CLI.
    +CORDOVA_PLATFORMS             | Comma separated list of platforms that the command applies to (e.g.: android, ios).
    +CORDOVA_PLUGINS               | Comma separated list of plugin IDs that the command applies to (e.g.: cordova-plugin-file-transfer, cordova-plugin-file)
    --- End diff --
    
    Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by riknoll <gi...@git.apache.org>.
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r53703389
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -115,41 +218,86 @@ As a plugin developer you can define hook scripts using `<hook>` elements in a `
         <hook type="before_plugin_install" src="scripts/beforeInstall.js" />
         <hook type="after_build" src="scripts/afterBuild.js" />
     
    -    <platform name="wp8">
    -        <hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" />
    -        <hook type="before_build" src="scripts/wp8BeforeBuild.js" />
    +    <platform name="android">
    +        <hook type="before_plugin_install" src="scripts/androidBeforeInstall.js" />
    +        <hook type="before_build" src="scripts/androidBeforeBuild.js" />
             ...
         </platform>
     
    -`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled.
    +`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired
    +exclusively for the plugin being installed/uninstalled.
    +
    +### Via `/hooks` directory (Deprecated)
    +
    +To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example:
    +
    +    # script file will be automatically executed after each build
    +    hooks/after_build/after_build_custom_action.js
    +
    +When using these hooks, they will always be run as executable files, not as loadable JavaScript modules.
    +
    +__Remember__: Make your scripts executable in this case.
    +
    +__Note__: this method is considered deprecated in favor of the hook elements in config.xml and plugin.xml.
    +
    +### Order of Hooks execution
    +
    +#### Based on Hooks Definition
    +
    +Hook scripts could be defined by adding them to the special predefined folder
    +(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    +serially in the following order:
    +
    +* Application hooks from `/hooks`;
    +* Application hooks from `config.xml`;
    +* Plugin hooks from `plugins/.../plugin.xml`.
    +
    +#### Based on the Internal order of execution
    +
    +The internal order of execution of hooks is fixed.
    +
    +##### Example 1
    --- End diff --
    
    Make it clear in these examples what Cordova CLI command is being run. Instead of calling these Example 1 and Example 2, give them more descriptive headers. A person scrolling through the page should be able to find what they are looking for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by sarangan12 <gi...@git.apache.org>.
Github user sarangan12 commented on the pull request:

    https://github.com/apache/cordova-docs/pull/489#issuecomment-187329824
  
    @nikhilkh @axemclion @rakatyal @dblotsky @riknoll Fixed previous comments/feedback. Can you please review and merge this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52066234
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,28 +307,51 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +
    +
    +
     __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    +------------------------------|--------------------------------------------
    +CORDOVA_VERSION               | The version of the Cordova-CLI.
    +CORDOVA_PLATFORMS             | Comma separated list of platforms that the command applies to (e.g.: android, ios).
    +CORDOVA_PLUGINS               | Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    --- End diff --
    
    cordova-plugin-file-transfer, cordova-plugin-file


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-docs/pull/489


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by dblotsky <gi...@git.apache.org>.
Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r53728075
  
    --- Diff: www/static/css-src/_docs.scss ---
    @@ -204,6 +204,23 @@
             }
         }
     
    +    .hooks {
    +        td[data-col="description"] {
    +            text-align: left;
    +            vertical-align: middle;
    +        }
    +
    +        td[rowspan="2"], th[colspan="3"], td[data-col="code"] {
    +            text-align: center;
    +            vertical-align: middle;
    +        }
    +
    +        td[data-col="description"] {
    --- End diff --
    
    These should be classes instead of content-specific selectors. Sorry I missed this before this got merged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r53698963
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -178,30 +326,44 @@ module.exports = function(context) {
     `context.opts.plugin` object will only be passed to plugin hooks scripts.
     
     You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
    +
     ```javascript
     var Q = context.requireCordovaModule('q');
     ```
     
    -__Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
    +You can make your scipts async using Q:
    +
    +```javascript
    +module.exports = function(context) {
    +    var Q = context.requireCordovaModule('q');
    +    var deferral = new Q.defer();
    +
    +    setTimeout(function(){
    +      console.log('hook.js>> end');
    +    deferral.resolve();
    +    }, 1000);
    +
    +    return deferral.promise;
    +}
    +```
    +> __Note__:  new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
     For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
     
     ### Non-javascript
     
    -__Note__: we highly recommend writing your hooks using Node.js so that they are cross-platform, see 'Javascript' section above.
    -
     Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
     
    -* CORDOVA_VERSION - The version of the Cordova-CLI.
    -* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
    -* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
    -* CORDOVA_HOOK - Path to the hook that is being executed.
    -* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
    +Environment Variable Name     | Description
    +------------------------------|--------------------------------------------
    +CORDOVA_VERSION               | The version of the Cordova-CLI.
    +CORDOVA_PLATFORMS             | Comma separated list of platforms that the command applies to (e.g.: android, ios).
    +CORDOVA_PLUGINS               | Comma separated list of plugin IDs that the command applies to (e.g.: cordova-plugin-file-transfer, cordova-plugin-file)
    --- End diff --
    
    . at end of each descriptions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-docs pull request: CB-10353: Make Hooks guide a reference

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/489#discussion_r52064153
  
    --- Diff: www/docs/en/dev/guide/appdev/hooks/index.md ---
    @@ -22,61 +22,191 @@ title: Hooks Guide
     
     # Hooks Guide
     
    +## Introduction
    +
     Cordova Hooks represent special scripts which could be added by application and
     plugin developers or even by your own build system  to customize cordova commands.
    -Hook scripts could be defined by adding them to the special predefined folder 
    -(`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run
    -serially in the following order:
    -
    -* Application hooks from `/hooks`;
    -* Application hooks from `config.xml`;
    -* Plugin hooks from `plugins/.../plugin.xml`.
     
    -__Note__: `/hooks` directory is considered deprecated in favor of the hook elements
    -in config.xml and plugin.xml.
    -
    -## Supported hook types
    -The following hook types are supported:
    -
    -    after_build
    -    after_compile
    -    after_clean
    -    after_docs
    -    after_emulate
    -    after_platform_add
    -    after_platform_rm
    -    after_platform_ls
    -    after_plugin_add
    -    after_plugin_ls
    -    after_plugin_rm
    -    after_plugin_search
    -    after_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    after_prepare
    -    after_run
    -    after_serve
    -    before_build
    -    before_clean
    -    before_compile
    -    before_docs
    -    before_emulate
    -    before_platform_add
    -    before_platform_rm/
    -    before_platform_ls
    -    before_plugin_add
    -    before_plugin_ls
    -    before_plugin_rm
    -    before_plugin_search/
    -    before_plugin_install // Plugin hooks in plugin.xml are executed for a plugin being installed only
    -    before_plugin_uninstall // Plugin hooks in plugin.xml are executed for a plugin being uninstalled only
    -    before_prepare
    -    before_run
    -    before_serve
    -    pre_package // Windows and Windows Phone only
    +There may be special activities that you would like to perform before invoking 
    --- End diff --
    
    Consider saying 'Cordova hooks allow you to perform special activities around cordova commands'. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org