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

André da Silva Medeiros commented on CB-8457:
---------------------------------------------

How can I now create a hook which needs to know the version provided?

Here's my hook:

#!/usr/bin/env node
module.exports = function(context) {
    var platforms = context.opts.cordova.platforms; // platforms é um array

    platforms.map(function(platform) {
        if(platform.split('@')[0] === 'android' && platform.split('@')[1] !== 
'3.6.3') {
            throw new 
Error('*****************************************************************'+
                            '\n\tPara projetos com a plataforma Android, é 
necessário o package'+
                            ' cordova-android-crosswalk 
(https://www.npmjs.com/package/cordova-android-crosswalk).\n'+
                            '\tPra tanto, é necessário que seja utilizada a 
versão 3.6.3 da plataforma: '+
                            '"cordova platform add [email protected]"\n'+
                            
'*************************************************************************');
        }
    });
};

The goal this thread wants can be accomplished by using similar approach.

> Version specifier causes platform add hook to not run
> -----------------------------------------------------
>
>                 Key: CB-8457
>                 URL: https://issues.apache.org/jira/browse/CB-8457
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>         Environment: OSX 10.10
>            Reporter: Connor Pearson
>
> Using cordova 4.2.0, I have a hook in config.xml defined like this:
> <platform name="ios">
>     <hook type="after_platform_add" src="build/script.rb" />
> </platform>
> Running 'cordova platform add ios' causes this script to be run, but 'cordova 
> platform add [email protected]' does not. If this is intended behavior, how can I set 
> up the hook to run on any platform add of ios?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to