Revert "[CB-4268] [BlackBerry10] Remove custom BB run logic (moving to cordova-blackberry)"
This reverts commit 686586fdc19e6aba82bce2a698c68cfcfa1d2b50. Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/5a40a4ca Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/5a40a4ca Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/5a40a4ca Branch: refs/heads/plugman-registry Commit: 5a40a4cab7b9a9d8c6b6aadebcad9ff054eafab5 Parents: 1fb3d50 Author: Fil Maj <[email protected]> Authored: Tue Jul 16 12:09:28 2013 -0700 Committer: Fil Maj <[email protected]> Committed: Tue Jul 16 12:09:28 2013 -0700 ---------------------------------------------------------------------- spec/run.spec.js | 21 +++++++++++++++++++++ src/run.js | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/5a40a4ca/spec/run.spec.js ---------------------------------------------------------------------- diff --git a/spec/run.spec.js b/spec/run.spec.js index 5d16dfd..02cf21d 100644 --- a/spec/run.spec.js +++ b/spec/run.spec.js @@ -54,6 +54,15 @@ describe('run command', function() { cordova.run(); }).toThrow('Current working directory is not a Cordova-based project.'); }); + it('should throw if no BlackBerry simulator targets exist and blackberry is to be rund', function() { + var bb_project = path.join(project_dir, 'platforms', 'blackberry'); + spyOn(platforms.blackberry, 'parser').andReturn({ + has_device_target:function() { return false; } + }); + expect(function() { + cordova.run('blackberry'); + }).toThrow('No BlackBerry device targets defined. If you want to run `run` with BB10, please add a device target. For more information run "' + path.join(bb_project, 'cordova', 'target') + '" -h'); + }); }); describe('success', function() { @@ -65,6 +74,18 @@ describe('run command', function() { done(); }); }); + it('should execute a different BlackBerry-specific command to run blackberry', function() { + var bb_project = path.join(project_dir, 'platforms', 'blackberry'); + spyOn(platforms.blackberry, 'parser').andReturn({ + has_device_target:function() { return true; }, + get_device_targets:function() { return [{name:'fifi'}]; }, + get_cordova_config:function() { return {signing_password:'secret'}; } + }); + expect(function() { + cordova.run('blackberry'); + expect(exec.mostRecentCall.args[0]).toMatch(/blackberry.cordova.run" --target=fifi -k secret/gi); + }).not.toThrow(); + }); }); describe('hooks', function() { http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/5a40a4ca/src/run.js ---------------------------------------------------------------------- diff --git a/src/run.js b/src/run.js index 4bca403..4110e1b 100644 --- a/src/run.js +++ b/src/run.js @@ -28,7 +28,7 @@ var cordova_util = require('./util'), function shell_out_to_run(projectRoot, platform, error_callback, done) { var cmd = '"' + path.join(projectRoot, 'platforms', platform, 'cordova', 'run') + '" --device'; // TODO: inconsistent API for BB10 run command -/* if (platform == 'blackberry') { + if (platform == 'blackberry') { var bb_project = path.join(projectRoot, 'platforms', 'blackberry') var project = new platforms.blackberry.parser(bb_project); if (project.has_device_target()) { @@ -41,7 +41,7 @@ function shell_out_to_run(projectRoot, platform, error_callback, done) { else throw err; } } -*/ + events.emit('log', 'Running app on platform "' + platform + '" with command "' + cmd + '" (output to follow)...'); shell.exec(cmd, {silent:true, async:true}, function(code, output) { events.emit('log', output);
