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 <tim.bar...@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.

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to