You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2014/08/21 20:23:07 UTC

[06/15] git commit: functional refactor of create with expected input from caller implemented

functional refactor of create with expected input from caller implemented


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

Branch: refs/heads/master
Commit: eeaca77c99a1816d770af5992613ad5b17b48b70
Parents: 1aef477
Author: Lorin Beer <lo...@gmail.com>
Authored: Fri Jun 13 13:05:16 2014 -0700
Committer: Lorin Beer <lo...@gmail.com>
Committed: Wed Aug 20 11:19:47 2014 -0700

----------------------------------------------------------------------
 src/create.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/eeaca77c/src/create.js
----------------------------------------------------------------------
diff --git a/src/create.js b/src/create.js
index 54ac32c..19d2acb 100644
--- a/src/create.js
+++ b/src/create.js
@@ -3,19 +3,22 @@
 
 /**
  * provides logic for exposing cordova-lib create functionality to the command line
+ * the create argument is implied from the call to this function, all other cl arguments should be passed in unmodified
  * 
- * 
+ * @args  - 
+ * @undashed 
  */
-var CordovaCLICreate = function () {
+var CordovaCLICreate = function (args, undashed) {
+    var cfg = {},
+        customWww;
 
-(cmd == 'create') {
-        var cfg = {};
         // If we got a fourth parameter, consider it to be JSON to init the config.
         if ( undashed[4] ) {
             cfg = JSON.parse(undashed[4]);
         }
-        var customWww = args['copy-from'] || args['link-to'];
-        if (customWww) {
+
+        // handle custom www
+        if (customWww = args['copy-from'] || args['link-to']) {
             if (customWww.indexOf(':') != -1) {
                 throw new CordovaError(
                     'Only local paths for custom www assets are supported.'
@@ -32,6 +35,7 @@ var CordovaCLICreate = function () {
             cfg.lib = cfg.lib || {};
             cfg.lib.www = wwwCfg;
         }
+
         // create(dir, id, name, cfg)
         cordova.raw.create( undashed[1]  // dir to create the project in
                           , undashed[2]  // App id