You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by om...@apache.org on 2016/04/22 01:40:41 UTC
cordova-medic git commit: CB-11135 iOS Contacts Perms: Handle case
where 'cordova-cli' install not global
Repository: cordova-medic
Updated Branches:
refs/heads/master f02a5b05b -> 9660ca551
CB-11135 iOS Contacts Perms: Handle case where 'cordova-cli' install not global
This closes #96
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/9660ca55
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/9660ca55
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/9660ca55
Branch: refs/heads/master
Commit: 9660ca551fd7e90767f291ede48f06147e389486
Parents: f02a5b0
Author: Omar Mefire <om...@gmail.com>
Authored: Thu Apr 21 14:05:52 2016 -0700
Committer: Omar Mefire <om...@gmail.com>
Committed: Thu Apr 21 16:39:22 2016 -0700
----------------------------------------------------------------------
lib/util.js | 16 +++++++++++++---
medic/medic-run.js | 20 ++++++--------------
2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/9660ca55/lib/util.js
----------------------------------------------------------------------
diff --git a/lib/util.js b/lib/util.js
index 110cf7d..8bc894a 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -39,6 +39,17 @@ module.exports = (function() {
console.log(RED_COLOR + "[MEDIC LOG " + new Date().toUTCString() + "]" + NO_COLOR + " " + message);
}
+ function getLocalCLI(appPath) {
+ var cli;
+ if (isWindows()) {
+ cli = "cordova.bat";
+ } else {
+ cli = "./cordova";
+ }
+
+ return appPath ? path.join(appPath, cli) : cli;
+ }
+
function contains(collection, item) {
return collection.indexOf(item) !== (-1);
}
@@ -82,7 +93,7 @@ module.exports = (function() {
}
function getSimId() {
- var findSimCommand = "cordova run --list --emulator | grep ^iPhone | tail -n1";
+ var findSimCommand = getLocalCLI() + " run --list --emulator | grep ^iPhone | tail -n1";
medicLog("running:");
medicLog(" " + findSimCommand);
@@ -95,12 +106,10 @@ module.exports = (function() {
}
var split = findSimResult.output.split(", ");
-
// Format of the output is "iPhone-6s-Plus, 9.1"
// Extract the device name and the version number
var device = split[0].replace(/-/g, " ").trim();
var version = split[1].trim();
- medicLog("device: " + device);
// Next, figure out the ID of the simulator we found
var instrCommand = "instruments -s devices | grep ^iPhone";
@@ -170,6 +179,7 @@ module.exports = (function() {
getSimulatorsFolder: getSimulatorsFolder,
getSimId: getSimId,
doesFileExist: doesFileExist,
+ getLocalCLI: getLocalCLI,
getSqlite3InsertionCommand: getSqlite3InsertionCommand
};
} ());
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/9660ca55/medic/medic-run.js
----------------------------------------------------------------------
diff --git a/medic/medic-run.js b/medic/medic-run.js
index 7b57898..a2b3b71 100644
--- a/medic/medic-run.js
+++ b/medic/medic-run.js
@@ -50,7 +50,7 @@ var SERVER_RESPONSE_TIMEOUT = 15000; // in milliseconds
var MAX_NUMBER_OF_TRIES = 3;
var WAIT_TIME_TO_RETRY_CONNECTION = 15000; // in milliseconds
-// Used to grant appropriate iOS permissions
+// Used to grant appropriate iOS permissions
var IOS_APPS_TO_GRANT_PERMISSIONS = ['kTCCServiceAddressBook'];
var IOS_SIM_FOLDER = "/Users/buildbot/Library/Developer/CoreSimulator/Devices/";
var IOS_TCC_DB_FOLDER = "/Users/buildbot/Library/Application\ Support/com.apple.TCC/";
@@ -251,27 +251,19 @@ function windowsSpecificPreparation(argv) {
function iOSSpecificPreparation(argv) {
var extraArgs = "";
-
+
util.medicLog("Granting iOS permissions: ");
-
+
var appName = argv.app;
var simulatorsFolder = argv.simulatorsFolder;
var tccDbPath = argv.tccDbPath;
-
+
if(appName && simulatorsFolder && tccDbPath) {
var medicPerms = new MedicIOSPermissions(appName, simulatorsFolder, tccDbPath);
medicPerms.updatePermissions(IOS_APPS_TO_GRANT_PERMISSIONS);
}
-
- return extraArgs;
-}
-function getLocalCLI() {
- if (util.isWindows()) {
- return "cordova.bat";
- } else {
- return "./cordova";
- }
+ return extraArgs;
}
function cordovaReturnedError(returnCode, output) {
@@ -367,7 +359,7 @@ function main() {
var workingDir = process.cwd();
- var cli = getLocalCLI();
+ var cli = util.getLocalCLI();
// check that the app exists
if (!fs.existsSync(appPath)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org