Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0E9E2197CE for ; Thu, 21 Apr 2016 23:40:42 +0000 (UTC) Received: (qmail 53955 invoked by uid 500); 21 Apr 2016 23:40:42 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 53926 invoked by uid 500); 21 Apr 2016 23:40:41 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 53917 invoked by uid 99); 21 Apr 2016 23:40:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2016 23:40:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 71529DFF48; Thu, 21 Apr 2016 23:40:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: omefire@apache.org To: commits@cordova.apache.org Message-Id: <607173e4cd2440f6b4626cfb92d02fe7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-medic git commit: CB-11135 iOS Contacts Perms: Handle case where 'cordova-cli' install not global Date: Thu, 21 Apr 2016 23:40:41 +0000 (UTC) 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 Authored: Thu Apr 21 14:05:52 2016 -0700 Committer: Omar Mefire 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