cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: 0.10.1. [CB-4455] Add a deprecation warning when used with <plugins-plist> elements for cordova-ios 2.2 and earlier projects.
Date Mon, 12 Aug 2013 22:10:44 GMT
Updated Branches:
  refs/heads/master 55dda303b -> 0d1815ed0


0.10.1. [CB-4455] Add a deprecation warning when used with <plugins-plist> elements
for cordova-ios 2.2 and earlier projects.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/0d1815ed
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/0d1815ed
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/0d1815ed

Branch: refs/heads/master
Commit: 0d1815ed0ef9d7571771ad99d448f4ac80ffc6ea
Parents: 55dda30
Author: Fil Maj <maj.fil@gmail.com>
Authored: Mon Aug 12 15:10:42 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Mon Aug 12 15:10:42 2013 -0700

----------------------------------------------------------------------
 package.json                     |  2 +-
 spec/util/config-changes.spec.js | 26 ++++++++++++++++++++++++++
 src/util/config-changes.js       |  6 +++++-
 3 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0d1815ed/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 2e3671a..6ce1ef5 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Andrew Lunny <alunny@gmail.com>",
   "name": "plugman",
   "description": "install/uninstall Cordova plugins",
-  "version": "0.10.0",
+  "version": "0.10.1",
 "repository": {
     "type": "git",
     "url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0d1815ed/spec/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/config-changes.spec.js b/spec/util/config-changes.spec.js
index a70fd58..ea6ecd0 100644
--- a/spec/util/config-changes.spec.js
+++ b/spec/util/config-changes.spec.js
@@ -3,6 +3,7 @@ var configChanges = require('../../src/util/config-changes'),
     ios_parser = require('../../src/platforms/ios'),
     fs      = require('fs'),
     os      = require('osenv'),
+    plugman = require('../../plugman'),
     et      = require('elementtree'),
     path    = require('path'),
     plist = require('plist'),
@@ -316,6 +317,18 @@ describe('config-changes module', function() {
                     configChanges.process(plugins_dir, temp, 'ios');
                     expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist').replace(/\\/g,
'/'));
                 });
+                it('should provide a deprecation warning message when used', function() {
+                    shell.cp('-rf', ios_plist_project, temp);
+                    shell.cp('-rf', dummyplugin, plugins_dir);
+                    var cfg = configChanges.get_platform_json(plugins_dir, 'ios');
+                    cfg.prepare_queue.installed = [{'plugin':'DummyPlugin', 'vars':{}}];
+                    configChanges.save_platform_json(cfg, plugins_dir, 'ios');
+
+                    spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+                    var spy = spyOn(plugman, 'emit');
+                    configChanges.process(plugins_dir, temp, 'ios');
+                    expect(spy).toHaveBeenCalledWith('warn', 'DEPRECATION WARNING: Plugin
"com.phonegap.plugins.dummyplugin" uses <plugins-plist> element(s), which are now deprecated.
Support will be removed in Cordova 3.4.');
+                });
             });
             it('should resolve wildcard config-file targets to the project, if applicable',
function() {
                 shell.cp('-rf', ios_config_xml, temp);
@@ -440,6 +453,19 @@ describe('config-changes module', function() {
                 configChanges.process(plugins_dir, temp, 'ios');
                 expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist').replace(/\\/g,
'/'));
             });
+            it('should provide a deprecation warning message when used', function() {
+                shell.cp('-rf', ios_plist_project, temp);
+                // install plugin
+                configChanges.add_installed_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin',
'ios', {});
+                configChanges.process(plugins_dir, temp, 'ios');
+                // set up an uninstall
+                configChanges.add_uninstalled_plugin_to_prepare_queue(plugins_dir, 'DummyPlugin',
'ios');
+
+                spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
+                var spy = spyOn(plugman, 'emit');
+                configChanges.process(plugins_dir, temp, 'ios');
+                expect(spy).toHaveBeenCalledWith('warn', 'DEPRECATION WARNING: Plugin "com.phonegap.plugins.dummyplugin"
uses <plugins-plist> element(s), which are now deprecated. Support will be removed in
Cordova 3.4.');
+            });
             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);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0d1815ed/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
index 25b4c1f..8f319ef 100644
--- a/src/util/config-changes.js
+++ b/src/util/config-changes.js
@@ -19,7 +19,7 @@
 
 /* 
  * This module deals with shared configuration / dependency "stuff". That is:
- * - XML configuration files such as config.xml or AndroidManifest.xml.
+ * - XML configuration files such as config.xml, AndroidManifest.xml or WMAppManifest.xml.
  * - plist files in iOS
  * - pbxproj files in iOS
  * Essentially, any type of shared resources that we need to handle with awareness
@@ -205,6 +205,8 @@ module.exports = {
                 if (global_munge[file]) {
                     Object.keys(config_munge[file]).forEach(function(key) {
                         if (global_munge[file][key] && plistObj) {
+                            // TODO: REMOVE in 3.4 (https://issues.apache.org/jira/browse/CB-4456)
+                            require('../../plugman').emit('warn', 'DEPRECATION WARNING: Plugin
"' + plugin_id + '" uses <plugins-plist> element(s), which are now deprecated. Support
will be removed in Cordova 3.4.');
                             delete plistObj.Plugins[key];
                             // TODO: don't write out on every change, do it once.
                             fs.writeFileSync(plistfile, plist.build(plistObj));
@@ -317,6 +319,8 @@ module.exports = {
                 if (file == 'plugins-plist' && platform == 'ios') {
                     var key = selector;
                     if (!global_munge[file][key] && plistObj) {
+                        // TODO: REMOVE in 3.4 (https://issues.apache.org/jira/browse/CB-4456)
+                        require('../../plugman').emit('warn', 'DEPRECATION WARNING: Plugin
"' + plugin_id + '" uses <plugins-plist> element(s), which are now deprecated. Support
will be removed in Cordova 3.4.');
                         // this key does not exist, so add it to plist
                         global_munge[file][key] = config_munge[file][key];
                         plistObj.Plugins[key] = config_munge[file][key];


Mime
View raw message