cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omefire <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: Deprecate the old feature syntax from co...
Date Tue, 10 Mar 2015 02:34:35 GMT
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/182#discussion_r26095241
  
    --- Diff: cordova-lib/src/configparser/ConfigParser.js ---
    @@ -279,113 +269,108 @@ ConfigParser.prototype = {
     
             return scriptElements.filter(filterScriptByHookType);
         },
    -
    +   /**
    +    * Returns a list of plugin (IDs)
    +    * @return {string[]} Array of plugin IDs
    +    */
    +    getPluginIdList: function () {
    +        var plugins = this.doc.findall('plugin');
    +        var result = plugins.map(function(plugin){
    +            return plugin.attrib.name;
    +        });
    +        var features = this.doc.findall('feature');
    +        features.forEach(function(element ){
    +            var idTag = element.find('./param[@name="id"]');
    +            if(idTag){
    +                result.push(idTag.attrib.value);
    +            }
    +        });
    +        return result;
    +    },
         /**
    -     * Returns a list of features (IDs)
    -     * @return {string[]} Array of feature IDs
    +     * Adds a plugin element. Does not check for duplicates.
    +     * @name addPlugin
    +     * @function
    +     * @param {object} attributes name, version and src are supported
    +     * @param {Array} variables name, value
          */
    -    getFeatureIdList: function () {
    -        var features = this.doc.findall('feature'),
    -            feature, idTag, id,
    -            result = [];
    -
    -        // Check for valid features that have IDs set
    -        for (var i = 0, l = features.length; i < l; ++i) {
    -            feature = features[i];
    -            idTag = feature.find('./param[@name="id"]');
    -            if (null === idTag) {
    -                // Invalid feature
    -                continue;
    -            }
    -            id = idTag.attrib.value;
    -            if (!!id) {
    -                // Has id and id is non-empty
    -                result.push(id);
    -            }
    +    addPlugin: function(attributes, variables){
    +        if ( !attributes && !attributes.name ) return;
    --- End diff --
    
    Why silently fail here ? shouldn't we throw instead ? the client of this module might
think that everything is fine, when in fact, the changes he planned haven't gone through.


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

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


Mime
View raw message