cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject android commit: CB-5422: Don't require JAVA_HOME to be defined
Date Fri, 29 Nov 2013 19:32:41 GMT
Updated Branches:
  refs/heads/master f1cfe2b07 -> 2f66ec60d


CB-5422: Don't require JAVA_HOME to be defined

JAVA_HOME is not necessarily defined on Linux and Mac.
Print out the value of JAVA_HOME in the error message
in case "java -version" fails.


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

Branch: refs/heads/master
Commit: 2f66ec60db8749bc442095560d5713b7bb718527
Parents: f1cfe2b
Author: Mark Koudritsky <kamrik@chromium.org>
Authored: Wed Nov 27 16:59:20 2013 -0500
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Fri Nov 29 14:31:48 2013 -0500

----------------------------------------------------------------------
 bin/lib/check_reqs.js | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2f66ec60/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 0697f77..5a71b0b 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -52,16 +52,18 @@ module.exports.check_ant = function() {
 
 // Returns a promise.
 module.exports.check_java = function() {
-    if(process.env.JAVA_HOME) {
-        var d = Q.defer();
-        child_process.exec('java -version', function(err, stdout, stderr) {
-            if(err) d.reject(new Error('ERROR : executing command \'java\', make sure you
java environment is set up. Including your JDK and JRE.' + err));
-            else d.resolve();
-        });
-        return d.promise;
-    } else {
-        return Q.reject(new Error('ERROR : Make sure JAVA_HOME is set, as well as paths to
your JDK and JRE for java.'));
-    }
+    var d = Q.defer();
+    child_process.exec('java -version', function(err, stdout, stderr) {
+        if(err) {
+            var msg =
+                'Failed to run \'java -version\', make sure your java environment is set
up\n' +
+                'including JDK and JRE.\n' +
+                'Your JAVA_HOME variable is ' + process.env.JAVA_HOME + '\n';
+            d.reject(new Error(msg + err));
+        }
+        else d.resolve();
+    });
+    return d.promise;
 }
 
 // Returns a promise.


Mime
View raw message