You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/12/14 07:17:50 UTC

[cordova-lib] branch master updated (349a1e6 -> 7108ad2)

This is an automated email from the ASF dual-hosted git repository.

steven pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git.


    from 349a1e6  CB-13056: fixed tests
     new 33d84dd  CB-13057 : removed save function and updated unit-tests after these changes
     new cb40094  CB-13057 : removed platformsJson from integration tests
     new 7108ad2  CB-13057: updated based on feedback

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 integration-tests/pkgJson-restore.spec.js |  91 ++----------------------
 integration-tests/pkgJson.spec.js         |   8 ---
 spec/cordova/platform/addHelper.spec.js   |  11 ---
 spec/cordova/platform/index.spec.js       |  10 ---
 spec/cordova/platform/list.spec.js        |   2 -
 spec/cordova/platform/remove.spec.js      |  24 -------
 spec/cordova/platform/save.spec.js        |  71 -------------------
 src/cordova/platform/addHelper.js         |   4 --
 src/cordova/platform/index.js             |   5 --
 src/cordova/platform/remove.js            |   2 -
 src/cordova/platform/save.js              |  47 -------------
 src/cordova/platform_metadata.js          | 111 ------------------------------
 12 files changed, 6 insertions(+), 380 deletions(-)
 delete mode 100644 spec/cordova/platform/save.spec.js
 delete mode 100644 src/cordova/platform/save.js
 delete mode 100644 src/cordova/platform_metadata.js

-- 
To stop receiving notification emails like this one, please contact
['"commits@cordova.apache.org" <co...@cordova.apache.org>'].

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


[cordova-lib] 02/03: CB-13057 : removed platformsJson from integration tests

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git

commit cb400949e28e9c4f00fd294451b729c135537b56
Author: Audrey So <au...@apache.org>
AuthorDate: Tue Aug 1 15:07:52 2017 -0700

    CB-13057 : removed platformsJson from integration tests
---
 integration-tests/pkgJson-restore.spec.js | 104 +++++++++++-------------------
 integration-tests/pkgJson.spec.js         |  10 +--
 src/cordova/platform/index.js             |   1 -
 3 files changed, 44 insertions(+), 71 deletions(-)

diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index bd9dc5b..746bf5a 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -140,8 +140,8 @@ describe('tests platform/spec restore with --save', function () {
         var cwd = process.cwd();
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
-        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        var platformsJson;
+        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+        //var platformsJson;
         var configXmlPath = path.join(cwd, 'config.xml');
         var bPlatform = 'browser';
         var engines;
@@ -168,8 +168,8 @@ describe('tests platform/spec restore with --save', function () {
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was added to platforms list successfully.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeDefined();
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //expect(platformsJson[bPlatform]).toBeDefined();
         }).then(function () {
             // Remove platform without --save.
             return cordovaPlatform('rm', bPlatform, {'fetch': true});
@@ -179,8 +179,8 @@ describe('tests platform/spec restore with --save', function () {
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Platform in platforms.json should not be there.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeUndefined();
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //expect(platformsJson[bPlatform]).toBeUndefined();
         }).then(function () {
             // Run cordova prepare
             return prepare({'fetch': true});
@@ -201,8 +201,8 @@ describe('tests platform/spec restore with --save', function () {
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was restored to platform.json list successfully.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeDefined();
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //expect(platformsJson[bPlatform]).toBeDefined();
         }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
@@ -327,9 +327,7 @@ describe('tests platform/spec restore with --save', function () {
         var cwd = process.cwd();
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
-        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        var secondPlatformAdded = 'ios';
-        var platformsJson;
+        var secondPlatformAdded = 'browser';
 
         emptyPlatformList().then(function () {
             // Add 'browser' platform to project without --save
@@ -340,14 +338,12 @@ describe('tests platform/spec restore with --save', function () {
         }).then(function () {
             // Delete any previous caches of require(package.json) and (platformsJson)
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add of only helpers.testPlatform was successful in package.json.
             expect(pkgJson.cordova.platforms).toBeDefined();
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
             expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
             // Expect both platforms to be installed platform list in platforms.json
-            expect(platformsJson['browser']).toBeDefined();
-            expect(platformsJson[secondPlatformAdded]).toBeDefined();
         }).then(fullPlatformList) // Platforms should still be in platform ls.
             .then(function () {
                 // Remove helpers.testPlatform without --save.
@@ -357,23 +353,13 @@ describe('tests platform/spec restore with --save', function () {
                 return cordovaPlatform('rm', secondPlatformAdded);
             }).then(function () {
                 // Delete any previous caches of require(pkgJson) and (platformsJson)
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that the platform that was added with --save is still in package.json.
                 expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
-                // Check that both platforms were removed from the platforms.json.
-                expect(platformsJson[secondPlatformAdded]).toBeUndefined();
-                expect(platformsJson['browser']).toBeUndefined();
             }).then(function () {
                 // Run cordova prepare
                 return prepare({'fetch': true});
-            }).then(function () {
-                // Delete any previous caches of platformsJson
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                // Expect "helpers.testPlatform" to be in the installed platforms list.
-                expect(platformsJson['browser']).toBeDefined();
-                // Expect that 'browser' will not be in platforms.json and has not been restored.
-                expect(platformsJson[secondPlatformAdded]).toBeUndefined();
             }).fail(function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
@@ -1278,9 +1264,9 @@ describe('platforms and plugins should be restored with config.xml even without
         });
         var configEngArray = engNames.slice();
         var configPlugins = cfg1.getPluginIdList();
-        var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
+        //var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
         var pluginsFolderPath16 = path.join(cwd, 'plugins');
-        var platformsJson;
+        //var platformsJson;
         var androidPlatform = 'android';
         var browserPlatform = 'windows';
 
@@ -1304,11 +1290,11 @@ describe('platforms and plugins should be restored with config.xml even without
             configEngArray = engNames.slice();
             expect(configEngArray.length === 2);
             // Delete previouc caches of (pkg.json).
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
             // Browser should be installed
-            expect(platformsJson).toBeDefined();
-            expect(platformsJson[androidPlatform]).not.toBeDefined();
-            expect(platformsJson[browserPlatform]).toBeDefined();
+            //expect(platformsJson).toBeDefined();
+            //expect(platformsJson[androidPlatform]).not.toBeDefined();
+            //expect(platformsJson[browserPlatform]).toBeDefined();
             // Package.json should be auto-created.
             expect(path.join(cwd, 'package.json')).toExist();
             var pkgJsonPath = path.join(cwd, 'package.json');
@@ -1323,10 +1309,10 @@ describe('platforms and plugins should be restored with config.xml even without
             return cordovaPlatform('rm', [browserPlatform]);
         }).then(function () {
             // Android should not be in the installed list (only browser).
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
-            expect(platformsJson).toBeDefined();
-            expect(platformsJson[browserPlatform]).toBeUndefined();
-            expect(platformsJson[androidPlatform]).not.toBeDefined();
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+            //expect(platformsJson).toBeDefined();
+            //expect(platformsJson[browserPlatform]).toBeUndefined();
+            //expect(platformsJson[androidPlatform]).not.toBeDefined();
         }).then(function () {
             // Run cordova prepare.
             return prepare({'fetch': true});
@@ -1342,9 +1328,9 @@ describe('platforms and plugins should be restored with config.xml even without
             expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
             expect(configEngArray.length === 2);
             // Expect that android and browser were restored.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
-            expect(platformsJson[androidPlatform]).toBeDefined();
-            expect(platformsJson[browserPlatform]).toBeDefined();
+            // platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+            // expect(platformsJson[androidPlatform]).toBeDefined();
+            // expect(platformsJson[browserPlatform]).toBeDefined();
         }).then(function () {
             // Check plugins.
             var cfg5 = new ConfigParser(configXmlPath);
@@ -1435,8 +1421,8 @@ describe('tests platform/spec restore with --save', function () {
         var pkgJsonPath = path.join(cwd, 'package.json');
         cordova_util.requireNoCache(pkgJsonPath);
         var pkgJson;
-        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        var platformsJson;
+        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+        //var platformsJson;
 
         emptyPlatformList().then(function () {
             // Add the testing platform with --save.
@@ -1444,33 +1430,23 @@ describe('tests platform/spec restore with --save', function () {
         }).then(function () {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Require platformsFolderPath
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add was successful in package.json.
             expect(pkgJson.cordova.platforms).toBeDefined();
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
-            // Expect that "helpers.testPlatform" in the installed platform list in platforms.json
-            expect(platformsJson).toBeDefined();
-            expect(platformsJson['browser']).toBeDefined();
-        }).then() // Platform should still be in platform ls.
             .then(function () {
                 // And now remove helpers.testPlatform without --save.
                 return cordovaPlatform('rm', ['browser']);
             }).then(function () {
                 // Delete any previous caches of require(package.json) and (platforms.json)
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that the platform removed without --save is still in platforms key.
                 expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
                 // Check that the platform was removed from the platforms.json
-                expect(platformsJson['browser']).toBeUndefined();
             }).then(function () {
                 // Run cordova prepare.
                 return prepare({'fetch': true});
-            }).then(function () {
-                // Delete any previous caches of platforms.json.
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                // Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json.
-                expect(platformsJson['browser']).toBeDefined();
             }).fail(function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
@@ -1486,9 +1462,7 @@ describe('tests platform/spec restore with --save', function () {
         var cwd = process.cwd();
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
-        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        var platformsJson;
-        var secondPlatformAdded = 'windows';
+        var secondPlatformAdded = 'browser';
 
         emptyPlatformList().then(function () {
             // Add the testing platform with --save.
@@ -1499,15 +1473,15 @@ describe('tests platform/spec restore with --save', function () {
         }).then(function () {
             // Delete any previous caches of require(package.json) and (platforms.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add of both platforms (to pkg.Json) was successful.
             expect(pkgJson.cordova.platforms).toBeDefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
             expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(1);
             // Expect that "helpers.testPlatform" in the installed platform list in platforms.json.
-            expect(platformsJson).toBeDefined();
-            expect(platformsJson[helpers.testPlatform]).toBeDefined();
-            expect(platformsJson[secondPlatformAdded]).toBeDefined();
+            // expect(platformsJson).toBeDefined();
+            // expect(platformsJson[helpers.testPlatform]).toBeDefined();
+            // expect(platformsJson[secondPlatformAdded]).toBeDefined();
         }).then(fullPlatformList) // Platform should still be in platform ls.
             .then(function () {
                 // Remove helpers.testPlatform with --save.
@@ -1517,24 +1491,24 @@ describe('tests platform/spec restore with --save', function () {
                 return cordovaPlatform('rm', secondPlatformAdded);
             }).then(function () {
                 // Delete any previous caches of require(package.json) and (platformsJson).
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that ONLY the platform removed without --save is still in (pkg.json) platforms key.
                 expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(0);
                 expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
                 // Check that both platforms were removed from the platforms.json list.
-                expect(platformsJson[helpers.testPlatform]).toBeUndefined();
-                expect(platformsJson[secondPlatformAdded]).toBeUndefined();
+                //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
+                //expect(platformsJson[secondPlatformAdded]).toBeUndefined();
             }).then(function () {
                 // Run cordova prepare.
                 return prepare({'fetch': true});
             }).then(function () {
                 // Delete any previous caches of platformsJson.
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 // Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json
-                expect(platformsJson[helpers.testPlatform]).toBeUndefined();
+                //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
                 // Expect 'browser' not to be in platforms.json and has not been restored.
-                expect(platformsJson[secondPlatformAdded]).toBeDefined();
+                //expect(platformsJson[secondPlatformAdded]).toBeDefined();
             }).fail(function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 11ed7da..04ab40b 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -621,7 +621,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
-        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
         var configXmlPath = path.join(cwd, 'config.xml');
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -629,7 +629,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         var engines = cfg.getEngines();
         var engNames;
         var engSpec; // eslint-disable-line no-unused-vars
-        var platformsJson;
+        //var platformsJson;
         var configPlugins = cfg.getPluginIdList();
         var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-splashscreen/package.json');
         var pluginPkgJsonVersion;
@@ -646,7 +646,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
             return cordova.platform('add', [iosPlatform], {'save': true, 'fetch': true});
         }).then(function () {
             // Require platformsFolderPath, ios and spec should be in there.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Delete any previous caches of require(package.json).
             // ios has been added.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -667,14 +667,14 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
                 iosVersion = cordova_util.requireNoCache(iosDirectory);
                 expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
                 // Check that config and platforms.json "satisfy".
-                expect(semver.satisfies(platformsJson[iosPlatform], elem.spec)).toEqual(true);
+                //expect(semver.satisfies(platformsJson[iosPlatform], elem.spec)).toEqual(true);
             });
             // Config.xml added ios platform.
             expect(engNames).toEqual([ 'ios' ]);
             // Check that pkg.json and ios/cordova/version versions "satisfy" each other.
             expect(semver.satisfies(iosVersion.version, pkgJson.dependencies['cordova-ios'])).toEqual(true);
             // Check that pkg.json and platforms.json "satisfy".
-            expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
+            //expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
         }).then(function () {
             // Add splashscreen plugin with --save --fetch.
             return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save': true, 'fetch': true});
diff --git a/src/cordova/platform/index.js b/src/cordova/platform/index.js
index 65a94b9..233a8df 100644
--- a/src/cordova/platform/index.js
+++ b/src/cordova/platform/index.js
@@ -21,7 +21,6 @@ var HooksRunner = require('../../hooks/HooksRunner');
 var CordovaError = require('cordova-common').CordovaError;
 var platforms = require('../../platforms/platforms');
 var addHelper = require('./addHelper');
-var events = require('cordova-common').events;
 
 module.exports = platform;
 

-- 
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.

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


[cordova-lib] 03/03: CB-13057: updated based on feedback

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git

commit 7108ad25d885f62df6a9b745beeb09de49d7074b
Author: Audrey So <au...@apache.org>
AuthorDate: Mon Dec 11 16:54:43 2017 -0800

    CB-13057: updated based on feedback
    
     This closes #586
---
 integration-tests/pkgJson-restore.spec.js |  65 ++---------------
 integration-tests/pkgJson.spec.js         |   8 ---
 spec/cordova/platform/addHelper.spec.js   |  11 ---
 spec/cordova/platform/index.spec.js       |  10 ---
 spec/cordova/platform/list.spec.js        |   2 -
 spec/cordova/platform/remove.spec.js      |  24 -------
 spec/cordova/platform/save.spec.js        |  71 -------------------
 src/cordova/platform/addHelper.js         |   1 -
 src/cordova/platform/index.js             |   3 -
 src/cordova/platform/remove.js            |   2 -
 src/cordova/platform/save.js              |  49 -------------
 src/cordova/platform_metadata.js          | 111 ------------------------------
 12 files changed, 6 insertions(+), 351 deletions(-)

diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index 746bf5a..d208cd5 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -140,8 +140,6 @@ describe('tests platform/spec restore with --save', function () {
         var cwd = process.cwd();
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
-        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        //var platformsJson;
         var configXmlPath = path.join(cwd, 'config.xml');
         var bPlatform = 'browser';
         var engines;
@@ -167,9 +165,6 @@ describe('tests platform/spec restore with --save', function () {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
-            // Check that platform was added to platforms list successfully.
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            //expect(platformsJson[bPlatform]).toBeDefined();
         }).then(function () {
             // Remove platform without --save.
             return cordovaPlatform('rm', bPlatform, {'fetch': true});
@@ -178,9 +173,6 @@ describe('tests platform/spec restore with --save', function () {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
-            // Platform in platforms.json should not be there.
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            //expect(platformsJson[bPlatform]).toBeUndefined();
         }).then(function () {
             // Run cordova prepare
             return prepare({'fetch': true});
@@ -200,9 +192,6 @@ describe('tests platform/spec restore with --save', function () {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
             expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
-            // Check that platform was restored to platform.json list successfully.
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            //expect(platformsJson[bPlatform]).toBeDefined();
         }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
@@ -327,7 +316,7 @@ describe('tests platform/spec restore with --save', function () {
         var cwd = process.cwd();
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
-        var secondPlatformAdded = 'browser';
+        var secondPlatformAdded = 'ios';
 
         emptyPlatformList().then(function () {
             // Add 'browser' platform to project without --save
@@ -338,12 +327,10 @@ describe('tests platform/spec restore with --save', function () {
         }).then(function () {
             // Delete any previous caches of require(package.json) and (platformsJson)
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add of only helpers.testPlatform was successful in package.json.
             expect(pkgJson.cordova.platforms).toBeDefined();
             expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
             expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
-            // Expect both platforms to be installed platform list in platforms.json
         }).then(fullPlatformList) // Platforms should still be in platform ls.
             .then(function () {
                 // Remove helpers.testPlatform without --save.
@@ -353,7 +340,6 @@ describe('tests platform/spec restore with --save', function () {
                 return cordovaPlatform('rm', secondPlatformAdded);
             }).then(function () {
                 // Delete any previous caches of require(pkgJson) and (platformsJson)
-                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that the platform that was added with --save is still in package.json.
                 expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
@@ -1264,9 +1250,7 @@ describe('platforms and plugins should be restored with config.xml even without
         });
         var configEngArray = engNames.slice();
         var configPlugins = cfg1.getPluginIdList();
-        //var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
         var pluginsFolderPath16 = path.join(cwd, 'plugins');
-        //var platformsJson;
         var androidPlatform = 'android';
         var browserPlatform = 'windows';
 
@@ -1289,12 +1273,6 @@ describe('platforms and plugins should be restored with config.xml even without
             });
             configEngArray = engNames.slice();
             expect(configEngArray.length === 2);
-            // Delete previouc caches of (pkg.json).
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
-            // Browser should be installed
-            //expect(platformsJson).toBeDefined();
-            //expect(platformsJson[androidPlatform]).not.toBeDefined();
-            //expect(platformsJson[browserPlatform]).toBeDefined();
             // Package.json should be auto-created.
             expect(path.join(cwd, 'package.json')).toExist();
             var pkgJsonPath = path.join(cwd, 'package.json');
@@ -1308,12 +1286,6 @@ describe('platforms and plugins should be restored with config.xml even without
             // Remove android without --save.
             return cordovaPlatform('rm', [browserPlatform]);
         }).then(function () {
-            // Android should not be in the installed list (only browser).
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
-            //expect(platformsJson).toBeDefined();
-            //expect(platformsJson[browserPlatform]).toBeUndefined();
-            //expect(platformsJson[androidPlatform]).not.toBeDefined();
-        }).then(function () {
             // Run cordova prepare.
             return prepare({'fetch': true});
         }).then(function () {
@@ -1327,10 +1299,6 @@ describe('platforms and plugins should be restored with config.xml even without
             expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
             expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
             expect(configEngArray.length === 2);
-            // Expect that android and browser were restored.
-            // platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
-            // expect(platformsJson[androidPlatform]).toBeDefined();
-            // expect(platformsJson[browserPlatform]).toBeDefined();
         }).then(function () {
             // Check plugins.
             var cfg5 = new ConfigParser(configXmlPath);
@@ -1421,29 +1389,24 @@ describe('tests platform/spec restore with --save', function () {
         var pkgJsonPath = path.join(cwd, 'package.json');
         cordova_util.requireNoCache(pkgJsonPath);
         var pkgJson;
-        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-        //var platformsJson;
 
         emptyPlatformList().then(function () {
             // Add the testing platform with --save.
-            return cordovaPlatform('add', 'browser', {'save': true, 'fetch': true});
+            return cordovaPlatform('add', 'android', {'save': true, 'fetch': true});
         }).then(function () {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Require platformsFolderPath
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add was successful in package.json.
             expect(pkgJson.cordova.platforms).toBeDefined();
-            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+        }).then(fullPlatformList) // Platform should still be in platform ls.
             .then(function () {
                 // And now remove helpers.testPlatform without --save.
                 return cordovaPlatform('rm', ['browser']);
             }).then(function () {
                 // Delete any previous caches of require(package.json) and (platforms.json)
-                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that the platform removed without --save is still in platforms key.
-                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
-                // Check that the platform was removed from the platforms.json
+                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
             }).then(function () {
                 // Run cordova prepare.
                 return prepare({'fetch': true});
@@ -1473,15 +1436,10 @@ describe('tests platform/spec restore with --save', function () {
         }).then(function () {
             // Delete any previous caches of require(package.json) and (platforms.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add of both platforms (to pkg.Json) was successful.
             expect(pkgJson.cordova.platforms).toBeDefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
             expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(1);
-            // Expect that "helpers.testPlatform" in the installed platform list in platforms.json.
-            // expect(platformsJson).toBeDefined();
-            // expect(platformsJson[helpers.testPlatform]).toBeDefined();
-            // expect(platformsJson[secondPlatformAdded]).toBeDefined();
         }).then(fullPlatformList) // Platform should still be in platform ls.
             .then(function () {
                 // Remove helpers.testPlatform with --save.
@@ -1490,25 +1448,14 @@ describe('tests platform/spec restore with --save', function () {
                 // Remove secondPlatformAdded without --save.
                 return cordovaPlatform('rm', secondPlatformAdded);
             }).then(function () {
-                // Delete any previous caches of require(package.json) and (platformsJson).
-                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                // Delete any previous caches of require(package.json)
                 pkgJson = cordova_util.requireNoCache(pkgJsonPath);
                 // Check that ONLY the platform removed without --save is still in (pkg.json) platforms key.
                 expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(0);
                 expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
-                // Check that both platforms were removed from the platforms.json list.
-                //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
-                //expect(platformsJson[secondPlatformAdded]).toBeUndefined();
             }).then(function () {
                 // Run cordova prepare.
                 return prepare({'fetch': true});
-            }).then(function () {
-                // Delete any previous caches of platformsJson.
-                //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                // Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json
-                //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
-                // Expect 'browser' not to be in platforms.json and has not been restored.
-                //expect(platformsJson[secondPlatformAdded]).toBeDefined();
             }).fail(function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 04ab40b..1a4168b 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -621,7 +621,6 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
-        //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
         var configXmlPath = path.join(cwd, 'config.xml');
         var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -629,7 +628,6 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         var engines = cfg.getEngines();
         var engNames;
         var engSpec; // eslint-disable-line no-unused-vars
-        //var platformsJson;
         var configPlugins = cfg.getPluginIdList();
         var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-splashscreen/package.json');
         var pluginPkgJsonVersion;
@@ -645,8 +643,6 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
             // Add ios with --save and --fetch.
             return cordova.platform('add', [iosPlatform], {'save': true, 'fetch': true});
         }).then(function () {
-            // Require platformsFolderPath, ios and spec should be in there.
-            //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Delete any previous caches of require(package.json).
             // ios has been added.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -666,15 +662,11 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
                 // Check that config and ios/cordova/version versions "satify" each other.
                 iosVersion = cordova_util.requireNoCache(iosDirectory);
                 expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
-                // Check that config and platforms.json "satisfy".
-                //expect(semver.satisfies(platformsJson[iosPlatform], elem.spec)).toEqual(true);
             });
             // Config.xml added ios platform.
             expect(engNames).toEqual([ 'ios' ]);
             // Check that pkg.json and ios/cordova/version versions "satisfy" each other.
             expect(semver.satisfies(iosVersion.version, pkgJson.dependencies['cordova-ios'])).toEqual(true);
-            // Check that pkg.json and platforms.json "satisfy".
-            //expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
         }).then(function () {
             // Add splashscreen plugin with --save --fetch.
             return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save': true, 'fetch': true});
diff --git a/spec/cordova/platform/addHelper.spec.js b/spec/cordova/platform/addHelper.spec.js
index 09c1adf..ce76078 100644
--- a/spec/cordova/platform/addHelper.spec.js
+++ b/spec/cordova/platform/addHelper.spec.js
@@ -24,7 +24,6 @@ var events = require('cordova-common').events;
 var rewire = require('rewire');
 var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
 var platform_module = require('../../../src/cordova/platform');
-// var platform_metadata = require('../../../src/cordova/platform_metadata');
 var cordova_util = require('../../../src/cordova/util');
 var cordova_config = require('../../../src/cordova/config');
 var plugman = require('../../../src/plugman/plugman');
@@ -88,7 +87,6 @@ describe('cordova/platform/addHelper', function () {
         platform_api_mock.createPlatform.and.returnValue(Q());
         platform_api_mock.updatePlatform.and.returnValue(Q());
         spyOn(cordova_util, 'getPlatformApiFunction').and.returnValue(platform_api_mock);
-        // spyOn(platform_metadata, 'save');
         spyOn(cordova_util, 'requireNoCache').and.returnValue({});
     });
     afterEach(function () {
@@ -254,15 +252,6 @@ describe('cordova/platform/addHelper', function () {
                 }).done(done);
             });
 
-            // it('should save the platform metadata', function (done) {
-            //     platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring: true}).then(function (result) {
-            //         expect(platform_metadata.save).toHaveBeenCalledWith('/some/path', 'atari', undefined);
-            //     }).fail(function (err) {
-            //         fail('unexpected failure handler invoked!');
-            //         console.error(err);
-            //     }).done(done);
-            // });
-
             it('should write out the version of platform just added/updated to config.xml if the save option is provided', function (done) {
                 platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring: true}).then(function (result) {
                     expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
diff --git a/spec/cordova/platform/index.spec.js b/spec/cordova/platform/index.spec.js
index 2bd3c27..f15340a 100644
--- a/spec/cordova/platform/index.spec.js
+++ b/spec/cordova/platform/index.spec.js
@@ -137,16 +137,6 @@ describe('cordova/platform', function () {
                         fail('did not expect fail handler to be invoked');
                     }).done(done);
             });
-            // it('should direct `save` commands to the `save` method/module', function (done) {
-            //     spyOn(platform, 'save').and.returnValue(true);
-            //     platform('save', ['android'])
-            //         .then(function () {
-            //             expect(platform.save).toHaveBeenCalled();
-            //         }).fail(function (e) {
-            //             expect(e).toBeUndefined();
-            //             fail('did not expect fail handler to be invoked');
-            //         }).done(done);
-            // });
             it('should direct `list`, all other commands and no command at all to the `list` method/module', function (done) {
                 spyOn(platform, 'list').and.returnValue(true);
                 // test the `list` command directly
diff --git a/spec/cordova/platform/list.spec.js b/spec/cordova/platform/list.spec.js
index 3d17d79..c704fa4 100644
--- a/spec/cordova/platform/list.spec.js
+++ b/spec/cordova/platform/list.spec.js
@@ -18,7 +18,6 @@
 var events = require('cordova-common').events;
 var Q = require('q');
 var platform_list = require('../../../src/cordova/platform/list');
-var platform_metadata = require('../../../src/cordova/platform_metadata');
 var cordova_util = require('../../../src/cordova/util');
 var fail;
 
@@ -31,7 +30,6 @@ describe('cordova/platform/list', function () {
         hooks_mock.fire.and.returnValue(Q());
         spyOn(cordova_util, 'getInstalledPlatformsWithVersions').and.callThrough();
         spyOn(events, 'emit');
-        spyOn(platform_metadata, 'save');
         spyOn(cordova_util, 'requireNoCache').and.returnValue({});
     });
 
diff --git a/spec/cordova/platform/remove.spec.js b/spec/cordova/platform/remove.spec.js
index 82c01d0..9f42fe8 100644
--- a/spec/cordova/platform/remove.spec.js
+++ b/spec/cordova/platform/remove.spec.js
@@ -21,7 +21,6 @@ var Q = require('q');
 var events = require('cordova-common').events;
 var rewire = require('rewire');
 var platform_remove = rewire('../../../src/cordova/platform/remove');
-// var platform_metadata = require('../../../src/cordova/platform_metadata');
 var cordova_util = require('../../../src/cordova/util');
 var promiseutil = require('../../../src/util/promise-util');
 var fail;
@@ -113,29 +112,6 @@ describe('cordova/platform/remove', function () {
                 }).done(done);
         });
 
-        // it('should only remove from platforms.json', function (done) {
-        //     spyOn(platform_metadata, 'remove').and.callThrough();
-        //     package_json_mock.cordova = {'platforms': ['atari']};
-        //     cordova_util.requireNoCache.and.returnValue(package_json_mock);
-        //     fs.existsSync.and.callFake(function (filePath) {
-        //         if (path.basename(filePath) === 'package.json') {
-        //             return true;
-        //         } else {
-        //             return false;
-        //         }
-        //     });
-        //     platform_remove(hooks_mock, projectRoot, ['atari'], {save: false})
-        //         .then(function () {
-        //             expect(fs.writeFileSync).not.toHaveBeenCalled();
-        //             expect(cfg_parser_mock.prototype.write).not.toHaveBeenCalled();
-        //             expect(platform_metadata.remove).toHaveBeenCalled();
-        //             expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
-        //         }).fail(function (e) {
-        //             fail('fail handler unexpectedly invoked');
-        //             console.error(e);
-        //         }).done(done);
-        // });
-
         it('fetch should be called', function (done) {
             spyOn(promiseutil, 'Q_chainmap').and.returnValue(true);
             platform_remove(hooks_mock, projectRoot, ['atari'], {fetch: true})
diff --git a/spec/cordova/platform/save.spec.js b/spec/cordova/platform/save.spec.js
deleted file mode 100644
index 1a1b53d..0000000
--- a/spec/cordova/platform/save.spec.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
-    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 Q = require('q');
-// var rewire = require('rewire');
-// var platform_save = rewire('../../../src/cordova/platform/save');
-// var platform_metadata = require('../../../src/cordova/platform_metadata');
-// var fail;
-// var semver = require('semver');
-
-// describe('cordova/platform/save', function () {
-//     var hooks_mock;
-//     var projectRoot = '/some/path';
-//     var cfg_parser_mock = function () {};
-//     var cfg_parser_revert_mock;
-
-//     beforeEach(function () {
-//         spyOn(semver, 'valid');
-//         cfg_parser_mock.prototype = jasmine.createSpyObj('config parser mock', ['write', 'removeEngine', 'addEngine', 'getEngines']);
-//         cfg_parser_revert_mock = platform_save.__set__('ConfigParser', cfg_parser_mock);
-//         cfg_parser_mock.prototype.getEngines.and.returnValue(['android']);
-//     });
-
-//     afterEach(function () {
-//         cfg_parser_revert_mock();
-//     });
-
-//     it('should first remove platforms already in config.xml', function (done) {
-//         platform_save(hooks_mock, projectRoot, {save: true})
-//             .then(function (res) {
-//                 expect(cfg_parser_mock.prototype.getEngines).toHaveBeenCalled();
-//                 expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
-//             }).fail(function (err) {
-//                 fail('unexpected failure handler invoked!');
-//                 console.error(err);
-//             }).done(done);
-//     });
-
-//     it('add and write to config.xml', function (done) {
-//         spyOn(platform_metadata, 'getPlatformVersions').and.returnValue(Q([{platform: 'android', version: '6.3.0'}]));
-//         semver.valid.and.returnValue('6.0.0');
-//         platform_save(hooks_mock, projectRoot, {save: true})
-//             .then(function (result) {
-//                 expect(cfg_parser_mock.prototype.addEngine).toHaveBeenCalledWith('android', '~6.0.0');
-//                 expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
-//             }).fail(function (err) {
-//                 fail('unexpected failure handler invoked!');
-//                 console.error(err);
-//             }).done(done);
-//     });
-
-//     it('should return valid version', function (done) {
-//         platform_save.getSpecString('~5.0.0');
-//         expect(semver.valid).toHaveBeenCalledWith('~5.0.0', true);
-//         done();
-//     });
-// });
diff --git a/src/cordova/platform/addHelper.js b/src/cordova/platform/addHelper.js
index cc466cc..87ff752 100644
--- a/src/cordova/platform/addHelper.js
+++ b/src/cordova/platform/addHelper.js
@@ -221,7 +221,6 @@ function addHelper (cmd, hooksRunner, projectRoot, targets, opts) {
                             // actually installed.
                             var versionToSave = saveVersion ? platDetails.version : spec;
                             events.emit('verbose', 'Saving ' + platform + '@' + versionToSave + ' into platforms.json');
-                            // platformMetadata.save(projectRoot, platform, versionToSave);
 
                             if (opts.save || autosave) {
                                 // Similarly here, we save the source location if that was specified, otherwise the version that
diff --git a/src/cordova/platform/index.js b/src/cordova/platform/index.js
index 233a8df..0562885 100644
--- a/src/cordova/platform/index.js
+++ b/src/cordova/platform/index.js
@@ -33,7 +33,6 @@ module.exports.update = function update (hooksRunner, projectRoot, targets, opts
 module.exports.remove = require('./remove');
 module.exports.check = require('./check');
 module.exports.list = require('./list');
-// module.exports.save = require('./save');
 module.exports.getPlatformDetailsFromDir = require('./getPlatformDetailsFromDir');
 
 // Expose the platform parsers on top of this command
@@ -79,8 +78,6 @@ function platform (command, targets, opts) {
             return module.exports.update(hooksRunner, projectRoot, targets, opts);
         case 'check':
             return module.exports.check(hooksRunner, projectRoot);
-        // case 'save':
-        //     return module.exports.save(hooksRunner, projectRoot, opts);
         default:
             return module.exports.list(hooksRunner, projectRoot, opts);
         }
diff --git a/src/cordova/platform/remove.js b/src/cordova/platform/remove.js
index 4addd5f..1fa5cb4 100644
--- a/src/cordova/platform/remove.js
+++ b/src/cordova/platform/remove.js
@@ -25,7 +25,6 @@ var events = require('cordova-common').events;
 var npmUninstall = require('cordova-fetch').uninstall;
 var cordova_util = require('../util');
 var config = require('../config');
-// var platformMetadata = require('../platform_metadata');
 var promiseutil = require('../../util/promise-util');
 var platforms = require('../../platforms/platforms');
 var detectIndent = require('detect-indent');
@@ -82,7 +81,6 @@ function remove (hooksRunner, projectRoot, targets, opts) {
             // Remove targets from platforms.json.
             targets.forEach(function (target) {
                 events.emit('verbose', 'Removing platform ' + target + ' from platforms.json file...');
-                // platformMetadata.remove(projectRoot, target);
             });
         }).then(function () {
             // Remove from node_modules if it exists and --fetch was used.
diff --git a/src/cordova/platform/save.js b/src/cordova/platform/save.js
deleted file mode 100644
index 758d19d..0000000
--- a/src/cordova/platform/save.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
-    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 semver = require('semver');
-// var cordova_util = require('../util');
-// var ConfigParser = require('cordova-common').ConfigParser;
-// var platformMetadata = require('../platform_metadata');
-
-// module.exports = save;
-// module.exports.getSpecString = getSpecString;
-
-// function save (hooksRunner, projectRoot, opts) {
-//     console.log('in save!');
-//     var xml = cordova_util.projectConfig(projectRoot);
-//     var cfg = new ConfigParser(xml);
-
-//     // First, remove all platforms that are already in config.xml
-//     cfg.getEngines().forEach(function (engine) {
-//         cfg.removeEngine(engine.name);
-//     });
-
-//     // Save installed platforms into config.xml
-//     return platformMetadata.getPlatformVersions(projectRoot).then(function (platformVersions) {
-//         platformVersions.forEach(function (platVer) {
-//             cfg.addEngine(platVer.platform, module.exports.getSpecString(platVer.version));
-//         });
-//         console.log('saving and writing');
-//         cfg.write();
-//     });
-// }
-
-// function getSpecString (spec) {
-//     var validVersion = semver.valid(spec, true);
-//     return validVersion ? '~' + validVersion : spec;
-// }
diff --git a/src/cordova/platform_metadata.js b/src/cordova/platform_metadata.js
deleted file mode 100644
index 24bd088..0000000
--- a/src/cordova/platform_metadata.js
+++ /dev/null
@@ -1,111 +0,0 @@
-// /**
-//     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 path = require('path');
-// var cordova_util = require('./util');
-// var fs = require('fs');
-// var Q = require('q');
-// var child_process = require('child_process');
-
-// function getJson (jsonFile) {
-//     return JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));
-// }
-
-// // Retrieves the platforms and their versions from the platforms.json file
-// // Returns an array of {platform: platform, version: version} ...
-// // ... where version could be '3.4.0', '/path/to/platform' or 'git://...'
-// function getVersions (projectRoot) {
-//     var platformsDir = path.join(projectRoot, 'platforms');
-//     var platformsJsonFile = path.join(platformsDir, 'platforms.json');
-
-//     // If the platforms.json file doesn't exist, retrieve versions from platforms installed on the filesystem...
-//     // ...Note that in this case, we won't be able to know what source(folder, git-url) the platform came from, we'll just use versions
-//     return getPlatVersionsFromFile(platformsJsonFile).fail(function () {
-//         return getPlatVersionsFromFileSystem(projectRoot);
-//     });
-// }
-
-// // Returns a promise
-// function getPlatVersionsFromFile (platformsJsonFile) {
-
-//     var platformData;
-
-//     // Handle 'file not found' exception and stay within the 'promise monad'
-//     try {
-//         platformData = getJson(platformsJsonFile);
-//     } catch (e) {
-//         return Q.reject(e);
-//     }
-
-//     var platformVersions = [];
-
-//     platformVersions = Object.keys(platformData).map(function (p) {
-//         return {platform: p, version: platformData[p]};
-//     });
-
-//     return Q(platformVersions);
-// }
-
-// // Returns a promise
-// function getPlatVersionsFromFileSystem (projectRoot) {
-//     var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
-//     var platformVersions = platforms_on_fs.map(function (platform) {
-//         var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
-//         return Q.ninvoke(child_process, 'exec', script, {}).then(function (result) {
-//             var version = result[0];
-
-//             // clean the version we get back from the script
-//             // This is necessary because the version script uses console.log to pass back
-//             // the version. Using console.log ends up adding additional line breaks/newlines to the value returned.
-//             // ToDO: version scripts should be refactored to not use console.log()
-//             var versionCleaned = version.replace(/\r?\n|\r/g, '');
-//             return {platform: platform, version: versionCleaned};
-//         });
-//     });
-
-//     return Q.all(platformVersions);
-// }
-
-// // Saves platform@version into platforms.json
-// function save (projectRoot, platform, version) {
-//     var platformsDir = path.join(projectRoot, 'platforms');
-//     var platformJsonFile = path.join(platformsDir, 'platforms.json');
-
-//     var data = {};
-//     if (fs.existsSync(platformJsonFile)) {
-//         data = getJson(platformJsonFile);
-//     }
-//     data[platform] = version;
-//     fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
-// }
-
-// function remove (projectRoot, platform) {
-//     var platformsDir = path.join(projectRoot, 'platforms');
-//     var platformJsonFile = path.join(platformsDir, 'platforms.json');
-//     if (!fs.existsSync(platformJsonFile)) {
-//         return;
-//     }
-//     var data = getJson(platformJsonFile);
-//     delete data[platform];
-//     fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
-// }
-
-// module.exports.getPlatformVersions = getVersions;
-// module.exports.save = save;
-// module.exports.remove = remove;

-- 
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.

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


[cordova-lib] 01/03: CB-13057 : removed save function and updated unit-tests after these changes

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git

commit 33d84dd734a47d1d2d9bd85b6e6017b3c59bfbe5
Author: Audrey So <au...@apache.org>
AuthorDate: Tue Aug 1 15:06:41 2017 -0700

    CB-13057 : removed save function and updated unit-tests after these changes
---
 spec/cordova/platform/addHelper.spec.js |  20 +--
 spec/cordova/platform/index.spec.js     |  20 +--
 spec/cordova/platform/remove.spec.js    |  46 +++----
 spec/cordova/platform/save.spec.js      |  96 +++++++-------
 src/cordova/platform/addHelper.js       |   5 +-
 src/cordova/platform/index.js           |   7 +-
 src/cordova/platform/remove.js          |   4 +-
 src/cordova/platform/save.js            |  52 ++++----
 src/cordova/platform_metadata.js        | 222 ++++++++++++++++----------------
 9 files changed, 235 insertions(+), 237 deletions(-)

diff --git a/spec/cordova/platform/addHelper.spec.js b/spec/cordova/platform/addHelper.spec.js
index a2eb6e6..09c1adf 100644
--- a/spec/cordova/platform/addHelper.spec.js
+++ b/spec/cordova/platform/addHelper.spec.js
@@ -24,7 +24,7 @@ var events = require('cordova-common').events;
 var rewire = require('rewire');
 var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
 var platform_module = require('../../../src/cordova/platform');
-var platform_metadata = require('../../../src/cordova/platform_metadata');
+// var platform_metadata = require('../../../src/cordova/platform_metadata');
 var cordova_util = require('../../../src/cordova/util');
 var cordova_config = require('../../../src/cordova/config');
 var plugman = require('../../../src/plugman/plugman');
@@ -88,7 +88,7 @@ describe('cordova/platform/addHelper', function () {
         platform_api_mock.createPlatform.and.returnValue(Q());
         platform_api_mock.updatePlatform.and.returnValue(Q());
         spyOn(cordova_util, 'getPlatformApiFunction').and.returnValue(platform_api_mock);
-        spyOn(platform_metadata, 'save');
+        // spyOn(platform_metadata, 'save');
         spyOn(cordova_util, 'requireNoCache').and.returnValue({});
     });
     afterEach(function () {
@@ -254,14 +254,14 @@ describe('cordova/platform/addHelper', function () {
                 }).done(done);
             });
 
-            it('should save the platform metadata', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring: true}).then(function (result) {
-                    expect(platform_metadata.save).toHaveBeenCalledWith('/some/path', 'atari', undefined);
-                }).fail(function (err) {
-                    fail('unexpected failure handler invoked!');
-                    console.error(err);
-                }).done(done);
-            });
+            // it('should save the platform metadata', function (done) {
+            //     platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring: true}).then(function (result) {
+            //         expect(platform_metadata.save).toHaveBeenCalledWith('/some/path', 'atari', undefined);
+            //     }).fail(function (err) {
+            //         fail('unexpected failure handler invoked!');
+            //         console.error(err);
+            //     }).done(done);
+            // });
 
             it('should write out the version of platform just added/updated to config.xml if the save option is provided', function (done) {
                 platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring: true}).then(function (result) {
diff --git a/spec/cordova/platform/index.spec.js b/spec/cordova/platform/index.spec.js
index 5146902..2bd3c27 100644
--- a/spec/cordova/platform/index.spec.js
+++ b/spec/cordova/platform/index.spec.js
@@ -137,16 +137,16 @@ describe('cordova/platform', function () {
                         fail('did not expect fail handler to be invoked');
                     }).done(done);
             });
-            it('should direct `save` commands to the `save` method/module', function (done) {
-                spyOn(platform, 'save').and.returnValue(true);
-                platform('save', ['android'])
-                    .then(function () {
-                        expect(platform.save).toHaveBeenCalled();
-                    }).fail(function (e) {
-                        expect(e).toBeUndefined();
-                        fail('did not expect fail handler to be invoked');
-                    }).done(done);
-            });
+            // it('should direct `save` commands to the `save` method/module', function (done) {
+            //     spyOn(platform, 'save').and.returnValue(true);
+            //     platform('save', ['android'])
+            //         .then(function () {
+            //             expect(platform.save).toHaveBeenCalled();
+            //         }).fail(function (e) {
+            //             expect(e).toBeUndefined();
+            //             fail('did not expect fail handler to be invoked');
+            //         }).done(done);
+            // });
             it('should direct `list`, all other commands and no command at all to the `list` method/module', function (done) {
                 spyOn(platform, 'list').and.returnValue(true);
                 // test the `list` command directly
diff --git a/spec/cordova/platform/remove.spec.js b/spec/cordova/platform/remove.spec.js
index 9e2e7b3..82c01d0 100644
--- a/spec/cordova/platform/remove.spec.js
+++ b/spec/cordova/platform/remove.spec.js
@@ -21,7 +21,7 @@ var Q = require('q');
 var events = require('cordova-common').events;
 var rewire = require('rewire');
 var platform_remove = rewire('../../../src/cordova/platform/remove');
-var platform_metadata = require('../../../src/cordova/platform_metadata');
+// var platform_metadata = require('../../../src/cordova/platform_metadata');
 var cordova_util = require('../../../src/cordova/util');
 var promiseutil = require('../../../src/util/promise-util');
 var fail;
@@ -113,28 +113,28 @@ describe('cordova/platform/remove', function () {
                 }).done(done);
         });
 
-        it('should only remove from platforms.json', function (done) {
-            spyOn(platform_metadata, 'remove').and.callThrough();
-            package_json_mock.cordova = {'platforms': ['atari']};
-            cordova_util.requireNoCache.and.returnValue(package_json_mock);
-            fs.existsSync.and.callFake(function (filePath) {
-                if (path.basename(filePath) === 'package.json') {
-                    return true;
-                } else {
-                    return false;
-                }
-            });
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save: false})
-                .then(function () {
-                    expect(fs.writeFileSync).not.toHaveBeenCalled();
-                    expect(cfg_parser_mock.prototype.write).not.toHaveBeenCalled();
-                    expect(platform_metadata.remove).toHaveBeenCalled();
-                    expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
-                }).fail(function (e) {
-                    fail('fail handler unexpectedly invoked');
-                    console.error(e);
-                }).done(done);
-        });
+        // it('should only remove from platforms.json', function (done) {
+        //     spyOn(platform_metadata, 'remove').and.callThrough();
+        //     package_json_mock.cordova = {'platforms': ['atari']};
+        //     cordova_util.requireNoCache.and.returnValue(package_json_mock);
+        //     fs.existsSync.and.callFake(function (filePath) {
+        //         if (path.basename(filePath) === 'package.json') {
+        //             return true;
+        //         } else {
+        //             return false;
+        //         }
+        //     });
+        //     platform_remove(hooks_mock, projectRoot, ['atari'], {save: false})
+        //         .then(function () {
+        //             expect(fs.writeFileSync).not.toHaveBeenCalled();
+        //             expect(cfg_parser_mock.prototype.write).not.toHaveBeenCalled();
+        //             expect(platform_metadata.remove).toHaveBeenCalled();
+        //             expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
+        //         }).fail(function (e) {
+        //             fail('fail handler unexpectedly invoked');
+        //             console.error(e);
+        //         }).done(done);
+        // });
 
         it('fetch should be called', function (done) {
             spyOn(promiseutil, 'Q_chainmap').and.returnValue(true);
diff --git a/spec/cordova/platform/save.spec.js b/spec/cordova/platform/save.spec.js
index 4b093f6..1a1b53d 100644
--- a/spec/cordova/platform/save.spec.js
+++ b/spec/cordova/platform/save.spec.js
@@ -15,57 +15,57 @@
     under the License.
 */
 
-var Q = require('q');
-var rewire = require('rewire');
-var platform_save = rewire('../../../src/cordova/platform/save');
-var platform_metadata = require('../../../src/cordova/platform_metadata');
-var fail;
-var semver = require('semver');
+// var Q = require('q');
+// var rewire = require('rewire');
+// var platform_save = rewire('../../../src/cordova/platform/save');
+// var platform_metadata = require('../../../src/cordova/platform_metadata');
+// var fail;
+// var semver = require('semver');
 
-describe('cordova/platform/save', function () {
-    var hooks_mock;
-    var projectRoot = '/some/path';
-    var cfg_parser_mock = function () {};
-    var cfg_parser_revert_mock;
+// describe('cordova/platform/save', function () {
+//     var hooks_mock;
+//     var projectRoot = '/some/path';
+//     var cfg_parser_mock = function () {};
+//     var cfg_parser_revert_mock;
 
-    beforeEach(function () {
-        spyOn(semver, 'valid');
-        cfg_parser_mock.prototype = jasmine.createSpyObj('config parser mock', ['write', 'removeEngine', 'addEngine', 'getEngines']);
-        cfg_parser_revert_mock = platform_save.__set__('ConfigParser', cfg_parser_mock);
-        cfg_parser_mock.prototype.getEngines.and.returnValue(['android']);
-    });
+//     beforeEach(function () {
+//         spyOn(semver, 'valid');
+//         cfg_parser_mock.prototype = jasmine.createSpyObj('config parser mock', ['write', 'removeEngine', 'addEngine', 'getEngines']);
+//         cfg_parser_revert_mock = platform_save.__set__('ConfigParser', cfg_parser_mock);
+//         cfg_parser_mock.prototype.getEngines.and.returnValue(['android']);
+//     });
 
-    afterEach(function () {
-        cfg_parser_revert_mock();
-    });
+//     afterEach(function () {
+//         cfg_parser_revert_mock();
+//     });
 
-    it('should first remove platforms already in config.xml', function (done) {
-        platform_save(hooks_mock, projectRoot, {save: true})
-            .then(function (res) {
-                expect(cfg_parser_mock.prototype.getEngines).toHaveBeenCalled();
-                expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
-            }).fail(function (err) {
-                fail('unexpected failure handler invoked!');
-                console.error(err);
-            }).done(done);
-    });
+//     it('should first remove platforms already in config.xml', function (done) {
+//         platform_save(hooks_mock, projectRoot, {save: true})
+//             .then(function (res) {
+//                 expect(cfg_parser_mock.prototype.getEngines).toHaveBeenCalled();
+//                 expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
+//             }).fail(function (err) {
+//                 fail('unexpected failure handler invoked!');
+//                 console.error(err);
+//             }).done(done);
+//     });
 
-    it('add and write to config.xml', function (done) {
-        spyOn(platform_metadata, 'getPlatformVersions').and.returnValue(Q([{platform: 'android', version: '6.3.0'}]));
-        semver.valid.and.returnValue('6.0.0');
-        platform_save(hooks_mock, projectRoot, {save: true})
-            .then(function (result) {
-                expect(cfg_parser_mock.prototype.addEngine).toHaveBeenCalledWith('android', '~6.0.0');
-                expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
-            }).fail(function (err) {
-                fail('unexpected failure handler invoked!');
-                console.error(err);
-            }).done(done);
-    });
+//     it('add and write to config.xml', function (done) {
+//         spyOn(platform_metadata, 'getPlatformVersions').and.returnValue(Q([{platform: 'android', version: '6.3.0'}]));
+//         semver.valid.and.returnValue('6.0.0');
+//         platform_save(hooks_mock, projectRoot, {save: true})
+//             .then(function (result) {
+//                 expect(cfg_parser_mock.prototype.addEngine).toHaveBeenCalledWith('android', '~6.0.0');
+//                 expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+//             }).fail(function (err) {
+//                 fail('unexpected failure handler invoked!');
+//                 console.error(err);
+//             }).done(done);
+//     });
 
-    it('should return valid version', function (done) {
-        platform_save.getSpecString('~5.0.0');
-        expect(semver.valid).toHaveBeenCalledWith('~5.0.0', true);
-        done();
-    });
-});
+//     it('should return valid version', function (done) {
+//         platform_save.getSpecString('~5.0.0');
+//         expect(semver.valid).toHaveBeenCalledWith('~5.0.0', true);
+//         done();
+//     });
+// });
diff --git a/src/cordova/platform/addHelper.js b/src/cordova/platform/addHelper.js
index f18ad46..cc466cc 100644
--- a/src/cordova/platform/addHelper.js
+++ b/src/cordova/platform/addHelper.js
@@ -27,11 +27,8 @@ var ConfigParser = require('cordova-common').ConfigParser;
 var PlatformJson = require('cordova-common').PlatformJson;
 var events = require('cordova-common').events;
 var cordova_util = require('../util');
-// delete require.cache[require.resolve('../prepare')];
-// var prepare = require('../prepare');
 var promiseutil = require('../../util/promise-util');
 var config = require('../config');
-var platformMetadata = require('../platform_metadata');
 var platforms = require('../../platforms/platforms');
 var detectIndent = require('detect-indent');
 
@@ -224,7 +221,7 @@ function addHelper (cmd, hooksRunner, projectRoot, targets, opts) {
                             // actually installed.
                             var versionToSave = saveVersion ? platDetails.version : spec;
                             events.emit('verbose', 'Saving ' + platform + '@' + versionToSave + ' into platforms.json');
-                            platformMetadata.save(projectRoot, platform, versionToSave);
+                            // platformMetadata.save(projectRoot, platform, versionToSave);
 
                             if (opts.save || autosave) {
                                 // Similarly here, we save the source location if that was specified, otherwise the version that
diff --git a/src/cordova/platform/index.js b/src/cordova/platform/index.js
index c6dfaae..65a94b9 100644
--- a/src/cordova/platform/index.js
+++ b/src/cordova/platform/index.js
@@ -34,7 +34,7 @@ module.exports.update = function update (hooksRunner, projectRoot, targets, opts
 module.exports.remove = require('./remove');
 module.exports.check = require('./check');
 module.exports.list = require('./list');
-module.exports.save = require('./save');
+// module.exports.save = require('./save');
 module.exports.getPlatformDetailsFromDir = require('./getPlatformDetailsFromDir');
 
 // Expose the platform parsers on top of this command
@@ -80,9 +80,8 @@ function platform (command, targets, opts) {
             return module.exports.update(hooksRunner, projectRoot, targets, opts);
         case 'check':
             return module.exports.check(hooksRunner, projectRoot);
-        case 'save':
-            events.emit('warn', 'This command has been deprecated and will be removed in the next major release of cordova.');
-            return module.exports.save(hooksRunner, projectRoot, opts);
+        // case 'save':
+        //     return module.exports.save(hooksRunner, projectRoot, opts);
         default:
             return module.exports.list(hooksRunner, projectRoot, opts);
         }
diff --git a/src/cordova/platform/remove.js b/src/cordova/platform/remove.js
index 7490f32..4addd5f 100644
--- a/src/cordova/platform/remove.js
+++ b/src/cordova/platform/remove.js
@@ -25,7 +25,7 @@ var events = require('cordova-common').events;
 var npmUninstall = require('cordova-fetch').uninstall;
 var cordova_util = require('../util');
 var config = require('../config');
-var platformMetadata = require('../platform_metadata');
+// var platformMetadata = require('../platform_metadata');
 var promiseutil = require('../../util/promise-util');
 var platforms = require('../../platforms/platforms');
 var detectIndent = require('detect-indent');
@@ -82,7 +82,7 @@ function remove (hooksRunner, projectRoot, targets, opts) {
             // Remove targets from platforms.json.
             targets.forEach(function (target) {
                 events.emit('verbose', 'Removing platform ' + target + ' from platforms.json file...');
-                platformMetadata.remove(projectRoot, target);
+                // platformMetadata.remove(projectRoot, target);
             });
         }).then(function () {
             // Remove from node_modules if it exists and --fetch was used.
diff --git a/src/cordova/platform/save.js b/src/cordova/platform/save.js
index 9ba0152..758d19d 100644
--- a/src/cordova/platform/save.js
+++ b/src/cordova/platform/save.js
@@ -15,33 +15,35 @@
     under the License.
 */
 
-var semver = require('semver');
-var cordova_util = require('../util');
-var ConfigParser = require('cordova-common').ConfigParser;
-var platformMetadata = require('../platform_metadata');
+// var semver = require('semver');
+// var cordova_util = require('../util');
+// var ConfigParser = require('cordova-common').ConfigParser;
+// var platformMetadata = require('../platform_metadata');
 
-module.exports = save;
-module.exports.getSpecString = getSpecString;
+// module.exports = save;
+// module.exports.getSpecString = getSpecString;
 
-function save (hooksRunner, projectRoot, opts) {
-    var xml = cordova_util.projectConfig(projectRoot);
-    var cfg = new ConfigParser(xml);
+// function save (hooksRunner, projectRoot, opts) {
+//     console.log('in save!');
+//     var xml = cordova_util.projectConfig(projectRoot);
+//     var cfg = new ConfigParser(xml);
 
-    // First, remove all platforms that are already in config.xml
-    cfg.getEngines().forEach(function (engine) {
-        cfg.removeEngine(engine.name);
-    });
+//     // First, remove all platforms that are already in config.xml
+//     cfg.getEngines().forEach(function (engine) {
+//         cfg.removeEngine(engine.name);
+//     });
 
-    // Save installed platforms into config.xml
-    return platformMetadata.getPlatformVersions(projectRoot).then(function (platformVersions) {
-        platformVersions.forEach(function (platVer) {
-            cfg.addEngine(platVer.platform, module.exports.getSpecString(platVer.version));
-        });
-        cfg.write();
-    });
-}
+//     // Save installed platforms into config.xml
+//     return platformMetadata.getPlatformVersions(projectRoot).then(function (platformVersions) {
+//         platformVersions.forEach(function (platVer) {
+//             cfg.addEngine(platVer.platform, module.exports.getSpecString(platVer.version));
+//         });
+//         console.log('saving and writing');
+//         cfg.write();
+//     });
+// }
 
-function getSpecString (spec) {
-    var validVersion = semver.valid(spec, true);
-    return validVersion ? '~' + validVersion : spec;
-}
+// function getSpecString (spec) {
+//     var validVersion = semver.valid(spec, true);
+//     return validVersion ? '~' + validVersion : spec;
+// }
diff --git a/src/cordova/platform_metadata.js b/src/cordova/platform_metadata.js
index 4dc101d..24bd088 100644
--- a/src/cordova/platform_metadata.js
+++ b/src/cordova/platform_metadata.js
@@ -1,111 +1,111 @@
-/**
-    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 path = require('path');
-var cordova_util = require('./util');
-var fs = require('fs');
-var Q = require('q');
-var child_process = require('child_process');
-
-function getJson (jsonFile) {
-    return JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));
-}
-
-// Retrieves the platforms and their versions from the platforms.json file
-// Returns an array of {platform: platform, version: version} ...
-// ... where version could be '3.4.0', '/path/to/platform' or 'git://...'
-function getVersions (projectRoot) {
-    var platformsDir = path.join(projectRoot, 'platforms');
-    var platformsJsonFile = path.join(platformsDir, 'platforms.json');
-
-    // If the platforms.json file doesn't exist, retrieve versions from platforms installed on the filesystem...
-    // ...Note that in this case, we won't be able to know what source(folder, git-url) the platform came from, we'll just use versions
-    return getPlatVersionsFromFile(platformsJsonFile).fail(function () {
-        return getPlatVersionsFromFileSystem(projectRoot);
-    });
-}
-
-// Returns a promise
-function getPlatVersionsFromFile (platformsJsonFile) {
-
-    var platformData;
-
-    // Handle 'file not found' exception and stay within the 'promise monad'
-    try {
-        platformData = getJson(platformsJsonFile);
-    } catch (e) {
-        return Q.reject(e);
-    }
-
-    var platformVersions = [];
-
-    platformVersions = Object.keys(platformData).map(function (p) {
-        return {platform: p, version: platformData[p]};
-    });
-
-    return Q(platformVersions);
-}
-
-// Returns a promise
-function getPlatVersionsFromFileSystem (projectRoot) {
-    var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
-    var platformVersions = platforms_on_fs.map(function (platform) {
-        var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
-        return Q.ninvoke(child_process, 'exec', script, {}).then(function (result) {
-            var version = result[0];
-
-            // clean the version we get back from the script
-            // This is necessary because the version script uses console.log to pass back
-            // the version. Using console.log ends up adding additional line breaks/newlines to the value returned.
-            // ToDO: version scripts should be refactored to not use console.log()
-            var versionCleaned = version.replace(/\r?\n|\r/g, '');
-            return {platform: platform, version: versionCleaned};
-        });
-    });
-
-    return Q.all(platformVersions);
-}
-
-// Saves platform@version into platforms.json
-function save (projectRoot, platform, version) {
-    var platformsDir = path.join(projectRoot, 'platforms');
-    var platformJsonFile = path.join(platformsDir, 'platforms.json');
-
-    var data = {};
-    if (fs.existsSync(platformJsonFile)) {
-        data = getJson(platformJsonFile);
-    }
-    data[platform] = version;
-    fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
-}
-
-function remove (projectRoot, platform) {
-    var platformsDir = path.join(projectRoot, 'platforms');
-    var platformJsonFile = path.join(platformsDir, 'platforms.json');
-    if (!fs.existsSync(platformJsonFile)) {
-        return;
-    }
-    var data = getJson(platformJsonFile);
-    delete data[platform];
-    fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
-}
-
-module.exports.getPlatformVersions = getVersions;
-module.exports.save = save;
-module.exports.remove = remove;
+// /**
+//     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 path = require('path');
+// var cordova_util = require('./util');
+// var fs = require('fs');
+// var Q = require('q');
+// var child_process = require('child_process');
+
+// function getJson (jsonFile) {
+//     return JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));
+// }
+
+// // Retrieves the platforms and their versions from the platforms.json file
+// // Returns an array of {platform: platform, version: version} ...
+// // ... where version could be '3.4.0', '/path/to/platform' or 'git://...'
+// function getVersions (projectRoot) {
+//     var platformsDir = path.join(projectRoot, 'platforms');
+//     var platformsJsonFile = path.join(platformsDir, 'platforms.json');
+
+//     // If the platforms.json file doesn't exist, retrieve versions from platforms installed on the filesystem...
+//     // ...Note that in this case, we won't be able to know what source(folder, git-url) the platform came from, we'll just use versions
+//     return getPlatVersionsFromFile(platformsJsonFile).fail(function () {
+//         return getPlatVersionsFromFileSystem(projectRoot);
+//     });
+// }
+
+// // Returns a promise
+// function getPlatVersionsFromFile (platformsJsonFile) {
+
+//     var platformData;
+
+//     // Handle 'file not found' exception and stay within the 'promise monad'
+//     try {
+//         platformData = getJson(platformsJsonFile);
+//     } catch (e) {
+//         return Q.reject(e);
+//     }
+
+//     var platformVersions = [];
+
+//     platformVersions = Object.keys(platformData).map(function (p) {
+//         return {platform: p, version: platformData[p]};
+//     });
+
+//     return Q(platformVersions);
+// }
+
+// // Returns a promise
+// function getPlatVersionsFromFileSystem (projectRoot) {
+//     var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
+//     var platformVersions = platforms_on_fs.map(function (platform) {
+//         var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
+//         return Q.ninvoke(child_process, 'exec', script, {}).then(function (result) {
+//             var version = result[0];
+
+//             // clean the version we get back from the script
+//             // This is necessary because the version script uses console.log to pass back
+//             // the version. Using console.log ends up adding additional line breaks/newlines to the value returned.
+//             // ToDO: version scripts should be refactored to not use console.log()
+//             var versionCleaned = version.replace(/\r?\n|\r/g, '');
+//             return {platform: platform, version: versionCleaned};
+//         });
+//     });
+
+//     return Q.all(platformVersions);
+// }
+
+// // Saves platform@version into platforms.json
+// function save (projectRoot, platform, version) {
+//     var platformsDir = path.join(projectRoot, 'platforms');
+//     var platformJsonFile = path.join(platformsDir, 'platforms.json');
+
+//     var data = {};
+//     if (fs.existsSync(platformJsonFile)) {
+//         data = getJson(platformJsonFile);
+//     }
+//     data[platform] = version;
+//     fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
+// }
+
+// function remove (projectRoot, platform) {
+//     var platformsDir = path.join(projectRoot, 'platforms');
+//     var platformJsonFile = path.join(platformsDir, 'platforms.json');
+//     if (!fs.existsSync(platformJsonFile)) {
+//         return;
+//     }
+//     var data = getJson(platformJsonFile);
+//     delete data[platform];
+//     fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
+// }
+
+// module.exports.getPlatformVersions = getVersions;
+// module.exports.save = save;
+// module.exports.remove = remove;

-- 
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.

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