You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by omefire <gi...@git.apache.org> on 2015/03/04 07:54:22 UTC

[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

GitHub user omefire opened a pull request:

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

    CB-8596 Expose APIs to retrieve platforms and plugins saved in config.xml

    CB-8596 Expose APIs to retrieve platforms and plugins saved in config.xml  so as to abstract clients away from the config.xml details.


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

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

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

    https://github.com/apache/cordova-lib/pull/177.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 #177
    
----
commit d7d5e5b89d014f0f038263b612486d07facb3ef7
Author: Omar Mefire <om...@microsoft.com>
Date:   2015-03-03T22:42:59Z

    CB-8596 Expose APIs to retrieve platforms and plugins saved in config.xml  so as to abstract clients away from the config.xml details.
    	After migrating platforms & plugins to package.json, This implementation will be updated, but clients will remain stable.

commit cbebb6785616119e82cd5dd3cd885fab806ec2ce
Author: Omar Mefire <om...@microsoft.com>
Date:   2015-03-04T06:52:14Z

    CB-8596 Cleaning up

----


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r26150341
  
    --- Diff: cordova-lib/spec-cordova/project-metadata-apis.spec.js ---
    @@ -0,0 +1,85 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova = require('../src/cordova/cordova'),
    +    helpers = require('./helpers'),
    +    shell   = require('shelljs'),
    +    path    = require('path');
    +
    +describe('retrieval of project metadata', function(){
    +
    +    var appId = 'org.testing';
    +    var appName = 'ProjectMetadataRetrievalTests';
    +
    +    var configNormal = {
    +        lib: {
    +            www: {
    +                url: path.join(__dirname, 'fixtures', 'base', 'www'),
    +                version: 'testProjectMetadataRetrieval',
    +                id: appName
    +            }
    +        }
    +    };
    +
    +    var tmpDir = helpers.tmpDir('project_metadata_test');
    +    var projectRoot = path.join(tmpDir, appName);
    +
    +    beforeEach(function(){
    +        shell.rm('-rf', tmpDir);
    +        shell.rm('-rf', projectRoot);
    +        shell.mkdir('-p', tmpDir);
    +    });
    +
    +    afterEach(function() {
    +        process.chdir(path.join(__dirname, '..'));  // Windows: Needed to rm the dir on Windows.
    +        shell.rm('-rf', tmpDir);
    +    });
    +    
    +    it('retrieve platforms and plugins saved in config.xml', function(done){
    +        var devicePlugin = 'org.apache.cordova.device@0.2.11'; 
    --- End diff --
    
    Wonder if you need to add test case for git url being specified?


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-77117803
  
    hmmm, the build failure is something that seem to happen randomly.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r25831932
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,60 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +// Returns all the platforms that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +// Returns all the plugins that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    +// ToDO: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlugins(projectRoot){
    --- End diff --
    
    Should we return promises from an API? This couples our implementation with Q. We should ideally return the data itself and document the shape of the data rather than return a Q based promise


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r25831848
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,60 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +// Returns all the platforms that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +// Returns all the plugins that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    --- End diff --
    
    Consider using JSDoc comments. It's got good syntax and structure to specify return values and types.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-78115338
  
    I noticed that the plugin metadata that is exposed is the id and version number. What if the source is a git URL - how is that exposed?


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-77107166
  
    After migrating platforms & plugins to package.json, This implementation will be updated, but clients will remain unchanged.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-86994521
  
    Yes, #191 subsumes this PR. I believe @omefire is on vacation and he will be able to close this when he's back.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-77288127
  
    Looks like your new tests are timing out and you might need to increase the timeout value.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r25840412
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,60 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +// Returns all the platforms that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +// Returns all the plugins that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    +// ToDO: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlugins(projectRoot){
    --- End diff --
    
    Ah..in that case it makes sense to remain consistent and return Q. Is this API documented? JSDoc comments are easier to read and serve as good documentation.
    
    
    From: Omar Mefire [mailto:notifications@github.com]
    Sent: Wednesday, March 4, 2015 8:50 PM
    To: apache/cordova-lib
    Cc: Nikhil Khandelwal
    Subject: Re: [cordova-lib] CB-8596 Expose APIs to retrieve platforms and plugins saved in config.xml (#177)
    
    
    In cordova-lib/src/cordova/project_metadata.js<https://github.com/apache/cordova-lib/pull/177#discussion_r25839537>:
    
    > +    ConfigParser = require('../configparser/ConfigParser'),
    
    > +    Q            = require('q');
    
    > +
    
    > +// Returns all the platforms that are currently saved into config.xml
    
    > +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    
    > +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    
    > +function getPlatforms(projectRoot){
    
    > +    var xml = cordova_util.projectConfig(projectRoot);
    
    > +    var cfg = new ConfigParser(xml);
    
    > +    return Q(cfg.getEngines());
    
    > +}
    
    > +
    
    > +// Returns all the plugins that are currently saved into config.xml
    
    > +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    
    > +// ToDO: Once we move to npm, this function should be updated to rely on npm instead
    
    > +function getPlugins(projectRoot){
    
    valid point! however, we already return promises with all our other APIs.
    
    —
    Reply to this email directly or view it on GitHub<https://github.com/apache/cordova-lib/pull/177/files#r25839537>.



---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r26152050
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,64 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +/** Returns all the platforms that are currently saved into config.xml
    + *  @return Promise<{{name: string, version: string}[]}> A promise to the list of {name: platformName, version: platformVersion} objects
    + *  e.g: [ {name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'} ]
    + *  ToDo: Once we move to npm, this function should be updated to rely on npm instead
    + */
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +/** Returns all the plugins that are currently saved into config.xml
    + *  @return Promise<{{name: string, version: string}[]}> A promise to the list of {name: platformName, version: platformVersion} objects
    + *  e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    --- End diff --
    
    This example is confusing and does not match with the comment above.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-86228108
  
    This PR needs to be closed as it is a dup of #191. 


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-77107191
  
    @agrieve , @stevengill  please review.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r26143818
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,60 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +// Returns all the platforms that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +// Returns all the plugins that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    --- End diff --
    
    Thanks for the suggestion. definitely cleaner comments...
    I just pushed cleaner, more readable comments.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r26152048
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,64 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +/** Returns all the platforms that are currently saved into config.xml
    + *  @return Promise<{{name: string, version: string}[]}> A promise to the list of {name: platformName, version: platformVersion} objects
    + *  e.g: [ {name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'} ]
    + *  ToDo: Once we move to npm, this function should be updated to rely on npm instead
    + */
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +/** Returns all the plugins that are currently saved into config.xml
    + *  @return Promise<{{name: string, version: string}[]}> A promise to the list of {name: platformName, version: platformVersion} objects
    --- End diff --
    
    Did you mean to say plugin name or really plugin id - instead of platformName.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/177#discussion_r25839537
  
    --- Diff: cordova-lib/src/cordova/project_metadata.js ---
    @@ -0,0 +1,60 @@
    +/**
    +    Licensed to the Apache Software Foundation (ASF) under one
    +    or more contributor license agreements.  See the NOTICE file
    +    distributed with this work for additional information
    +    regarding copyright ownership.  The ASF licenses this file
    +    to you under the Apache License, Version 2.0 (the
    +    "License"); you may not use this file except in compliance
    +    with the License.  You may obtain a copy of the License at
    +
    +    http://www.apache.org/licenses/LICENSE-2.0
    +
    +    Unless required by applicable law or agreed to in writing,
    +    software distributed under the License is distributed on an
    +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +    KIND, either express or implied.  See the License for the
    +    specific language governing permissions and limitations
    +    under the License.
    +*/
    +
    +var cordova_util = require('./util'),
    +    ConfigParser = require('../configparser/ConfigParser'),
    +    Q            = require('q');
    +
    +// Returns all the platforms that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [{name: 'android', version: '3.5.0'}, {name: 'wp8', version: 'C:/path/to/platform'}, {name: 'ios', version: 'git://...'}]
    +// ToDo: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlatforms(projectRoot){
    +    var xml = cordova_util.projectConfig(projectRoot);
    +    var cfg = new ConfigParser(xml);
    +    return Q(cfg.getEngines());
    +}
    +
    +// Returns all the plugins that are currently saved into config.xml
    +// Return type is a promise that is fulfilled with a list of objects with name and version properties. e.g: [ {id: 'org.apache.cordova.device', name: 'Device', APP_ID: 'my-app-id', APP_NAME: 'my-app-name'} ]
    +// ToDO: Once we move to npm, this function should be updated to rely on npm instead
    +function getPlugins(projectRoot){
    --- End diff --
    
    valid point! however, we already return promises with all our other APIs.


---
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


[GitHub] cordova-lib pull request: CB-8596 Expose APIs to retrieve platform...

Posted by kamrik <gi...@git.apache.org>.
Github user kamrik commented on the pull request:

    https://github.com/apache/cordova-lib/pull/177#issuecomment-86993019
  
    Was this all taken care of with #191 ? 


---
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