You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/05/21 00:12:08 UTC
ios commit: CB-8730 - Can't deploy to device
Repository: cordova-ios
Updated Branches:
refs/heads/4.0.x 2765ada89 -> ba7bafdbd
CB-8730 - Can't deploy to device
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ba7bafdb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ba7bafdb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ba7bafdb
Branch: refs/heads/4.0.x
Commit: ba7bafdbd8d4dab29899a7a804a6bf8ad6893e51
Parents: 2765ada
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed May 20 15:12:06 2015 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed May 20 15:12:06 2015 -0700
----------------------------------------------------------------------
bin/templates/scripts/cordova/lib/run.js | 45 ++++++++++++++++++++-------
1 file changed, 34 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ba7bafdb/bin/templates/scripts/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/run.js b/bin/templates/scripts/cordova/lib/run.js
index ea9ec72..b9f64eb 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -64,23 +64,46 @@ module.exports.run = function (argv) {
});
}
- // check for either ios-sim or ios-deploy is available
- // depending on arguments provided
- var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim();
-
- return checkTools.then(function () {
- // if --nobuild isn't specified then build app first
+ var useDevice = false;
+
+ return require('./list-devices').run()
+ .then(function (devices) {
+ if (devices.length > 0 && !(args.emulator)) {
+ useDevice = true;
+ return check_reqs.check_ios_deploy();
+ } else {
+ return check_reqs.check_ios_sim();
+ }
+ }).then(function () {
if (!args.nobuild) {
+ if (useDevice) {
+ // remove emulator, add device
+ var idx = argv.indexOf("--emulator");
+ if (idx != -1) {
+ array.splice(idx, 1);
+ }
+ argv.push("--device");
+ } else {
+ // remove device, add emulator
+ var idx = argv.indexOf("--device");
+ if (idx != -1) {
+ array.splice(idx, 1);
+ }
+ argv.push("--emulator");
+ }
return build.run(argv);
+ } else {
+ return Q.resolve();
}
}).then(function () {
return build.findXCodeProjectIn(projectPath);
}).then(function (projectName) {
- var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app');
+ var appPath = path.join(projectPath, 'build', 'emulator', projectName + '.app');
// select command to run and arguments depending whether
// we're running on device/emulator
- if (args.device) {
+ if (useDevice) {
return checkDeviceConnected().then(function () {
+ appPath = path.join(projectPath, 'build', 'device', projectName + '.app');
return deployToDevice(appPath, args.target);
}, function () {
// if device connection check failed use emulator then
@@ -97,7 +120,7 @@ module.exports.run = function (argv) {
* @return {Promise} Fullfilled when any device is connected, rejected otherwise
*/
function checkDeviceConnected() {
- return spawn('ios-deploy', ['-c']);
+ return spawn('ios-deploy', ['-c', '-t', '1']);
}
/**
@@ -109,9 +132,9 @@ function checkDeviceConnected() {
function deployToDevice(appPath, target) {
// Deploying to device...
if (target) {
- return spawn('ios-deploy', ['-d', '-b', appPath, '-i', target]);
+ return spawn('ios-deploy', ['--justlaunch', '-d', '-b', appPath, '-i', target]);
} else {
- return spawn('ios-deploy', ['-d', '-b', appPath]);
+ return spawn('ios-deploy', ['--justlaunch', '-d', '-b', appPath]);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org