You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2015/03/23 23:03:37 UTC
[3/8] cordova-lib git commit: Support the old 4-argument version of
create again
Support the old 4-argument version of create again
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/9bddb201
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/9bddb201
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/9bddb201
Branch: refs/heads/master
Commit: 9bddb201bac4db4627e7b896e1e04a0b4fbf818a
Parents: 9b7d9e3
Author: Michal Mocny <mm...@gmail.com>
Authored: Wed Mar 4 13:53:37 2015 -0500
Committer: Michal Mocny <mm...@gmail.com>
Committed: Wed Mar 4 13:54:24 2015 -0500
----------------------------------------------------------------------
cordova-lib/src/cordova/create.js | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/9bddb201/cordova-lib/src/cordova/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/create.js b/cordova-lib/src/cordova/create.js
index 4962a75..d5bebd7 100644
--- a/cordova-lib/src/cordova/create.js
+++ b/cordova-lib/src/cordova/create.js
@@ -32,14 +32,25 @@ var path = require('path'),
/**
* Usage:
* @dir - directory where the project will be created. Required.
+ * @optionalId - app id. Optional.
+ * @optionalName - app name. Optional.
* @cfg - extra config to be saved in .cordova/config.json
**/
// Returns a promise.
module.exports = create;
-function create(dir, cfg) {
+function create(dir, optionalId, optionalName, cfg) {
return Q.fcall(function() {
// Lets check prerequisites first
+ if (arguments.length == 3) {
+ cfg = optionalName;
+ optionalName = undefined;
+ } else if (arguments.length == 2) {
+ cfg = optionalId;
+ optionalId = undefined;
+ optionalName = undefined;
+ }
+
if (!dir) {
throw new CordovaError('At least the dir must be provided to create new project. See `' + cordova_util.binname + ' help`.');
}
@@ -50,6 +61,9 @@ function create(dir, cfg) {
}
}
+ if (optionalId) cfg.id = optionalId;
+ if (optionalName) cfg.name = optionalName;
+
// Make absolute.
dir = path.resolve(dir);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org