You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/08/27 20:43:23 UTC
android commit: Fix for cli with new node scripts
Updated Branches:
refs/heads/master 1bd490098 -> b1d878850
Fix for cli with new node scripts
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b1d87885
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b1d87885
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b1d87885
Branch: refs/heads/master
Commit: b1d8788506eda67394463dac1a23dd53d2849416
Parents: 1bd4900
Author: Benn Mapes <be...@gmail.com>
Authored: Tue Aug 27 11:41:54 2013 -0700
Committer: Benn Mapes <be...@gmail.com>
Committed: Tue Aug 27 11:41:54 2013 -0700
----------------------------------------------------------------------
bin/create | 39 +++++++++++++++++++++++++++++---------
bin/lib/create.js | 7 -------
bin/templates/cordova/version | 4 +++-
3 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b1d87885/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 0c2b796..29c129b 100755
--- a/bin/create
+++ b/bin/create
@@ -18,15 +18,36 @@
specific language governing permissions and limitations
under the License.
*/
-
-var create = require('./lib/create');
+var path = require('path');
var args = process.argv;
-// Support basic help commands
-if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
- args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
- create.help();
-} else {
- create.run(args[2], args[3], args[4]);
- process.exit(0);
+try {
+ require.resolve("shelljs");
+ create();
+} catch(e) {
+ console.log('Shelljs module was not found, running \'npm install\'.....');
+ var exec = require('child_process').exec;
+ var cwd = process.cwd();
+ process.chdir(__dirname);
+ exec('npm install', function (error, stdout, stderr) {
+ if (error !== null) {
+ console.error('ERROR : running \'npm install\' is npm installed? ' + error);
+ console.error(stderr);
+ process.exit(error.code);
+ }
+ process.chdir(cwd);
+ create();
+ });
+}
+
+function create() {
+ var create = require('./lib/create');
+ // Support basic help commands
+ if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
+ args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
+ create.help();
+ } else {
+ create.run(args[2], args[3], args[4]);
+ process.exit(0);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b1d87885/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 4a7294c..f27132b 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -18,13 +18,6 @@
specific language governing permissions and limitations
under the License.
*/
-try {
- require.resolve("shelljs");
-} catch(e) {
- console.error('Shelljs module was not found, please run \'npm install\' from the bin folder.');
- process.exit(e.code);
-}
-
var shell = require('shelljs'),
path = require('path'),
fs = require('fs'),
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b1d87885/bin/templates/cordova/version
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version
index f280e13..1b9dbf6 100755
--- a/bin/templates/cordova/version
+++ b/bin/templates/cordova/version
@@ -26,6 +26,8 @@ var args = process.argv;
if(args.length > 2) {
version.help();
} else {
- console.log(version.run());
+ // TODO : Don't have this hardcoded into the scripts
+ console.log('3.1.0-dev');
+ //console.log(version.run());
process.exit(0);
}
\ No newline at end of file