cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] cordova-lib git commit: CB-4789 refactor: Remove config_changes.get/set_platform_json in favour of PlatformJson
Date Fri, 16 Jan 2015 14:59:19 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 576a11164 -> 36ffb18d9


CB-4789 refactor: Remove config_changes.get/set_platform_json in favour of PlatformJson

Addresses longstanding TODO and makes us one step closer to being able
to change the location of the platform.json files to be within their
respective platforms


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/36ffb18d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/36ffb18d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/36ffb18d

Branch: refs/heads/master
Commit: 36ffb18d97f420d519bf46b83ad5048343b8f6c4
Parents: 800825b
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Jan 15 22:31:31 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Jan 16 09:59:10 2015 -0500

----------------------------------------------------------------------
 cordova-lib/spec-cordova/prepare.spec.js        |  12 +-
 .../spec-plugman/install-browserify.spec.js     |   8 +-
 cordova-lib/spec-plugman/install.spec.js        |   8 +-
 cordova-lib/spec-plugman/prepare.spec.js        |  13 +-
 .../spec-plugman/uninstall-browserify.spec.js   |  10 +-
 cordova-lib/spec-plugman/uninstall.spec.js      |  10 +-
 .../spec-plugman/util/config-changes.spec.js    | 250 ++++++++-----------
 .../spec-plugman/util/dependencies.spec.js      |  12 +-
 cordova-lib/src/cordova/prepare.js              |   7 +-
 cordova-lib/src/cordova/save.js                 |   6 +-
 cordova-lib/src/plugman/install.js              |  25 +-
 cordova-lib/src/plugman/prepare-browserify.js   |  15 +-
 cordova-lib/src/plugman/prepare.js              |  10 +-
 cordova-lib/src/plugman/uninstall.js            |  19 +-
 cordova-lib/src/plugman/util/PlatformJson.js    |  59 +++--
 cordova-lib/src/plugman/util/config-changes.js  |  83 +-----
 cordova-lib/src/plugman/util/dependencies.js    |  13 +-
 17 files changed, 234 insertions(+), 326 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-cordova/prepare.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/prepare.spec.js b/cordova-lib/spec-cordova/prepare.spec.js
index 44d16b2..cb23439 100644
--- a/cordova-lib/spec-cordova/prepare.spec.js
+++ b/cordova-lib/spec-cordova/prepare.spec.js
@@ -19,6 +19,7 @@
 var cordova = require('../src/cordova/cordova'),
     shell = require('shelljs'),
     plugman = require('../src/plugman/plugman'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     path = require('path'),
     fs = require('fs'),
     util = require('../src/cordova/util'),
@@ -63,7 +64,6 @@ describe('prepare command', function() {
         parsers = {},
         plugman_prepare,
         find_plugins,
-        plugman_get_json,
         cp,
         mkdir,
         load;
@@ -84,12 +84,8 @@ describe('prepare command', function() {
         });
         plugman_prepare = spyOn(plugman, 'prepare').andReturn(Q());
         find_plugins = spyOn(util, 'findPlugins').andReturn([]);
-        plugman_get_json = spyOn(plugman.config_changes, 'get_platform_json').andReturn({
-            prepare_queue:{installed:[], uninstalled:[]},
-            config_munge:{},
-            installed_plugins:{},
-            dependent_plugins:{}
-        });
+        spyOn(PlatformJson, 'load').andReturn(new PlatformJson(null, null, {}));
+        spyOn(PlatformJson.prototype, 'save');
         load = spyOn(lazy_load, 'based_on_config').andReturn(Q());
         cp = spyOn(shell, 'cp').andReturn(true);
         mkdir = spyOn(shell, 'mkdir');
@@ -164,7 +160,7 @@ describe('prepare command', function() {
                 prepare('android').then(function() {
                     expect(fire).toHaveBeenCalledWith('after_prepare', {verbose: false, platforms:['android'], options: [], paths:[path.join(project_dir, 'platforms', 'android', 'www')]});
                 }, function(err) {
-                    expect(err).toBeUndefined('Exception while running `prepare android`:\n' + err);
+                    expect(err).toBeUndefined('Exception while running `prepare android`:\n' + err.stack);
                 }).fin(done);
             });
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/install-browserify.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install-browserify.spec.js b/cordova-lib/spec-plugman/install-browserify.spec.js
index 1897011..d21f384 100644
--- a/cordova-lib/spec-plugman/install-browserify.spec.js
+++ b/cordova-lib/spec-plugman/install-browserify.spec.js
@@ -18,7 +18,7 @@
 // */
 var install = require('../src/plugman/install'),
     actions = require('../src/plugman/util/action-stack'),
-    config_changes = require('../src/plugman/util/config-changes'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     xml_helpers = require('../src/util/xml-helpers'),
     events  = require('../src/events'),
     plugman = require('../src/plugman/plugman'),
@@ -94,7 +94,7 @@ describe('start', function() {
     beforeEach(function() {
         prepare = spyOn(plugman, 'prepare');
         prepareBrowserify = spyOn(plugman, 'prepareBrowserify');
-        config_queue_add = spyOn(config_changes, 'add_installed_plugin_to_prepare_queue');
+        config_queue_add = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
         proc = spyOn(actions.prototype, 'process').andReturn( Q(true) );
         actions_push = spyOn(actions.prototype, 'push');
         ca = spyOn(actions.prototype, 'createAction');
@@ -169,7 +169,7 @@ describe('install', function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         cp = spyOn(shell, 'cp').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_installed_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
         done = false;
     });
 
@@ -206,7 +206,7 @@ describe('install', function() {
         });
 
         it('should call the config-changes module\'s add_installed_plugin_to_prepare_queue method after processing an install', function() {
-           expect(results['config_add']).toEqual([plugins_install_dir, dummy_id, 'android', {}, true]);
+           expect(results['config_add']).toEqual([dummy_id, {}, true]);
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack',
            function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js b/cordova-lib/spec-plugman/install.spec.js
index ae560cf..6dbae32 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -18,7 +18,7 @@
 */
 var install = require('../src/plugman/install'),
     actions = require('../src/plugman/util/action-stack'),
-    config_changes = require('../src/plugman/util/config-changes'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     xml_helpers = require('../src/util/xml-helpers'),
     events  = require('../src/events'),
     plugman = require('../src/plugman/plugman'),
@@ -92,7 +92,7 @@ describe('start', function() {
 
     beforeEach(function() {
         prepare = spyOn(plugman, 'prepare');
-        config_queue_add = spyOn(config_changes, 'add_installed_plugin_to_prepare_queue');
+        config_queue_add = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
         proc = spyOn(actions.prototype, 'process').andReturn( Q(true) );
         actions_push = spyOn(actions.prototype, 'push');
         ca = spyOn(actions.prototype, 'createAction');
@@ -166,7 +166,7 @@ describe('install', function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         cp = spyOn(shell, 'cp').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_installed_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
         done = false;
     });
 
@@ -203,7 +203,7 @@ describe('install', function() {
         });
 
         it('should call the config-changes module\'s add_installed_plugin_to_prepare_queue method after processing an install', function() {
-           expect(results['config_add']).toEqual([plugins_install_dir, dummy_id, 'android', {}, true]);
+           expect(results['config_add']).toEqual([dummy_id, {}, true]);
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack',
            function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/prepare.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/prepare.spec.js b/cordova-lib/spec-plugman/prepare.spec.js
index 01df9f4..e12ba26 100644
--- a/cordova-lib/spec-plugman/prepare.spec.js
+++ b/cordova-lib/spec-plugman/prepare.spec.js
@@ -24,6 +24,7 @@ var platforms = require('../src/plugman/platforms'),
     path    = require('path'),
     shell   = require('shelljs'),
     config_changes = require('../src/plugman/util/config-changes'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     temp    = __dirname,
     plugins_dir = path.join(temp, 'plugins');
 
@@ -36,7 +37,7 @@ describe('prepare', function() {
         rm = spyOn(shell, 'rm');
         mkdir = spyOn(shell, 'mkdir');
         proc = spyOn(config_changes, 'process');
-        platform_json = spyOn(config_changes, 'get_platform_json').andReturn({installed_plugins:{},dependent_plugins:{},prepare_queue:{uninstalled:[]}});
+        platform_json = spyOn(PlatformJson, 'load').andReturn(new PlatformJson(null, null, {installed_plugins:{},dependent_plugins:{},prepare_queue:{uninstalled:[]}}));
         write = spyOn(fs, 'writeFileSync');
     });
     it('should create cordova_plugins.js file in a custom www directory', function() {
@@ -49,20 +50,20 @@ describe('prepare', function() {
         var copySpy;
         beforeEach(function() {
             copySpy = spyOn(common, 'copyFile');
-            platform_json.andReturn({
+            platform_json.andReturn(new PlatformJson(null, null, {
                 installed_plugins: {plugin_one: '', plugin_two: ''},
                 dependent_plugins: {}, prepare_queue: {uninstalled:[]}
-            });
+            }));
         });
         describe('uninstallation/removal', function() {
             var existsSync;
             beforeEach(function() {
                 existsSync = spyOn(fs, 'existsSync').andReturn(true);
-                platform_json.andReturn({installed_plugins:{},dependent_plugins:{},prepare_queue:{uninstalled:[{
+                platform_json.andReturn(new PlatformJson(null, null, {installed_plugins:{},dependent_plugins:{},prepare_queue:{uninstalled:[{
                     plugin:'nickelback',
                     id:'nickelback',
                     topLevel:true
-                }]}});
+                }]}}));
             });
             it('should remove any www/plugins directories related to plugins being queued for removal', function() {
                 prepare(temp, 'android', plugins_dir);
@@ -72,6 +73,6 @@ describe('prepare', function() {
     });
     it('should call into config-changes\' process method to do config processing', function() {
         prepare(temp, 'android', plugins_dir);
-        expect(proc).toHaveBeenCalledWith(plugins_dir, temp, 'android');
+        expect(proc).toHaveBeenCalledWith(plugins_dir, temp, 'android', jasmine.any(Object));
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/uninstall-browserify.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/uninstall-browserify.spec.js b/cordova-lib/spec-plugman/uninstall-browserify.spec.js
index e4e0d21..aea279c 100644
--- a/cordova-lib/spec-plugman/uninstall-browserify.spec.js
+++ b/cordova-lib/spec-plugman/uninstall-browserify.spec.js
@@ -19,7 +19,7 @@
 var uninstall = require('../src/plugman/uninstall'),
     install = require('../src/plugman/install'),
     actions = require('../src/plugman/util/action-stack'),
-    config_changes = require('../src/plugman/util/config-changes'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     events  = require('../src/events'),
     plugman = require('../src/plugman/plugman'),
     common  = require('./common'),
@@ -89,7 +89,7 @@ describe('uninstallPlatform', function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
         spyOn(shell, 'cp').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_uninstalled_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addUninstalledPluginToPrepareQueue');
         done = false;
     });
     describe('success', function() {
@@ -108,7 +108,7 @@ describe('uninstallPlatform', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(add_to_queue).toHaveBeenCalledWith(plugins_install_dir, dummy_id, 'android', true);
+                expect(add_to_queue).toHaveBeenCalledWith(dummy_id, true);
             });
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
@@ -234,7 +234,7 @@ describe('uninstall', function() {
     beforeEach(function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_uninstalled_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addUninstalledPluginToPrepareQueue');
         done = false;
     });
     describe('success', function() {
@@ -244,7 +244,7 @@ describe('uninstall', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 500);
             runs(function() {
-                expect(add_to_queue).toHaveBeenCalledWith(plugins_install_dir, dummy_id, 'android', true);
+                expect(add_to_queue).toHaveBeenCalledWith(dummy_id, true);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/uninstall.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/uninstall.spec.js b/cordova-lib/spec-plugman/uninstall.spec.js
index 8b5593e..a1bb01f 100644
--- a/cordova-lib/spec-plugman/uninstall.spec.js
+++ b/cordova-lib/spec-plugman/uninstall.spec.js
@@ -19,7 +19,7 @@
 var uninstall = require('../src/plugman/uninstall'),
     install = require('../src/plugman/install'),
     actions = require('../src/plugman/util/action-stack'),
-    config_changes = require('../src/plugman/util/config-changes'),
+    PlatformJson = require('../src/plugman/util/PlatformJson'),
     events  = require('../src/events'),
     plugman = require('../src/plugman/plugman'),
     common  = require('./common'),
@@ -88,7 +88,7 @@ describe('uninstallPlatform', function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
         spyOn(shell, 'cp').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_uninstalled_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addUninstalledPluginToPrepareQueue');
         done = false;
     });
     describe('success', function() {
@@ -107,7 +107,7 @@ describe('uninstallPlatform', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(add_to_queue).toHaveBeenCalledWith(plugins_install_dir, dummy_id, 'android', true);
+                expect(add_to_queue).toHaveBeenCalledWith(dummy_id, true);
             });
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
@@ -233,7 +233,7 @@ describe('uninstall', function() {
     beforeEach(function() {
         fsWrite = spyOn(fs, 'writeFileSync').andReturn(true);
         rm = spyOn(shell, 'rm').andReturn(true);
-        add_to_queue = spyOn(config_changes, 'add_uninstalled_plugin_to_prepare_queue');
+        add_to_queue = spyOn(PlatformJson.prototype, 'addUninstalledPluginToPrepareQueue');
         done = false;
     });
     describe('success', function() {
@@ -243,7 +243,7 @@ describe('uninstall', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(add_to_queue).toHaveBeenCalledWith(plugins_install_dir, dummy_id, 'android', true);
+                expect(add_to_queue).toHaveBeenCalledWith(dummy_id, true);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/config-changes.spec.js b/cordova-lib/spec-plugman/util/config-changes.spec.js
index 1d6da6d..34b247c 100644
--- a/cordova-lib/spec-plugman/util/config-changes.spec.js
+++ b/cordova-lib/spec-plugman/util/config-changes.spec.js
@@ -41,6 +41,7 @@ var configChanges = require('../../src/plugman/util/config-changes'),
     ios_config_xml = path.join(__dirname, '..', 'projects', 'ios-config-xml', '*'),
     plugins_dir = path.join(temp, 'cordova', 'plugins');
 var mungeutil = require('../../src/plugman/util/munge-util');
+var PlatformJson = require('../../src/plugman/util/PlatformJson');
 
 // TODO: dont do fs so much
 
@@ -65,96 +66,62 @@ describe('config-changes module', function() {
     });
 
     describe('queue methods', function() {
-        describe('add_installed_plugin_to_prepare_queue', function() {
-            it('should call get_platform_json method', function() {
-                var spy = spyOn(configChanges, 'get_platform_json').andReturn({
-                    prepare_queue:{
-                        installed:[],
-                        uninstalled:[]
-                    }
-                });
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'PooPlugin', 'android', {});
-                expect(spy).toHaveBeenCalledWith(plugins_dir, 'android');
-            });
+        describe('addInstalledPluginToPrepareQueue', function() {
             it('should append specified plugin to platform.json', function() {
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'PooPlugin', 'android', {});
-                var json = configChanges.get_platform_json(plugins_dir, 'android');
-                expect(json.prepare_queue.installed[0].plugin).toEqual('PooPlugin');
+                var platformJson = new PlatformJson(null, 'android', null);
+                platformJson.addInstalledPluginToPrepareQueue('DummyPlugin', {});
+                var json = platformJson.root;
+                expect(json.prepare_queue.installed[0].plugin).toEqual('DummyPlugin');
                 expect(json.prepare_queue.installed[0].vars).toEqual({});
             });
             it('should append specified plugin with any variables to platform.json', function() {
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'PooPlugin', 'android', {'dude':'man'});
-                var json = configChanges.get_platform_json(plugins_dir, 'android');
-                expect(json.prepare_queue.installed[0].plugin).toEqual('PooPlugin');
+                var platformJson = new PlatformJson(null, 'android', null);
+                platformJson.addInstalledPluginToPrepareQueue('DummyPlugin', {'dude':'man'});
+                var json = platformJson.root;
+                expect(json.prepare_queue.installed[0].plugin).toEqual('DummyPlugin');
                 expect(json.prepare_queue.installed[0].vars).toEqual({'dude':'man'});
             });
-            it('should call save_platform_json with updated config', function() {
-                var spy = spyOn(configChanges, 'save_platform_json');
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'PooPlugin', 'android', {});
-                var config = spy.mostRecentCall.args[0];
-                expect(config.prepare_queue.installed[0].plugin).toEqual('PooPlugin');
-            });
         });
 
-        describe('add_uninstalled_plugin_to_prepare_queue', function() {
-            beforeEach(function() {
-                shell.cp('-rf', dummyplugin, plugins_dir);
-            });
-
-            it('should call get_platform_json method', function() {
-                var spy = spyOn(configChanges, 'get_platform_json').andReturn({
-                    prepare_queue:{
-                        installed:[],
-                        uninstalled:[]
-                    }
-                });
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android');
-                expect(spy).toHaveBeenCalledWith(plugins_dir, 'android');
-            });
+        describe('addUninstalledPluginToPrepareQueue', function() {
             it('should append specified plugin to platform.json', function() {
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android');
-                var json = configChanges.get_platform_json(plugins_dir, 'android');
-                expect(json.prepare_queue.uninstalled[0].plugin).toEqual('DummyPlugin');
-                expect(json.prepare_queue.uninstalled[0].id).toEqual('com.phonegap.plugins.dummyplugin');
-            });
-            it('should call save_platform_json with updated config', function() {
-                var spy = spyOn(configChanges, 'save_platform_json');
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android', {});
-                var config = spy.mostRecentCall.args[0];
-                expect(config.prepare_queue.uninstalled[0].plugin).toEqual('DummyPlugin');
-                expect(config.prepare_queue.uninstalled[0].id).toEqual('com.phonegap.plugins.dummyplugin');
+              /* TODO: re-enable once it doens't require reading from filesystem
+                var platformJson = new PlatformJson(null, 'android', null);
+                platformJson.addUninstalledPluginToPrepareQueue('DummyPlugin');
+                var json = platformJson.root;
+                expect(json.prepare_queue.uninstalled[0].plugin).toEqual('com.phonegap.plugins.dummyplugin');*/
             });
         });
     });
 
-    describe('get_platform_json method', function() {
+    describe('load method', function() {
         it('should return an empty config json object if file doesn\'t exist', function() {
             var filepath = path.join(plugins_dir, 'android.json');
-            var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-            expect(cfg).toBeDefined();
-            expect(cfg.prepare_queue).toBeDefined();
-            expect(cfg.config_munge).toBeDefined();
-            expect(cfg.installed_plugins).toBeDefined();
+            var platformJson = PlatformJson.load(plugins_dir, 'android');
+            expect(platformJson.root).toBeDefined();
+            expect(platformJson.root.prepare_queue).toBeDefined();
+            expect(platformJson.root.config_munge).toBeDefined();
+            expect(platformJson.root.installed_plugins).toBeDefined();
         });
         it('should return the json file if it exists', function() {
             var filepath = path.join(plugins_dir, 'android.json');
             var json = {
                 prepare_queue: {installed: [], uninstalled: []},
                 config_munge: {files: {"some_file": {parents: {"some_parent": [{"xml": "some_change", "count": 1}]}}}},
-                installed_plugins: {}};
+                installed_plugins: {},
+                dependent_plugins: {}};
             fs.writeFileSync(filepath, JSON.stringify(json), 'utf-8');
-            var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-            expect(JSON.stringify(json)).toEqual(JSON.stringify(cfg));
+            var platformJson = PlatformJson.load(plugins_dir, 'android');
+            expect(JSON.stringify(json)).toEqual(JSON.stringify(platformJson.root));
         });
     });
 
-    describe('save_platform_json method', function() {
+    describe('save method', function() {
         it('should write out specified json', function() {
             var filepath = path.join(plugins_dir, 'android.json');
-            var cfg = {poop:true};
-            configChanges.save_platform_json(cfg, plugins_dir, 'android');
-            expect(fs.existsSync(filepath)).toBe(true);
-            expect(JSON.parse(fs.readFileSync(filepath, 'utf-8'))).toEqual(cfg);
+            var platformJson = new PlatformJson(filepath, 'android', {foo:true});
+            platformJson.save();
+            expect(JSON.parse(fs.readFileSync(filepath, 'utf-8'))).toEqual(platformJson.root);
         });
     });
 
@@ -257,41 +224,26 @@ describe('config-changes module', function() {
         });
         it('should generate config munges for queued plugins', function() {
             shell.cp('-rf', android_two_project, temp);
-            var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-            cfg.prepare_queue.installed = [{'plugin':'DummyPlugin', 'vars':{}}];
-            configChanges.save_platform_json(cfg, plugins_dir, 'android');
-            var munger = new configChanges.PlatformMunger('android', temp, plugins_dir);
+            var platformJson = PlatformJson.load(plugins_dir, 'android');
+            platformJson.root.prepare_queue.installed = [{'plugin':'DummyPlugin', 'vars':{}}];
+            var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
             var spy = spyOn(munger, 'generate_plugin_config_munge').andReturn({});
             munger.process();
             expect(spy).toHaveBeenCalledWith(path.join(plugins_dir, 'DummyPlugin'), {});
         });
-        it('should get a reference to existing config munge by calling get_platform_json', function() {
-            shell.cp('-rf', android_two_project, temp);
-            var spy = spyOn(configChanges, 'get_platform_json').andReturn({
-                prepare_queue:{
-                    installed:[],
-                    uninstalled:[]
-                },
-                config_munge:{}
-            });
-            configChanges.process(plugins_dir, temp, 'android');
-            expect(spy).toHaveBeenCalledWith(plugins_dir, 'android');
-        });
         describe(': installation', function() {
             describe('of xml config files', function() {
                 beforeEach(function() {
                     shell.cp('-rf', android_two_project, temp);
                 });
                 it('should call graftXML for every new config munge it introduces (every leaf in config munge that does not exist)', function() {
-                    var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-                    cfg.prepare_queue.installed = [{'plugin':'DummyPlugin', 'vars':{}}];
-                    configChanges.save_platform_json(cfg, plugins_dir, 'android');
+                    var platformJson = PlatformJson.load(plugins_dir, 'android');
+                    platformJson.root.prepare_queue.installed = [{'plugin':'DummyPlugin', 'vars':{}}];
 
                     var spy = spyOn(xml_helpers, 'graftXML').andReturn(true);
 
-                    var manifest_doc = new et.ElementTree(et.XML(fs.readFileSync(path.join(temp, 'AndroidManifest.xml'), 'utf-8')));
-                    var munge = dummy_xml.find('./platform[@name="android"]/config-file[@target="AndroidManifest.xml"]');
-                    configChanges.process(plugins_dir, temp, 'android');
+                    var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                    munger.process();
                     expect(spy.calls.length).toEqual(4);
                     expect(spy.argsForCall[0][2]).toEqual('/*');
                     expect(spy.argsForCall[1][2]).toEqual('/*');
@@ -300,18 +252,22 @@ describe('config-changes module', function() {
                 });
                 it('should not call graftXML for a config munge that already exists from another plugin', function() {
                     shell.cp('-rf', configplugin, plugins_dir);
-                    configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'ConfigTestPlugin', 'android', {});
+                    var platformJson = PlatformJson.load(plugins_dir, 'android');
+                    platformJson.addInstalledPluginToPrepareQueue('ConfigTestPlugin', {});
 
                     var spy = spyOn(xml_helpers, 'graftXML').andReturn(true);
-                    configChanges.process(plugins_dir, temp, 'android');
+                    var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                    munger.process();
                     expect(spy.calls.length).toEqual(1);
                 });
                 it('should not call graftXML for a config munge targeting a config file that does not exist', function() {
-                    configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android', {});
+                    var platformJson = PlatformJson.load(plugins_dir, 'android');
+                    platformJson.addInstalledPluginToPrepareQueue('DummyPlugin', {});
 
                     var spy = spyOn(fs, 'readFileSync').andCallThrough();
 
-                    configChanges.process(plugins_dir, temp, 'android');
+                    var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                    munger.process();
                     expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'res', 'xml', 'plugins.xml'), 'utf-8');
                 });
             });
@@ -320,8 +276,9 @@ describe('config-changes module', function() {
                 it('should write empty string nodes with no whitespace', function() {
                     shell.cp('-rf', ios_config_xml, temp);
                     shell.cp('-rf', varplugin, plugins_dir);
-                    configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'ios', {});
-                    configChanges.process(plugins_dir, temp, 'ios');
+                    var platformJson = PlatformJson.load(plugins_dir, 'ios');
+                    platformJson.addInstalledPluginToPrepareQueue('VariablePlugin', {});
+                    configChanges.process(plugins_dir, temp, 'ios', platformJson);
                     expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'), 'utf-8')).toMatch(/<key>APluginNode<\/key>\n    <string><\/string>/m);
                 });
             });
@@ -329,8 +286,10 @@ describe('config-changes module', function() {
                 it('should write empty string nodes with no whitespace', function() {
                     shell.cp('-rf', ios_config_xml, temp);
                     shell.cp('-rf', plistplugin, plugins_dir);
-                    configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'PlistPlugin', 'ios', {});
-                    configChanges.process(plugins_dir, temp, 'ios');
+                    var platformJson = PlatformJson.load(plugins_dir, 'ios');
+                    platformJson.addInstalledPluginToPrepareQueue('PlistPlugin', {});
+                    configChanges.process(plugins_dir, temp, 'ios', platformJson);
+
                     expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'), 'utf-8')).toMatch(/<key>UINewsstandIcon<\/key>[\s\S]*<key>CFBundlePrimaryIcon<\/key>/);
                 });
             });
@@ -342,8 +301,10 @@ describe('config-changes module', function() {
                     xcode_add = spyOn(xcode.project.prototype, 'addFramework').andCallThrough();
                 });
                 it('should call into xcode.addFramework if plugin has <framework> file defined and is ios',function() {
-                    configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'ChildBrowser', 'ios', {});
-                    configChanges.process(plugins_dir, temp, 'ios');
+                    var platformJson = PlatformJson.load(plugins_dir, 'ios');
+                    platformJson.addInstalledPluginToPrepareQueue('ChildBrowser', {});
+                    var munger = new configChanges.PlatformMunger('ios', temp, plugins_dir, platformJson);
+                    munger.process();
                     expect(xcode_add).toHaveBeenCalledWith('libsqlite3.dylib', {weak:false});
                     expect(xcode_add).toHaveBeenCalledWith('social.framework', {weak:true});
                     expect(xcode_add).toHaveBeenCalledWith('music.framework', {weak:false});
@@ -353,46 +314,43 @@ describe('config-changes module', function() {
             it('should resolve wildcard config-file targets to the project, if applicable', function() {
                 shell.cp('-rf', ios_config_xml, temp);
                 shell.cp('-rf', cbplugin, plugins_dir);
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'ChildBrowser', 'ios', {});
+                var platformJson = PlatformJson.load(plugins_dir, 'ios');
+                platformJson.addInstalledPluginToPrepareQueue('ChildBrowser', {});
                 var spy = spyOn(fs, 'readFileSync').andCallThrough();
 
-                configChanges.process(plugins_dir, temp, 'ios');
+                var munger = new configChanges.PlatformMunger('ios', temp, plugins_dir, platformJson);
+                munger.process();
                 expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'SampleApp-Info.plist').replace(/\\/g, '/'), 'utf8');
             });
             it('should move successfully installed plugins from queue to installed plugins section, and include/retain vars if applicable', function() {
                 shell.cp('-rf', android_two_project, temp);
                 shell.cp('-rf', varplugin, plugins_dir);
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android', {"API_KEY":"hi"}, true);
-
-                configChanges.process(plugins_dir, temp, 'android');
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('VariablePlugin', {'API_KEY':'hi'}, true);
 
-                var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-                expect(cfg.prepare_queue.installed.length).toEqual(0);
-                expect(cfg.installed_plugins['com.adobe.vars']).toBeDefined();
-                expect(cfg.installed_plugins['com.adobe.vars']['API_KEY']).toEqual('hi');
-            });
-            it('should save changes to global config munge after completing an install', function() {
-                shell.cp('-rf', android_two_project, temp);
-                shell.cp('-rf', varplugin, plugins_dir);
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android', {"API_KEY":"hi"});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                munger.process();
 
-                var spy = spyOn(configChanges, 'save_platform_json');
-                configChanges.process(plugins_dir, temp, 'android');
-                expect(spy).toHaveBeenCalled();
+                expect(platformJson.root.prepare_queue.installed.length).toEqual(0);
+                expect(platformJson.root.installed_plugins['com.adobe.vars']).toBeDefined();
+                expect(platformJson.root.installed_plugins['com.adobe.vars']['API_KEY']).toEqual('hi');
             });
         });
 
         describe(': uninstallation', function() {
             it('should call pruneXML for every config munge it completely removes from the app (every leaf that is decremented to 0)', function() {
                 shell.cp('-rf', android_two_project, temp);
+
                 // Run through an "install"
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android', {});
-                configChanges.process(plugins_dir, temp, 'android');
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('DummyPlugin', {});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                munger.process();
 
                 // Now set up an uninstall and make sure prunexml is called properly
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android');
+                platformJson.addUninstalledPluginToPrepareQueue('DummyPlugin');
                 var spy = spyOn(xml_helpers, 'pruneXML').andReturn(true);
-                configChanges.process(plugins_dir, temp, 'android');
+                munger.process();
                 expect(spy.calls.length).toEqual(4);
                 expect(spy.argsForCall[0][2]).toEqual('/*');
                 expect(spy.argsForCall[1][2]).toEqual('/*');
@@ -403,12 +361,13 @@ describe('config-changes module', function() {
                 shell.cp('-rf', android_two_project, temp);
                 shell.cp('-rf', varplugin, plugins_dir);
                 // Run through an "install"
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android', {"API_KEY":"canucks"});
-                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir);
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('VariablePlugin', {"API_KEY":"canucks"});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
                 munger.process();
 
                 // Now set up an uninstall and make sure prunexml is called properly
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android');
+                platformJson.addUninstalledPluginToPrepareQueue('VariablePlugin');
                 var spy = spyOn(munger, 'generate_plugin_config_munge').andReturn({});
                 munger.process();
                 var munge_params = spy.mostRecentCall.args;
@@ -421,13 +380,16 @@ describe('config-changes module', function() {
                 shell.cp('-rf', shareddepsplugin, plugins_dir);
 
                 // Run through and "install" two plugins (they share a permission for INTERNET)
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'multiple-children', 'android', {});
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'shared-deps-multi-child', 'android', {});
-                configChanges.process(plugins_dir, temp, 'android');
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('multiple-children', {});
+                platformJson.addInstalledPluginToPrepareQueue('shared-deps-multi-child', {});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                munger.process();
 
                 // Now set up an uninstall for multi-child plugin
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'multiple-children', 'android');
-                configChanges.process(plugins_dir, temp, 'android');
+                platformJson.addUninstalledPluginToPrepareQueue('multiple-children');
+                munger.process();
+                munger.save_all();
                 var am_xml = new et.ElementTree(et.XML(fs.readFileSync(path.join(temp, 'AndroidManifest.xml'), 'utf-8')));
                 var permission = am_xml.find('./uses-permission');
                 expect(permission).toBeDefined();
@@ -436,13 +398,16 @@ describe('config-changes module', function() {
             it('should not call pruneXML for a config munge targeting a config file that does not exist', function() {
                 shell.cp('-rf', android_two_project, temp);
                 // install a plugin
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android', {});
-                configChanges.process(plugins_dir, temp, 'android');
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('DummyPlugin', {});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                munger.process();
+
                 // set up an uninstall for the same plugin
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin', 'android', {});
+                platformJson.addUninstalledPluginToPrepareQueue('DummyPlugin');
 
                 var spy = spyOn(fs, 'readFileSync').andCallThrough();
-                configChanges.process(plugins_dir, temp, 'android');
+                munger.process();
 
                 expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'res', 'xml', 'plugins.xml'), 'utf-8');
             });
@@ -450,28 +415,17 @@ describe('config-changes module', function() {
                 shell.cp('-rf', android_two_project, temp);
                 shell.cp('-rf', varplugin, plugins_dir);
                 // install the var plugin
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android', {"API_KEY":"eat my shorts"});
-                configChanges.process(plugins_dir, temp, 'android');
+                var platformJson = PlatformJson.load(plugins_dir, 'android');
+                platformJson.addInstalledPluginToPrepareQueue('VariablePlugin', {'API_KEY':'eat my shorts'});
+                var munger = new configChanges.PlatformMunger('android', temp, plugins_dir, platformJson);
+                munger.process();
+
                 // queue up an uninstall for the same plugin
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android');
-                configChanges.process(plugins_dir, temp, 'android');
+                platformJson.addUninstalledPluginToPrepareQueue('VariablePlugin');
+                munger.process();
 
-                var cfg = configChanges.get_platform_json(plugins_dir, 'android');
-                expect(cfg.prepare_queue.uninstalled.length).toEqual(0);
-                expect(cfg.installed_plugins['com.adobe.vars']).not.toBeDefined();
-            });
-            it('should save changes to global config munge after completing an uninstall', function() {
-                shell.cp('-rf', android_two_project, temp);
-                shell.cp('-rf', varplugin, plugins_dir);
-                // install a plugin
-                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android', {"API_KEY":"eat my shorts"});
-                configChanges.process(plugins_dir, temp, 'android');
-                // set up an uninstall for the plugin
-                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'VariablePlugin', 'android');
-
-                var spy = spyOn(configChanges, 'save_platform_json');
-                configChanges.process(plugins_dir, temp, 'android');
-                expect(spy).toHaveBeenCalled();
+                expect(platformJson.root.prepare_queue.uninstalled.length).toEqual(0);
+                expect(platformJson.root.installed_plugins['com.adobe.vars']).not.toBeDefined();
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/spec-plugman/util/dependencies.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/util/dependencies.spec.js b/cordova-lib/spec-plugman/util/dependencies.spec.js
index 3fa5ece..e68953a 100644
--- a/cordova-lib/spec-plugman/util/dependencies.spec.js
+++ b/cordova-lib/spec-plugman/util/dependencies.spec.js
@@ -20,6 +20,7 @@ var dependencies = require('../../src/plugman/util/dependencies'),
     xml_helpers = require('../../src/util/xml-helpers'),
     path = require('path'),
     config = require('../../src/plugman/util/config-changes');
+var PlatformJson = require('../../src/plugman/util/PlatformJson');
 
 describe('dependency module', function() {
     describe('generateDependencyInfo method', function() {
@@ -29,12 +30,12 @@ describe('dependency module', function() {
                 "isitme":"",
                 "yourelookingfor":""
             };
-            spyOn(xml_helpers, 'parseElementtreeSync').andReturn({findall:function(){}});
-            var spy = spyOn(config, 'get_platform_json').andReturn({
+            var platformJson = new PlatformJson('filePath', 'platform', {
                 installed_plugins:tlps,
                 dependent_plugins:[]
             });
-            var obj = dependencies.generateDependencyInfo('some dir');
+            spyOn(xml_helpers, 'parseElementtreeSync').andReturn({findall:function(){}});
+            var obj = dependencies.generateDependencyInfo(platformJson, 'plugins_dir');
             expect(obj.top_level_plugins).toEqual(Object.keys(tlps));
         });
         it('should return a dependency graph for the plugins', function() {
@@ -47,11 +48,12 @@ describe('dependency module', function() {
                 "D":"",
                 "E":""
             };
-            var spy = spyOn(config, 'get_platform_json').andReturn({
+            var plugins_dir = path.join(__dirname, '..', 'plugins', 'dependencies');
+            var platformJson = new PlatformJson(plugins_dir, 'android', {
                 installed_plugins:tlps,
                 dependent_plugins:[]
             });
-            var obj = dependencies.generateDependencyInfo(path.join(__dirname, '..', 'plugins', 'dependencies'), 'android');
+            var obj = dependencies.generateDependencyInfo(platformJson, plugins_dir);
             expect(obj.graph.getChain('A')).toEqual(['C','D']);
             expect(obj.graph.getChain('B')).toEqual(['D', 'E']);
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/cordova/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/prepare.js b/cordova-lib/src/cordova/prepare.js
index 7cc96cb..33cc752 100644
--- a/cordova-lib/src/cordova/prepare.js
+++ b/cordova-lib/src/cordova/prepare.js
@@ -31,7 +31,9 @@ var cordova_util      = require('./util'),
     HooksRunner            = require('../hooks/HooksRunner'),
     events            = require('../events'),
     Q                 = require('q'),
-    plugman           = require('../plugman/plugman');
+    plugman           = require('../plugman/plugman'),
+    PlatformMunger    = require('../plugman/util/config-changes').PlatformMunger,
+    PlatformJson      = require('../plugman/util/PlatformJson');
 
 // Returns a promise.
 exports = module.exports = prepare;
@@ -102,7 +104,8 @@ function prepare(options) {
             }
 
             // Make sure that config changes for each existing plugin is in place
-            var munger = new plugman.config_changes.PlatformMunger(platform, platformPath, plugins_dir);
+            var platformJson = PlatformJson.load(plugins_dir, platform);
+            var munger = new PlatformMunger(platform, platformPath, plugins_dir, platformJson);
             munger.reapply_global_munge();
             munger.save_all();
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/cordova/save.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/save.js b/cordova-lib/src/cordova/save.js
index 9d34543..4dfc2a7 100644
--- a/cordova-lib/src/cordova/save.js
+++ b/cordova-lib/src/cordova/save.js
@@ -31,7 +31,7 @@ var path             = require('path'),
     superspawn       = require('./superspawn'),
     CordovaError     = require('../CordovaError'),
     plugman_metadata = require('../plugman/util/metadata'),
-    config_changes   = require('../plugman/util/config-changes');
+    PlatformJson     = require('../plugman/util/PlatformJson');
 
 module.exports = save;
 function save(target, opts){
@@ -156,8 +156,8 @@ function isDependencyPlugin(pluginId){
         return false;
     }
     for(var i= 0; i< platforms.length; i++){
-        var platform_config = config_changes.get_platform_json(pluginsPath, platforms[i]);
-        if(platform_config.dependent_plugins[pluginId])
+        var platformJson = PlatformJson.load(pluginsPath, platforms[i]);
+        if (platformJson.root.dependent_plugins[pluginId])
         {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 7aa7837..2243c7d 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -28,7 +28,7 @@ var path = require('path'),
     dep_graph = require('dep-graph'),
     child_process = require('child_process'),
     semver = require('semver'),
-    config_changes = require('./util/config-changes'),
+    PlatformJson = require('./util/PlatformJson'),
     PluginInfo    = require('../PluginInfo'),
     CordovaError  = require('../CordovaError'),
     Q = require('q'),
@@ -242,22 +242,6 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
 }
 
 
-function isPluginInstalled(plugins_dir, platform, plugin_id) {
-    var installed_plugin_id;
-    var platform_config = config_changes.get_platform_json(plugins_dir, platform);
-    for (installed_plugin_id in platform_config.installed_plugins) {
-        if (installed_plugin_id == plugin_id) {
-            return true;
-        }
-    }
-    for (installed_plugin_id in platform_config.dependent_plugins) {
-        if (installed_plugin_id == plugin_id) {
-            return true;
-        }
-    }
-    return false;
-}
-
 // possible options: cli_variables, www_dir, is_top_level
 // Returns a promise.
 module.exports.runInstall = runInstall;
@@ -267,8 +251,9 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
 
     options = options || {};
     options.graph = options.graph || new dep_graph();
+    var platformJson = PlatformJson.load(plugins_dir, platform);
 
-    if (isPluginInstalled(plugins_dir, platform, pluginInfo.id)) {
+    if (platformJson.isPluginInstalled(pluginInfo.id)) {
         if (options.is_top_level) {
             events.emit('results', 'Plugin "' + pluginInfo.id + '" already installed on ' + platform + '.');
         } else {
@@ -591,7 +576,9 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
     return actions.process(platform, project_dir)
     .then(function(err) {
         // queue up the plugin so prepare knows what to do.
-        config_changes.add_installed_plugin_to_prepare_queue(plugins_dir, pluginInfo.id, platform, filtered_variables, options.is_top_level);
+        var platformJson = PlatformJson.load(plugins_dir, platform);
+        platformJson.addInstalledPluginToPrepareQueue(pluginInfo.id, filtered_variables, options.is_top_level);
+        platformJson.save();
         // call prepare after a successful install
         if (options.browserify) {
             return plugman.prepareBrowserify(project_dir, platform, plugins_dir, options.www_dir, options.is_top_level);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/prepare-browserify.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare-browserify.js b/cordova-lib/src/plugman/prepare-browserify.js
index cc74b5d..4880d0f 100644
--- a/cordova-lib/src/plugman/prepare-browserify.js
+++ b/cordova-lib/src/plugman/prepare-browserify.js
@@ -44,10 +44,12 @@ var platform_modules   = require('./platforms'),
     Q                  = require('q'),
     computeCommitId    = require('cordova-js/tasks/lib/compute-commit-id');
 
-function uninstallQueuedPlugins(platform_json, wwwDir) {
+var PlatformJson = require('./util/PlatformJson');
+
+function uninstallQueuedPlugins(platformJson, wwwDir) {
     // Check if there are any plugins queued for uninstallation, and if so, remove any of their plugin web assets loaded in
     // via <js-module> elements
-    var plugins_to_uninstall = platform_json.prepare_queue.uninstalled;
+    var plugins_to_uninstall = platformJson.root.prepare_queue.uninstalled;
     if (plugins_to_uninstall && plugins_to_uninstall.length) {
         var plugins_www = path.join(wwwDir, 'plugins');
         if (fs.existsSync(plugins_www)) {
@@ -142,14 +144,14 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     // Write this object into www/cordova_plugins.json.
     // This file is not really used. Maybe cordova app harness
     events.emit('verbose', 'Preparing ' + platform + ' browserify project');
-    var platform_json = config_changes.get_platform_json(plugins_dir, platform);
+    var platformJson = PlatformJson.load(plugins_dir, platform);
     var wwwDir = www_dir || platform_modules[platform].www_dir(project_dir);
     var scripts = [];
 
-    uninstallQueuedPlugins(platform_json, www_dir);
+    uninstallQueuedPlugins(platformJson, www_dir);
 
     events.emit('verbose', 'Processing configuration changes for plugins.');
-    config_changes.process(plugins_dir, project_dir, platform);
+    config_changes.process(plugins_dir, project_dir, platform, platformJson);
 
     if(!is_top_level) {
         return Q();
@@ -164,8 +166,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     }).then(function(platformVersion){
         var libraryRelease = bundle(platform, false, commitId, platformVersion);
 
-        platform_json = config_changes.get_platform_json(plugins_dir, platform);
-        var plugins = Object.keys(platform_json.installed_plugins).concat(Object.keys(platform_json.dependent_plugins));
+        var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
         var pluginMetadata = {};
         events.emit('verbose', 'Iterating over installed plugins:', plugins);
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 284d164..2465630 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -32,6 +32,7 @@ var platform_modules = require('./platforms'),
     util            = require('util'),
     events          = require('../events'),
     plugman         = require('./plugman');
+var PlatformJson = require('./util/PlatformJson');
 
 // Called on --prepare.
 // Sets up each plugin's Javascript code to be loaded properly.
@@ -48,12 +49,12 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     // - Write this object into www/cordova_plugins.json.
     // - Cordova.js contains code to load them at runtime from that file.
     events.emit('verbose', 'Preparing ' + platform + ' project');
-    var platform_json = config_changes.get_platform_json(plugins_dir, platform);
+    var platformJson = PlatformJson.load(plugins_dir, platform);
     var wwwDir = www_dir || platform_modules[platform].www_dir(project_dir);
 
     // Check if there are any plugins queued for uninstallation, and if so, remove any of their plugin web assets loaded in
     // via <js-module> elements
-    var plugins_to_uninstall = platform_json.prepare_queue.uninstalled;
+    var plugins_to_uninstall = platformJson.root.prepare_queue.uninstalled;
     if (plugins_to_uninstall && plugins_to_uninstall.length) {
         var plugins_www = path.join(wwwDir, 'plugins');
         if (fs.existsSync(plugins_www)) {
@@ -69,11 +70,10 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     }
 
     events.emit('verbose', 'Processing configuration changes for plugins.');
-    config_changes.process(plugins_dir, project_dir, platform);
+    config_changes.process(plugins_dir, project_dir, platform, platformJson);
 
-    platform_json = config_changes.get_platform_json(plugins_dir, platform);
     // This array holds all the metadata for each module and ends up in cordova_plugins.json
-    var plugins = Object.keys(platform_json.installed_plugins).concat(Object.keys(platform_json.dependent_plugins));
+    var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
     var moduleObjects = [];
     var pluginMetadata = {};
     events.emit('verbose', 'Iterating over installed plugins:', plugins);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 7335b60..7e94400 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -25,7 +25,6 @@
 var path = require('path'),
     fs   = require('fs'),
     shell= require('shelljs'),
-    config_changes = require('./util/config-changes'),
     xml_helpers = require('../util/xml-helpers'),
     action_stack = require('./util/action-stack'),
     dependencies = require('./util/dependencies'),
@@ -40,6 +39,8 @@ var path = require('path'),
     PluginInfo = require('../PluginInfo'),
     cordovaUtil      = require('../cordova/util');
 
+var PlatformJson = require('./util/PlatformJson');
+
 // possible options: cli_variables, www_dir
 // Returns a promise.
 module.exports = uninstall;
@@ -145,7 +146,8 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
     // Can have missing plugins on some platforms when not supported..
     var dependList = {};
     platforms.forEach(function(platform) {
-        var depsInfo = dependencies.generateDependencyInfo(plugins_dir, platform);
+        var platformJson = PlatformJson.load(plugins_dir, platform);
+        var depsInfo = dependencies.generateDependencyInfo(platformJson, plugins_dir);
         var tlps = depsInfo.top_level_plugins;
         var deps;
 
@@ -160,7 +162,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
         });
 
         toDelete.forEach(function(plugin) {
-            deps = dependencies.dependents(plugin, depsInfo);
+            deps = dependencies.dependents(plugin, depsInfo, platformJson);
 
             var i = deps.indexOf(top_plugin_id);
             if(i >= 0)
@@ -215,10 +217,11 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
     var plugin_id    = plugin_et._root.attrib['id'];
 
     // Deps info can be passed recusively
-    var depsInfo = options.depsInfo || dependencies.generateDependencyInfo(plugins_dir, platform, 'remove');
+    var platformJson = PlatformJson.load(plugins_dir, platform);
+    var depsInfo = options.depsInfo || dependencies.generateDependencyInfo(platformJson, plugins_dir);
 
     // Check that this plugin has no dependents.
-    var dependents = dependencies.dependents(plugin_id, depsInfo, platform);
+    var dependents = dependencies.dependents(plugin_id, depsInfo, platformJson);
 
     if(options.is_top_level && dependents && dependents.length > 0) {
         var msg = 'The plugin \'' + plugin_id + '\' is required by (' + dependents.join(', ') + ')';
@@ -231,7 +234,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 
     // Check how many dangling dependencies this plugin has.
     var deps = depsInfo.graph.getChain(plugin_id);
-    var danglers = dependencies.danglers(plugin_id, depsInfo, platform);
+    var danglers = dependencies.danglers(plugin_id, depsInfo, platformJson);
 
     var promise;
     if (deps && deps.length && danglers && danglers.length) {
@@ -354,7 +357,9 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
         // WIN!
         events.emit('verbose', plugin_id + ' uninstalled from ' + platform + '.');
         // queue up the plugin so prepare can remove the config changes
-        config_changes.add_uninstalled_plugin_to_prepare_queue(plugins_dir, plugin_id, platform, is_top_level);
+        var platformJson = PlatformJson.load(plugins_dir, platform);
+        platformJson.addUninstalledPluginToPrepareQueue(plugin_id, is_top_level);
+        platformJson.save();
         // call prepare after a successful uninstall
         if (options.browserify) {
             return plugman.prepareBrowserify(project_dir, platform, plugins_dir, www_dir, is_top_level);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/util/PlatformJson.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/PlatformJson.js b/cordova-lib/src/plugman/util/PlatformJson.js
index dcb1d42..ffdcaac 100644
--- a/cordova-lib/src/plugman/util/PlatformJson.js
+++ b/cordova-lib/src/plugman/util/PlatformJson.js
@@ -21,38 +21,63 @@ var fs = require('fs');
 var path = require('path');
 var shelljs = require('shelljs');
 var mungeutil = require('./munge-util');
+var PluginInfo = require('../../PluginInfo');
 
-function PlatformJson(filePath, platform, configJson) {
+function PlatformJson(filePath, platform, root) {
     this.filePath = filePath;
     this.platform = platform;
-    this.configJson = configJson;
+    this.root = fix_munge(root || {});
 }
 
 PlatformJson.load = function(plugins_dir, platform) {
     var filePath = path.join(plugins_dir, platform + '.json');
-    var configJson;
+    var root = null;
     if (fs.existsSync(filePath)) {
-        configJson = fix_munge(JSON.parse(fs.readFileSync(filePath, 'utf-8')));
-    } else {
-        configJson = {
-            prepare_queue:{installed:[], uninstalled:[]},
-            config_munge:{},
-            installed_plugins:{},
-            dependent_plugins:{}
-        };
+        root = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
     }
-    return new PlatformJson(filePath, platform, configJson);
+    return new PlatformJson(filePath, platform, root);
 };
 
 PlatformJson.prototype.save = function() {
     shelljs.mkdir('-p', path.dirname(this.filePath));
-    fs.writeFileSync(this.filePath, JSON.stringify(this.configJson, null, 4), 'utf-8');
+    fs.writeFileSync(this.filePath, JSON.stringify(this.root, null, 4), 'utf-8');
+};
+
+PlatformJson.prototype.isPluginInstalled = function(pluginId) {
+    var installed_plugin_id;
+    var json = this.root;
+    for (installed_plugin_id in json.installed_plugins) {
+        if (installed_plugin_id == pluginId) {
+            return true;
+        }
+    }
+    for (installed_plugin_id in json.dependent_plugins) {
+        if (installed_plugin_id == pluginId) {
+            return true;
+        }
+    }
+    return false;
+};
+
+PlatformJson.prototype.addInstalledPluginToPrepareQueue = function(pluginDirName, vars, is_top_level) {
+    this.root.prepare_queue.installed.push({'plugin':pluginDirName, 'vars':vars, 'topLevel':is_top_level});
+};
+
+// TODO: Enforce pluginDirName == pluginId so that we don't need to read the file.
+PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function(pluginDirName, is_top_level) {
+    var pinfo = new PluginInfo.PluginInfo(path.join(path.dirname(this.filePath), pluginDirName));
+    this.root.prepare_queue.uninstalled.push({'plugin':pluginDirName, 'id':pinfo.id, 'topLevel':is_top_level});
 };
 
 
 // convert a munge from the old format ([file][parent][xml] = count) to the current one
-function fix_munge(platform_config) {
-    var munge = platform_config.config_munge;
+function fix_munge(root) {
+    root.prepare_queue = root.prepare_queue || {installed:[], uninstalled:[]};
+    root.config_munge = root.config_munge || {files: {}};
+    root.installed_plugins = root.installed_plugins || {};
+    root.dependent_plugins = root.dependent_plugins || {};
+
+    var munge = root.config_munge;
     if (!munge.files) {
         var new_munge = { files: {} };
         for (var file in munge) {
@@ -65,10 +90,10 @@ function fix_munge(platform_config) {
                 }
             }
         }
-        platform_config.config_munge = new_munge;
+        root.config_munge = new_munge;
     }
 
-    return platform_config;
+    return root;
 }
 
 module.exports = PlatformJson;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/util/config-changes.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/config-changes.js b/cordova-lib/src/plugman/util/config-changes.js
index 3092497..47ebb7a 100644
--- a/cordova-lib/src/plugman/util/config-changes.js
+++ b/cordova-lib/src/plugman/util/config-changes.js
@@ -40,12 +40,10 @@ var fs   = require('fs'),
     path = require('path'),
     et   = require('elementtree'),
     semver = require('semver'),
-    xml_helpers = require('../../util/xml-helpers'),
     platforms = require('./../platforms'),
     events = require('../../events'),
     ConfigKeeper = require('./ConfigKeeper');
 
-var PlatformJson = require('./PlatformJson');
 var mungeutil = require('./munge-util');
 
 
@@ -62,66 +60,33 @@ exports.PlatformMunger = PlatformMunger;
 /******************************************************************************
 Adapters to keep the current refactoring effort to within this file
 ******************************************************************************/
-exports.add_plugin_changes = function(platform, project_dir, plugins_dir, plugin_id, plugin_vars, is_top_level, should_increment, cache) {
-    var munger = new PlatformMunger(platform, project_dir, plugins_dir);
-    munger.add_plugin_changes(plugin_id, plugin_vars, is_top_level, should_increment, cache);
-    munger.save_all();
-};
-
-exports.remove_plugin_changes = function(platform, project_dir, plugins_dir, plugin_name, plugin_id, is_top_level, should_decrement) {
-    // TODO: should_decrement parameter is never used, remove it here and wherever called
-    var munger = new PlatformMunger(platform, project_dir, plugins_dir);
-    munger.remove_plugin_changes(plugin_name, plugin_id, is_top_level);
-    munger.save_all();
-};
-
-exports.process = function(plugins_dir, project_dir, platform) {
-    var munger = new PlatformMunger(platform, project_dir, plugins_dir);
+exports.process = function(plugins_dir, project_dir, platform, platformJson) {
+    var munger = new PlatformMunger(platform, project_dir, plugins_dir, platformJson);
     munger.process();
     munger.save_all();
 };
 
-/******************************************************************************/
-
-
-exports.add_installed_plugin_to_prepare_queue = add_installed_plugin_to_prepare_queue;
-function add_installed_plugin_to_prepare_queue(plugins_dir, plugin, platform, vars, is_top_level) {
-    checkPlatform(platform);
-    var config = exports.get_platform_json(plugins_dir, platform);
-    config.prepare_queue.installed.push({'plugin':plugin, 'vars':vars, 'topLevel':is_top_level});
-    exports.save_platform_json(config, plugins_dir, platform);
-}
-
-exports.add_uninstalled_plugin_to_prepare_queue = add_uninstalled_plugin_to_prepare_queue;
-function add_uninstalled_plugin_to_prepare_queue(plugins_dir, plugin, platform, is_top_level) {
-    checkPlatform(platform);
-
-    var plugin_xml = xml_helpers.parseElementtreeSync(path.join(plugins_dir, plugin, 'plugin.xml'));
-    var config = exports.get_platform_json(plugins_dir, platform);
-    config.prepare_queue.uninstalled.push({'plugin':plugin, 'id':plugin_xml.getroot().attrib['id'], 'topLevel':is_top_level});
-    exports.save_platform_json(config, plugins_dir, platform);
-}
-
-
 /******************************************************************************
 * PlatformMunger class
 *
 * Can deal with config file of a single project.
 * Parsed config files are cached in a ConfigKeeper object.
 ******************************************************************************/
-function PlatformMunger(platform, project_dir, plugins_dir) {
+function PlatformMunger(platform, project_dir, plugins_dir, platformJson) {
     checkPlatform(platform);
     this.platform = platform;
     this.project_dir = project_dir;
     this.plugins_dir = plugins_dir;
     this.platform_handler = platforms[platform];
     this.config_keeper = new ConfigKeeper(project_dir);
+    this.platformJson = platformJson;
 }
 
 // Write out all unsaved files.
 PlatformMunger.prototype.save_all = PlatformMunger_save_all;
 function PlatformMunger_save_all() {
     this.config_keeper.save_all();
+    this.platformJson.save();
 }
 
 // Apply a munge object to a single config file.
@@ -173,7 +138,7 @@ function PlatformMunger_apply_file_munge(file, munge, remove) {
 PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes;
 function remove_plugin_changes(plugin_name, plugin_id, is_top_level) {
     var self = this;
-    var platform_config = exports.get_platform_json(self.plugins_dir, self.platform);
+    var platform_config = self.platformJson.root;
     var plugin_dir = path.join(self.plugins_dir, plugin_name);
     var plugin_vars = (is_top_level ? platform_config.installed_plugins[plugin_id] : platform_config.dependent_plugins[plugin_id]);
 
@@ -212,16 +177,13 @@ function remove_plugin_changes(plugin_name, plugin_id, is_top_level) {
     } else {
         delete platform_config.dependent_plugins[plugin_id];
     }
-
-    // save
-    exports.save_platform_json(platform_config, self.plugins_dir, self.platform);
 }
 
 
 PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
 function add_plugin_changes(plugin_id, plugin_vars, is_top_level, should_increment) {
     var self = this;
-    var platform_config = exports.get_platform_json(self.plugins_dir, self.platform);
+    var platform_config = self.platformJson.root;
     var plugin_dir = path.join(self.plugins_dir, plugin_id);
 
     var plugin_config = self.config_keeper.get(plugin_dir, '', 'plugin.xml');
@@ -271,9 +233,6 @@ function add_plugin_changes(plugin_id, plugin_vars, is_top_level, should_increme
     } else {
         platform_config.dependent_plugins[plugin_id] = plugin_vars || {};
     }
-
-    // save
-    exports.save_platform_json(platform_config, self.plugins_dir, self.platform);
 }
 
 
@@ -284,7 +243,7 @@ PlatformMunger.prototype.reapply_global_munge = reapply_global_munge ;
 function reapply_global_munge () {
     var self = this;
 
-    var platform_config = exports.get_platform_json(self.plugins_dir, self.platform);
+    var platform_config = self.platformJson.root;
     var global_munge = platform_config.config_munge;
     for (var file in global_munge.files) {
         // TODO: remove this warning some time after 3.4 is out.
@@ -375,8 +334,7 @@ function generate_plugin_config_munge(plugin_dir, vars) {
 PlatformMunger.prototype.process = PlatformMunger_process;
 function PlatformMunger_process() {
     var self = this;
-
-    var platform_config = exports.get_platform_json(self.plugins_dir, self.platform);
+    var platform_config = self.platformJson.root;
 
     // Uninstallation first
     platform_config.prepare_queue.uninstalled.forEach(function(u) {
@@ -388,35 +346,12 @@ function PlatformMunger_process() {
         self.add_plugin_changes(u.plugin, u.vars, u.topLevel, true);
     });
 
-    platform_config = exports.get_platform_json(self.plugins_dir, self.platform);
-
     // Empty out installed/ uninstalled queues.
     platform_config.prepare_queue.uninstalled = [];
     platform_config.prepare_queue.installed = [];
-    // save platform json
-    exports.save_platform_json(platform_config, self.plugins_dir, self.platform);
 }
 /**** END of PlatformMunger ****/
 
-// TODO: move save/get_platform_json to be part of ConfigKeeper or ConfigFile
-// For now they are used in many places in plugman and cordova-cli and can
-// save the file bypassing the ConfigKeeper's cache.
-exports.get_platform_json = get_platform_json;
-function get_platform_json(plugins_dir, platform) {
-    checkPlatform(platform);
-
-    var projectJson = PlatformJson.load(plugins_dir, platform);
-    return projectJson.configJson;
-}
-
-exports.save_platform_json = save_platform_json;
-function save_platform_json(config, plugins_dir, platform) {
-    checkPlatform(platform);
-    var filePath = path.join(plugins_dir, platform + '.json');
-    var projectJson = new PlatformJson(filePath, platform, config);
-    projectJson.save();
-}
-
 /******************************************************************************
 * Utility functions
 ******************************************************************************/

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36ffb18d/cordova-lib/src/plugman/util/dependencies.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/dependencies.js b/cordova-lib/src/plugman/util/dependencies.js
index 63690de..df7e5a2 100644
--- a/cordova-lib/src/plugman/util/dependencies.js
+++ b/cordova-lib/src/plugman/util/dependencies.js
@@ -25,7 +25,6 @@
 var dep_graph = require('dep-graph'),
     path = require('path'),
     fs = require('fs'),
-    config_changes = require('./config-changes'),
     underscore = require('underscore'),
     xml_helpers = require('../../util/xml-helpers'),
     events = require('../../events'),
@@ -43,8 +42,8 @@ module.exports = package = {
         return path.join(plugins_dir, plugin_id, 'plugin.xml');
     },
 
-    generateDependencyInfo:function(plugins_dir, platform) {
-        var json = config_changes.get_platform_json(plugins_dir, platform);
+    generateDependencyInfo:function(platformJson, plugins_dir) {
+        var json = platformJson.root;
 
         // TODO: store whole dependency tree in plugins/[platform].json
         // in case plugins are forcefully removed...
@@ -82,12 +81,12 @@ module.exports = package = {
     },
 
     // Returns a list of top-level plugins which are (transitively) dependent on the given plugin.
-    dependents: function(plugin_id, plugins_dir, platform) {
+    dependents: function(plugin_id, plugins_dir, platformJson) {
         var depsInfo;
         if(typeof plugins_dir == 'object')
             depsInfo = plugins_dir;
         else
-            depsInfo = package.generateDependencyInfo(plugins_dir, platform);
+            depsInfo = package.generateDependencyInfo(platformJson, plugins_dir);
 
         var graph = depsInfo.graph;
         var tlps = depsInfo.top_level_plugins;
@@ -100,12 +99,12 @@ module.exports = package = {
 
     // Returns a list of plugins which the given plugin depends on, for which it is the only dependent.
     // In other words, if the given plugin were deleted, these dangling dependencies should be deleted too.
-    danglers: function(plugin_id, plugins_dir, platform) {
+    danglers: function(plugin_id, plugins_dir, platformJson) {
         var depsInfo;
         if(typeof plugins_dir == 'object')
             depsInfo = plugins_dir;
         else
-            depsInfo = package.generateDependencyInfo(plugins_dir, platform);
+            depsInfo = package.generateDependencyInfo(platformJson, plugins_dir);
 
         var graph = depsInfo.graph;
         var dependencies = graph.getChain(plugin_id);


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


Mime
View raw message