cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject git commit: CB-6542: Delay creating project until there's some chance that it will succeed
Date Wed, 18 Jun 2014 22:19:33 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 27bfd651b -> ba59ae9c9


CB-6542: Delay creating project until there's some chance that it will succeed

github: close #34


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

Branch: refs/heads/master
Commit: ba59ae9c9fb20c72b9bd76c4b277cf2a8c64258f
Parents: 27bfd65
Author: Josh Soref <jsoref@blackberry.com>
Authored: Wed Jun 18 18:13:23 2014 -0400
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Wed Jun 18 18:18:29 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/create.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ba59ae9c/cordova-lib/src/cordova/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/create.js b/cordova-lib/src/cordova/create.js
index a5dee41..99cb3cf 100644
--- a/cordova-lib/src/cordova/create.js
+++ b/cordova-lib/src/cordova/create.js
@@ -86,6 +86,7 @@ function create(dir, id, name, cfg) {
     }
 
     // Read / Write .cordova/config.json file if necessary.
+    config.setAutoPersist(false);
     var config_json = config(dir, cfg);
 
     var p;
@@ -134,6 +135,7 @@ function create(dir, id, name, cfg) {
     }
 
     return p.then(function(www_lib) {
+        var cfg, config_json;
         if (!fs.existsSync(www_lib)) {
             throw new CordovaError('Could not find directory: '+www_lib);
         }
@@ -143,6 +145,10 @@ function create(dir, id, name, cfg) {
             www_lib = path.join(www_lib, 'www');
         }
 
+        cfg = config.read(dir);
+        config.setAutoPersist(true);
+        config_json = config(dir, cfg);
+
         // Find if we also have custom merges and config.xml as siblings of custom www.
         if (www_parent_dir && config_json.lib && config_json.lib.www) {
             custom_config_xml = path.join(www_parent_dir, 'config.xml');
@@ -217,10 +223,10 @@ function create(dir, id, name, cfg) {
             var template_config_xml = path.join(__dirname, '..', '..', 'templates', 'config.xml');
             shell.cp(template_config_xml, configPath);
             // Write out id and name to config.xml
-            var config = new ConfigParser(configPath);
-            config.setPackageName(id);
-            config.setName(name);
-            config.write();
+            var conf = new ConfigParser(configPath);
+            conf.setPackageName(id);
+            conf.setName(name);
+            conf.write();
         }
     });
 }


Mime
View raw message