[ 
https://issues.apache.org/jira/browse/CB-12705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15984257#comment-15984257
 ] 

ASF GitHub Bot commented on CB-12705:
-------------------------------------

GitHub user feichngr opened a pull request:

    https://github.com/apache/cordova-lib/pull/549

    CB-12705: Pass plugin info to project-level plugin hooks

    ### Platforms affected
    Cordova-cli and maybe plugman
    
    ### What does this PR do?
    Makes sure plugin information is passed to project-level 
`before_plugin_uninstall`, `before_plugin_install`, and `after_plugin_install` 
hooks.
    
    ### What testing has been done on this change?
    Other than modifying the test spec for `HooksRunner.js`, I created a small 
test project with `before_plugin_uninstall`, `before_plugin_install`, and 
`after_plugin_install` js-hooks configured in `config.xml` which print the 
context to console. They now output plugin information just like they do for 
plugin hooks.
    
    ### Checklist
    - [x ] [Reported an 
issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [x] Added automated test coverage as appropriate for this change.


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

    $ git pull https://github.com/feichngr/cordova-lib CB-12705

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

    https://github.com/apache/cordova-lib/pull/549.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 #549
    
----
commit 8be488517419b7beb4d7c6c613012e977684aa50
Author: feichngr <[email protected]>
Date:   2017-04-25T16:16:11Z

    CB-12705: Pass plugin info to project *_plugin_install hooks
    
    Before running runScriptViaModuleLoader context.opts.plugin already 
contains information on the plugin. Modified the function so that the field is 
only overridden if the script comes from a plugin.

commit 7a947c0c874bb7d0c8b6710ffc9dd4248ec79e35
Author: feichngr <[email protected]>
Date:   2017-04-26T05:45:01Z

    CB-12705: Modified (before|after)_plugin_(uninstall|install) to always 
expect existence of plugin field

----


> Project *_plugin_install hooks don't have information on installed plugin
> -------------------------------------------------------------------------
>
>                 Key: CB-12705
>                 URL: https://issues.apache.org/jira/browse/CB-12705
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-cli, CordovaLib
>    Affects Versions: 6.5.0
>            Reporter: Fabian Eichinger
>
> I want to build a {{after_plugin_install}} javascript hook for my project 
> that only executes it logic when installing a specific plugin (in my case 
> {{cordova-plugin-file}}). As it turns out the context passed to project-level 
> {{\*_plugin_install}} hooks do not contain *any* information on the plugin 
> that was installed and this makes these kind of hooks basically useless.
> I propose passing to them the same information in {{context.opts.plugin}} as 
> to plugin hooks.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to