cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject git commit: [CB-5012]: No whitespace in empty plist string nodes.
Date Tue, 08 Oct 2013 21:50:58 GMT
Updated Branches:
  refs/heads/master f240acc53 -> 64ce537dd


[CB-5012]: No whitespace in empty plist string nodes.


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

Branch: refs/heads/master
Commit: 64ce537ddabd659d36d6dfc8b8fd4cdfbd8de5ac
Parents: f240acc
Author: Brett Rudd <brettrudd@gmail.com>
Authored: Mon Oct 7 18:07:52 2013 -0700
Committer: Brett Rudd <brettrudd@gmail.com>
Committed: Tue Oct 8 14:50:16 2013 -0700

----------------------------------------------------------------------
 spec/plugins/VariablePlugin/plugin.xml |  3 +++
 spec/util/config-changes.spec.js       | 10 ++++++++++
 src/util/config-changes.js             |  3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/64ce537d/spec/plugins/VariablePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/VariablePlugin/plugin.xml b/spec/plugins/VariablePlugin/plugin.xml
index b713bed..2b63d52 100644
--- a/spec/plugins/VariablePlugin/plugin.xml
+++ b/spec/plugins/VariablePlugin/plugin.xml
@@ -43,5 +43,8 @@
             <awesome value="$API_KEY" />
             <cfbundleid>$PACKAGE_NAME</cfbundleid>
         </config-file>
+        <config-file target="*-Info.plist" parent="APluginNode">
+            <string></string>
+        </config-file>
     </platform>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/64ce537d/spec/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/config-changes.spec.js b/spec/util/config-changes.spec.js
index ea6ecd0..1a088c0 100644
--- a/spec/util/config-changes.spec.js
+++ b/spec/util/config-changes.spec.js
@@ -281,6 +281,16 @@ describe('config-changes module', function() {
                     expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'res', 'xml', 'plugins.xml'),
'utf-8');
                 });
             });
+            describe('of plist config files', function() {
+                var xcode_add, xcode_rm;
+                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');
+                    expect(fs.readFileSync(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'),
'utf-8')).toMatch(/<key>APluginNode<\/key>\n    <string><\/string>/m);
+                });
+            });
             describe('of pbxproject framework files', function() {
                 var xcode_add, xcode_rm;
                 beforeEach(function() {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/64ce537d/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
index 7ebd8b8..351efa3 100644
--- a/src/util/config-changes.js
+++ b/src/util/config-changes.js
@@ -379,7 +379,8 @@ module.exports = {
                                         // TODO: could parse the filepath once per unique
target instead of on every change
                                         var plistObj = pl.parseFileSync(filepath);
                                         if (plist_helpers.graftPLIST(plistObj, xml_child,
selector)) {
-                                            fs.writeFileSync(filepath, plist.build(plistObj));
+                                            var regExp = new RegExp("<string>[ \t\r\n]+?</string>",
"g");
+                                            fs.writeFileSync(filepath, plist.build(plistObj).replace(regExp,
"<string></string>"));
                                         } else {
                                             throw new Error('grafting to plist "' + filepath
+ '" during config install went bad :(');
                                         }


Mime
View raw message