[
https://issues.apache.org/jira/browse/CB-6481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056413#comment-14056413
]
ASF GitHub Bot commented on CB-6481:
------------------------------------
GitHub user sgrebnov opened a pull request:
https://github.com/apache/cordova-lib/pull/55
CB-6481 Add unified hooks support for cordova app and plugins
https://issues.apache.org/jira/browse/CB-6481
Added the following changes and new features
* Hooks can be defined in .cordova/hooks/hook_type, hooks/hook_type
directories, **config.xml** (by application developers) and
plugins/.../**plugin.xml** (by plugins developers)
* Javascript hooks retrieved from config.xml and plugins/.../plugin.xml
will be run via new module loader with special **Context argument** passed.
This object represents current hook script execution context including hook
type, cordova version, paths, plugin info and other special utility modules.
* Introduced **before_plugin_install**, **after_plugin_install** and
**before_plugin_uninstall** hooks.
See updated docs for more details:
https://github.com/MSOpenTech/cordova-lib/commit/952690b7d7b42962b4e246c2b84c309846bf8750?short_path=8c918a9#diff-8c918a9f452feb5e3ef3339749806fc3
Please note, that there are some remaining work items here below before we
can merge it. The PR has been sent to get community feedback and adjust
implementation while we are working on unit tests.
* Write unit test (in-progress)
* Replace original Hooker with new implementation everywhere, Currently
'before_build' is supported for general application hooks.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/MSOpenTech/cordova-lib CB-6481-hooks
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-lib/pull/55.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 #55
----
commit d51b5ac509014ccd28351cb5b853cef0a4188358
Author: daserge <[email protected]>
Date: 2014-07-09T12:08:59Z
CB-6481 Added unified hooks support for cordova app and plugins
* Hooks can be defined in .cordova/hooks/hook_type, hooks/hook_type
directories, config.xml and plugins/.../plugin.xml
* Javascript hooks retrieved from config.xml and plugins/.../plugin.xml
will be run via new module loader
* Introduced before_plugin_install, after_plugin_install and
before_plugin_uninstall hooks
commit 952690b7d7b42962b4e246c2b84c309846bf8750
Author: daserge <[email protected]>
Date: 2014-07-09T12:20:11Z
CB-6481 Updated hooks documentation
----
> Add unified hooks support for cordova app and plugins
> -----------------------------------------------------
>
> Key: CB-6481
> URL: https://issues.apache.org/jira/browse/CB-6481
> Project: Apache Cordova
> Issue Type: New Feature
> Components: CLI, Plugman
> Reporter: Sergey Grebnov
> Assignee: Sergey Grebnov
>
> As per "Proposal: hooks support for plugins" dev mail thread discussion
> Hi, I have an idea how we can add more flexibility to plugin developers.
> Note, right now we have Application Developers – someone who use Cordova for
> developing applications and Plugin Developers – someone who creates plugins
> so that Application Developers can use them. For Application Developers we
> expose hooks so that they can customize their build/package/etc process. I
> want us to provide similar sort of flexibility to Plugin Developers so that
> they can go beyond of <source/>, <framework/> tags and get mechanism to add
> custom installation, build logic required by a plugin. Example usage will
> include: downloading/compiling additional binaries, marking source file to be
> copied to output dir, changing target build platform, etc. At present time
> the steps described could be only achieved by hooks manually added by
> Application Developer, but the right way is to allow Plugin Developer to
> expose this as part of plugin definition.
> Example configuration could look like
> ```
> <script type="postinstall" src="scripts/postinstall.js" />
> <script type="preinstall" src="scripts/preinstall.js" />
> <script type="install" src="scripts/install.js" />
> ```
> beforeinstall/preinstall – run before plugin is installed
> install/postinstall/afterinstall – run after plugin is installed
> uninstall – run after plugin is uninstalled
--
This message was sent by Atlassian JIRA
(v6.2#6252)