You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/07/16 21:13:08 UTC
[1/2] git commit: Revert "[CB-4268] [BlackBerry10] Remove custom BB
run logic (moving to cordova-blackberry)"
Updated Branches:
refs/heads/master 1fb3d50f3 -> 4b15c4565
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/master
Commit: 5a40a4cab7b9a9d8c6b6aadebcad9ff054eafab5
Parents: 1fb3d50
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Jul 16 12:09:28 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
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);
[2/2] git commit: Revert "[CB-4270] [BlackBerry10] Remove custom
emulate logic (moving to cordova-blackberry)"
Posted by fi...@apache.org.
Revert "[CB-4270] [BlackBerry10] Remove custom emulate logic (moving to cordova-blackberry)"
This reverts commit 2782d5ece23c1536239f4c9944179926709298b2.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/4b15c456
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/4b15c456
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/4b15c456
Branch: refs/heads/master
Commit: 4b15c4565765e62798221ea4bf6a507ddcb809dc
Parents: 5a40a4c
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Jul 16 12:09:49 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Jul 16 12:09:49 2013 -0700
----------------------------------------------------------------------
spec/emulate.spec.js | 21 +++++++++++++++++++++
src/emulate.js | 14 ++++++++++++++
2 files changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4b15c456/spec/emulate.spec.js
----------------------------------------------------------------------
diff --git a/spec/emulate.spec.js b/spec/emulate.spec.js
index 03151e3..d9f505f 100644
--- a/spec/emulate.spec.js
+++ b/spec/emulate.spec.js
@@ -54,6 +54,15 @@ describe('emulate command', function() {
cordova.emulate();
}).toThrow('Current working directory is not a Cordova-based project.');
});
+ it('should throw if no BlackBerry simulator targets exist and blackberry is to be emulated', function() {
+ var bb_project = path.join(project_dir, 'platforms', 'blackberry');
+ spyOn(platforms.blackberry, 'parser').andReturn({
+ has_simulator_target:function() { return false; }
+ });
+ expect(function() {
+ cordova.emulate('blackberry');
+ }).toThrow('No BlackBerry simulator targets defined. If you want to run emulate with BB10, please add a simulator target. For more information run "' + path.join(bb_project, 'cordova', 'target') + '" -h');
+ });
});
describe('success', function() {
@@ -65,6 +74,18 @@ describe('emulate command', function() {
done();
});
});
+ it('should execute a different BlackBerry-specific command to emulate blackberry', function() {
+ var bb_project = path.join(project_dir, 'platforms', 'blackberry');
+ spyOn(platforms.blackberry, 'parser').andReturn({
+ has_simulator_target:function() { return true; },
+ get_simulator_targets:function() { return [{name:'fifi'}]; },
+ get_cordova_config:function() { return {signing_password:'secret'}; }
+ });
+ expect(function() {
+ cordova.emulate('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/4b15c456/src/emulate.js
----------------------------------------------------------------------
diff --git a/src/emulate.js b/src/emulate.js
index b9cbe70..d41d01c 100644
--- a/src/emulate.js
+++ b/src/emulate.js
@@ -29,6 +29,20 @@ var cordova_util = require('./util'),
function shell_out_to_emulate(root, platform, error_callback, done) {
var cmd = '"' + path.join(root, 'platforms', platform, 'cordova', 'run') + '" --emulator';
+ // TODO: inconsistent API for BB10 run command
+ if (platform == 'blackberry') {
+ var bb_project = path.join(root, 'platforms', 'blackberry')
+ var project = new platforms.blackberry.parser(bb_project);
+ if (project.has_simulator_target()) {
+ var bb_config = project.get_cordova_config();
+ var sim = project.get_simulator_targets()[0].name;
+ cmd = '"' + path.join(bb_project, 'cordova', 'run') + '" --target=' + sim + ' -k ' + bb_config.signing_password;
+ } else {
+ var err = new Error('No BlackBerry simulator targets defined. If you want to run emulate with BB10, please add a simulator target. For more information run "' + path.join(bb_project, 'cordova', 'target') + '" -h');
+ if (error_callback) return error_callback(err);
+ else throw err;
+ }
+ }
events.emit('log', 'Running on emulator for platform "' + platform + '" via command "' + cmd + '" (output to follow)...');
shell.exec(cmd, {silent:true, async:true}, function(code, output) {
events.emit('log', output);