Updated Branches:
  refs/heads/master2 262a2f9c9 -> 513724cfd

Fix for [CB-3836]. Clarified BB10 requirements and updated blackberry min reqs 
check.


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

Branch: refs/heads/master2
Commit: 513724cfdb20314139cfc1fa82407c21d22a97e4
Parents: 262a2f9
Author: Fil Maj <[email protected]>
Authored: Thu Jun 20 14:16:25 2013 -0700
Committer: Fil Maj <[email protected]>
Committed: Thu Jun 20 14:16:25 2013 -0700

----------------------------------------------------------------------
 README.md                               |  2 +-
 spec/metadata/blackberry_parser.spec.js | 20 ++++++++++----------
 src/metadata/blackberry_parser.js       | 12 +++++++-----
 3 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/513724cf/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 0a529de..ec5b8ce 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Check out the [Getting Started 
guides](http://cordova.apache.org/docs/en/edge/gu
 
 * [nodejs](http://nodejs.org/)
 * SDKs for every platform you wish to support
-  - BlackBerry 10: [BlackBerry 10 WebWorks 
SDK](http://developer.blackberry.com/html5/download/) as well as the 
[BlackBerry 10 NDK](http://developer.blackberry.com/native/download/). You will 
also need to have the NDK environment variables on your path by running 
`bb10ndk/bbndk-env.sh`.
+  - BlackBerry 10: [BlackBerry 10 WebWorks 
SDK](http://developer.blackberry.com/html5/download/). Make sure you have the 
`dependencies/tools/bin` folder inside the SDK directory added to your path!
   - iOS: [iOS SDK](http://developer.apple.com) with the latest Xcode and Xcode 
Command Line Tools
   - [Android SDK](http://developer.android.com) - **NOTE** This tool
     will not work unless you have the absolute latest updates for all

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/513724cf/spec/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/blackberry_parser.spec.js 
b/spec/metadata/blackberry_parser.spec.js
index ed6da9e..1203666 100644
--- a/spec/metadata/blackberry_parser.spec.js
+++ b/spec/metadata/blackberry_parser.spec.js
@@ -30,16 +30,14 @@ var platforms = require('../../platforms'),
 
 describe('blackberry project parser', function() {
     var proj = '/some/path';
-    var exists, custom, config_p;
-    var proc = process.env.QNX_HOST;
+    var exists, custom, config_p, sh;
     beforeEach(function() {
         exists = spyOn(fs, 'existsSync').andReturn(true);
         custom = spyOn(config, 'has_custom_path').andReturn(false);
-        process.env.QNX_HOST = 'something';
         config_p = spyOn(util, 'config_parser');
-    });
-    afterEach(function() {
-        process.env.QNX_HOST = proc;
+        sh = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) {
+            cb(0, '');
+        });
     });
 
     describe('constructions', function() {
@@ -59,14 +57,16 @@ describe('blackberry project parser', function() {
     });
 
     describe('check_requirements', function() {
-        it('should fire a callback if the QNX_HOST environment variable is not 
deinfed', function(done) {
-            process.env.QNX_HOST = '';
+        it('should fire a callback if the blackberry-deploy shell-out fails', 
function(done) {
+            sh.andCallFake(function(cmd, opts, cb) {
+                cb(1, 'no bb-deploy dewd!');
+            });
             platforms.blackberry.parser.check_requirements(proj, function(err) 
{
-                expect(err).toContain('QNX_HOST is missing');
+                expect(err).toContain('no bb-deploy dewd');
                 done();
             });
         });
-        it('should fire a callback with no error if QNX_HOST variable exists', 
function(done) {
+        it('should fire a callback with no error if shell out is successful', 
function(done) {
             platforms.blackberry.parser.check_requirements(proj, function(err) 
{
                 expect(err).toEqual(false);
                 done();

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/513724cf/src/metadata/blackberry_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/blackberry_parser.js 
b/src/metadata/blackberry_parser.js
index b8ef09e..691d882 100644
--- a/src/metadata/blackberry_parser.js
+++ b/src/metadata/blackberry_parser.js
@@ -36,11 +36,13 @@ module.exports = function blackberry_parser(project) {
 };
 
 module.exports.check_requirements = function(project_root, callback) {
-    if (process.env && process.env.QNX_HOST) {
-        callback(false);
-    } else {
-        callback('The BB10NDK environment variable QNX_HOST is missing. Make 
sure you run `source <path to bb10ndk>/bbndk-env.sh`. Even better, add 
`source`ing that script to your .bash_profile or equivalent so you don\'t have 
to do it manually every time.');
-    }
+    shell.exec('blackberry-deploy', {silent:true, async:true}, function(code, 
output) {
+        if (code > 0) {
+            callback('The binary `blackberry-deploy` was not found. Make sure 
you have the latest BlackBerry 10 WebWorks SDK installed, and have its 
/dependencies/tools/bin folder added to your PATH! Error output: ' + output);
+        } else {
+            callback(false);
+        }
+    });
 };
 
 module.exports.prototype = {

Reply via email to