cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From riknoll <...@git.apache.org>
Subject [GitHub] cordova-paramedic pull request: Choose Target and use it for loggi...
Date Fri, 06 May 2016 22:36:11 GMT
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-paramedic/pull/5#discussion_r62400177
  
    --- Diff: lib/ParamedicAppUninstall.js ---
    @@ -0,0 +1,68 @@
    +var shelljs = require('shelljs');
    +var path    = require('path');
    +var fs      = require("fs");
    +var logger  = require('./utils').logger;
    +var util    = require('./utils').utilities;
    +
    +function ParamedicAppUninstall(appPath, platform) {
    +    this.appPath  = appPath;
    +    this.platform = platform;
    +}
    +
    +ParamedicAppUninstall.prototype.uninstallApp = function(targetObj, app) {
    +    if(!targetObj || !targetObj.target)
    +        return;
    +
    +    switch(this.platform) {
    +        case util.ANDROID:
    +            this.uninstallAppAndroid(targetObj, app);
    +            break;
    +        case util.IOS:
    +            this.uninstallAppIOS(targetObj, app);
    +            break;
    +        case util.WINDOWS:
    +            this.uninstallAppWindows(targetObj, app);
    +            break;
    +        default:
    +            break;
    +    }
    +}
    +
    +ParamedicAppUninstall.prototype.uninstallAppAndroid = function(targetObj, app) {
    +    var uninstallCommand = "adb -s " + targetObj.target + " uninstall " + app;
    +    logger.info("cordova-paramedic: Running command: " + uninstallCommand);
    +    var uninstallResult  = shelljs.exec(uninstallCommand, {silent: true, async: false});
    +    if (uninstallResult.code > 0) {
    +        logger.error("Failed to uninstall the app" );
    +        logger.error("Error code: " + uninstallResult.code);
    +    }
    +    return;
    +}
    +
    +ParamedicAppUninstall.prototype.uninstallAppWindows = function(targetObj, app) {
    +    var platformPath = path.join(this.appPath, "platforms", "windows");
    +    var packageJSPath = path.join(platformPath, "cordova", "lib", "package.js");
    +    var appDeployPath = path.join("C:", "Program Files (x86)", "Microsoft SDKs",
    +          "Windows Phone", "v8.1", "Tools", "AppDeploy", "AppDeployCmd.exe");
    +    appDeployPath = '"' + appDeployPath + '"';
    +
    +    if (fs.existsSync(packageJSPath)) {
    +        var packageJS = require(packageJSPath);
    +        var appId = packageJS.getAppId(platformPath);
    +        var uninstallCommand = appDeployPath + " /uninstall " + appId + " /targetdevice:"
+ targetObj.target;
    +        logger.info("cordova-paramedic: Running command: " + uninstallCommand);
    +        var uninstallResult  = shelljs.exec(uninstallCommand, {silent: false, async:
false});
    +        if (uninstallResult.code > 0) {
    +            logger.error("Failed to uninstall the app" );
    +            logger.error("Error code: " + uninstallResult.code);
    +            return;
    +        }
    +    }
    +    return;
    +}
    +
    +ParamedicAppUninstall.prototype.uninstallAppIOS = function(targetObj, app) {
    +   //No activity necessary at this point. App is automatically unistalled
    --- End diff --
    
    Spelling: unistalled => uninstalled


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message