You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/11/28 19:16:24 UTC

[29/50] git commit: Fixes #47. Removed node-plist as dependency. Used simpler regex to do string/replace.

Fixes #47. Removed node-plist as dependency. Used simpler regex to do string/replace.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/50e1084b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/50e1084b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/50e1084b

Branch: refs/heads/master
Commit: 50e1084b546d67155e01a5f5e616164264400df5
Parents: c498bab
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Oct 22 15:39:31 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Oct 22 15:39:31 2012 -0700

----------------------------------------------------------------------
 package.json                     |    1 -
 spec/metadata/ios_parser.spec.js |    2 +-
 src/metadata/ios_parser.js       |    7 +++----
 3 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/50e1084b/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index a5b983a..a2fd2eb 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,6 @@
     "elementtree":"0.1.3",
     "pluginstall":"git://github.com/imhotep/pluginstall.git#0.3.4",
     "xcode":"0.5.1",
-    "plist":"0.4.0",
     "express":"3.0",
     "shelljs":"0.0.7",
     "ncallbacks":"1.0.0",

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/50e1084b/spec/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/ios_parser.spec.js b/spec/metadata/ios_parser.spec.js
index 1388586..266c06d 100644
--- a/spec/metadata/ios_parser.spec.js
+++ b/spec/metadata/ios_parser.spec.js
@@ -79,7 +79,7 @@ describe('ios project parser', function() {
 
             runs(function() {
                 var plist_contents = fs.readFileSync(ios_plist, 'utf-8');
-                expect(plist_contents.match(/<string>ca.filmaj.dewd/));
+                expect(plist_contents).toMatch(/<string>ca.filmaj.dewd/);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/50e1084b/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 1e826df..a2a877d 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -1,7 +1,6 @@
 var fs   = require('fs'),
     path = require('path'),
     xcode = require('xcode'),
-    plist = require('plist'),
     util = require('../util'),
     shell = require('shelljs'),
     config_parser = require('../config_parser');
@@ -29,9 +28,9 @@ module.exports.prototype = {
 
         // Update package id (bundle id)
         var plistFile = path.join(this.cordovaproj, this.originalName + '-Info.plist');
-        var plistObj = plist.parseFileSync(plistFile);
-        plistObj.CFBundleIdentifier = pkg;
-        fs.writeFileSync(plistFile, plist.build(plistObj));
+        var contents = fs.readFileSync(plistFile, 'utf-8');
+        contents = contents.replace(/<key>CFBundleIdentifier<\/key>\s*<string>.*<\/string>/i, '<key>CFBundleIdentifier</key><string>' + pkg + '</string>');
+        fs.writeFileSync(plistFile, contents, 'utf-8');
 
         // Update product name
         var proj = new xcode.project(this.pbxproj);