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:04 UTC

[03/15] git commit: inital commit of cli create command logic in its own file

inital commit of cli create command logic in its own file


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

Branch: refs/heads/master
Commit: fa09acdb7be5d31255ff990c43c255d2b9994b0d
Parents: 0092621
Author: Lorin Beer <lo...@gmail.com>
Authored: Fri Jun 13 12:28:13 2014 -0700
Committer: Lorin Beer <lo...@gmail.com>
Committed: Wed Aug 20 11:15:59 2014 -0700

----------------------------------------------------------------------
 src/create.js | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/fa09acdb/src/create.js
----------------------------------------------------------------------
diff --git a/src/create.js b/src/create.js
new file mode 100644
index 0000000..54ac32c
--- /dev/null
+++ b/src/create.js
@@ -0,0 +1,45 @@
+
+
+
+/**
+ * provides logic for exposing cordova-lib create functionality to the command line
+ * 
+ * 
+ */
+var CordovaCLICreate = function () {
+
+(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) {
+            if (customWww.indexOf(':') != -1) {
+                throw new CordovaError(
+                    'Only local paths for custom www assets are supported.'
+                );
+            }
+            if ( customWww.substr(0,1) === '~' ) {  // resolve tilde in a naive way.
+                customWww = path.join(process.env.HOME,  customWww.substr(1));
+            }
+            customWww = path.resolve(customWww);
+            var wwwCfg = { uri: customWww };
+            if (args['link-to']) {
+                wwwCfg.link = true;
+            }
+            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
+                          , undashed[3]  // App name
+                          , cfg
+        ).done();
+ 
+};
+
+module.exports = CordovaCLICreate;
+