Updated Branches:
  refs/heads/cordova-client 380c45e70 -> ed8721f5e

added documentation on how to edit app name via config.xml. related specs to 
configuring with config.xml


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/ed8721f5
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/ed8721f5
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/ed8721f5

Branch: refs/heads/cordova-client
Commit: ed8721f5ea3794172994e676b6d0161295b4da21
Parents: a8379e6
Author: Fil Maj <maj....@gmail.com>
Authored: Fri Sep 21 14:43:58 2012 -0700
Committer: Fil Maj <maj....@gmail.com>
Committed: Fri Sep 21 14:43:58 2012 -0700

----------------------------------------------------------------------
 README.md                        |    5 +++++
 spec/build.spec.js               |    2 +-
 spec/metadata/ios_parser.spec.js |   18 ++++++++++++++----
 spec/platform.spec.js            |    2 +-
 src/metadata/ios_parser.js       |    3 ++-
 src/platform.js                  |    7 +++----
 6 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index bdf7917..9f92aa5 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,11 @@ any added plugins will be extracted into this directory
 ### www/
 Contains the project's web artifacts, such as .html, .css and .js files. These 
are your main application assets.
 
+#### Your Blanket: www/config.xml 
+
+This file is what you should be editing to modify your application's metadata. 
Any time you run any cordova-client commands, the tool will look at the 
contents of `config.xml` and use all relevant info from this file to define 
native application information. cordova-client supports changing your 
application's data via the following elements inside the `config.xml` file:
+
+- The user-facing name can be modified via the contents of the `<name>` 
element.
 
 # Examples
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index 45a48b9..3346ca1 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -110,7 +110,7 @@ describe('build command', function() {
                 var binaryPath = path.join(tempDir, 'platforms','ios','build');
                 expect(fs.existsSync(binaryPath)).toBe(true);
 
-                var appPath = path.join(binaryPath,"Hello_Cordova.app");
+                var appPath = path.join(binaryPath,"Hello Cordova.app");
                 expect(fs.existsSync(appPath)).toBe(true);
             });
         });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/spec/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/ios_parser.spec.js b/spec/metadata/ios_parser.spec.js
index aeb95d0..967be6e 100644
--- a/spec/metadata/ios_parser.spec.js
+++ b/spec/metadata/ios_parser.spec.js
@@ -40,12 +40,22 @@ describe('ios project parser', function() {
             }).toThrow();
         });
         it('should update the application name properly', function() {
-            config.name('bond. james bond.');
-            project.update_from_config(config);
+            var cb = jasmine.createSpy();
+            this.after(function() {
+                fs.writeFileSync(ios_pbx, original_pbx, 'utf-8');
+            });
 
-            var pbx_contents = fs.readFileSync(ios_pbx, 'utf-8');
+            runs(function() {
+                config.name('bond. james bond.');
+                project.update_from_config(config, cb);
+            });
 
-            expect(pbx_contents.match(/PRODUCT_NAME\s*=\s*"bond. james 
bond."/)[0]).toBe('PRODUCT_NAME = "bond. james bond."');
+            waitsFor(function() { return cb.wasCalled; }, "update_from_config 
callback");
+
+            runs(function() {
+                var pbx_contents = fs.readFileSync(ios_pbx, 'utf-8');
+                expect(pbx_contents.match(/PRODUCT_NAME\s*=\s*"bond. james 
bond."/)[0]).toBe('PRODUCT_NAME = "bond. james bond."');
+            });
         });
         it('should update the application package name properly');
     });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/platform.spec.js b/spec/platform.spec.js
index a6980f5..f7b1649 100644
--- a/spec/platform.spec.js
+++ b/spec/platform.spec.js
@@ -153,7 +153,7 @@ describe('platform command', function() {
                 waitsFor(function() { return cb.wasCalled; }, "platform add 
ios callback");
                 runs(function() {
                     var pbxproj = fs.readFileSync(path.join(tempDir, 
'platforms', 'ios', 
'upon_closer_inspection_they_appear_to_be_loafers.xcodeproj', 
'project.pbxproj'), 'utf-8');
-                    expect(pbxproj.match(/PRODUCT_NAME\s*=\s*"upon futher 
inspection they appear to be loafers"/)).toBe(true);
+                    expect(pbxproj.match(/PRODUCT_NAME\s*=\s*"upon closer 
inspection they appear to be loafers"/)[0]).toBe('PRODUCT_NAME = "upon closer 
inspection they appear to be loafers"');
                 });
             });
         });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 53a4dc6..26eb498 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -16,7 +16,7 @@ module.exports = function ios_parser(project) {
     this.pbxproj = path.join(this.xcodeproj, 'project.pbxproj');
 };
 module.exports.prototype = {
-    update_from_config:function(config) {
+    update_from_config:function(config, callback) {
         if (config instanceof config_parser) {
         } else throw 'update_from_config requires a config_parser object';
 
@@ -35,6 +35,7 @@ module.exports.prototype = {
             else {
                 proj.updateProductName(name);
                 fs.writeFileSync(parser.pbxproj, proj.writeSync(), 'utf-8');
+                if (callback) callback();
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/ed8721f5/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index e182f0b..2daaab9 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -90,19 +90,18 @@ module.exports = function platform(command, target, 
callback) {
                     if (bfrs.err) {
                         throw ('An error occured during creation of ' + target 
+ ' sub-project. ' + bfrs.err);
                     } else {
+                        cfg.add_platform(target);
                         switch(target) {
                             case 'android':
                                 var android = new android_parser(output);
                                 android.update_from_config(cfg);
+                                if (callback) callback();
                                 break;
                             case 'ios':
                                 var ios = new ios_parser(output);
-                                ios.update_from_config(cfg);
+                                ios.update_from_config(cfg, callback);
                                 break;
                         }
-                        // Add the platform to config.xml
-                        cfg.add_platform(target);
-                        if (callback) callback();
                     }
                 }
             });

Reply via email to