You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/04/08 10:56:12 UTC

[jira] [Commented] (CB-8807) Platform Add fails to add plugins with variables

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

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

GitHub user TimBarham opened a pull request:

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

    CB-8807 Platform Add fails to add plugins with variables.

    When a plugin that uses variables is automatically installed for a new platform, it fails with the following exception:
    
        Installing "[plugin]" for [platform]
        Failed to install '[plugin]':Error: Variable(s) missing: [variables]
            at .../cordova-lib/src/plugman/install.js:299:23
            at ...
    
    The problem here is that we are looking in `config.xml` for information about the plugin's variables, but the plugin is only saved to `config.xml` if it was added with the `--save` flag. This fix updates the logic to look in `fetch.json` instead.
    
    I believe looking in `fetch.json` is the right thing to do here, regardless, for the following reasons:
    
    * `fetch.json` is the one that is guaranteed to be up-to-date.
    * the information we store in `config.xml` is used to restore plugins that have been uninstalled. The information we store in `fetch.json` describes currently installed plugins, which is what we're working with here.
    
    Consider the following scenario:
    
    1. Add a plugin with variables, using the `--save` option. Variable information is saved to `config.xml` and `fetch.json`.
    2. Remove the plugin (with the `--save` option). The variable information is removed from `fetch.json`, but remains in `config.xml`.
    3. Add the plugin again, with different variable values, without the `--save` option. The current variable information is in `fetch.json`, but not in `config.xml`. Also, each platform currently installed will be using the new variable information.
    4. Add a platform. If, when we install the plugin for the new platform, we retrieve the variables from `config.xml`, it will be out of sync with platforms that were already installed.

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

    $ git pull https://github.com/MSOpenTech/cordova-lib CB-8807

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

    https://github.com/apache/cordova-lib/pull/205.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 #205
    
----
commit 5d9d4483ca15b883886ff8cae98f3fd6744a7c99
Author: Tim Barham <ti...@microsoft.com>
Date:   2015-04-07T13:22:46Z

    CB-8807 Platform Add fails to add plugins with variables.
    
    When a plugin that uses variables is automatically installed for a new platform, it fails with the following exception:
    
        Installing "[plugin]" for [platform]
        Failed to install '[plugin]':Error: Variable(s) missing: [variables]
            at .../cordova-lib/src/plugman/install.js:299:23
            at ...
    
    The problem here is that we are looking in config.xml for information about the plugins variables, but the plugin is only saved to config.xml if it was added with the --save flag. This fix updates the logic to look in fetch.json instead.

----


> Platform Add fails to add plugins with variables
> ------------------------------------------------
>
>                 Key: CB-8807
>                 URL: https://issues.apache.org/jira/browse/CB-8807
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>            Reporter: Tim Barham
>            Assignee: Tim Barham
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> *Steps:*
> 1.Create a cordova project
> 2.Add plugin with variables (like the facebook plugin)
> 3.Add android platform 
> *Result:*
> Failed to add plugin with error:
> {noformat}
> Installing "[plugin]" for [platform]
> Failed to install '[plugin]':Error: Variable(s) missing: [variables]
>     at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:299:23
>     at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
>     at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
>     at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
>     at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
>     at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
>     at process._tickCallback (node.js:355:11)
> {noformat}



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

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