cordova-dev mailing list archives

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

    https://github.com/apache/cordova-paramedic/pull/5#discussion_r62901186
  
    --- Diff: lib/ParamedicAppUninstall.js ---
    @@ -0,0 +1,66 @@
    +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;
    +    this.executeUninstallCommand(uninstallCommand);
    +}
    +
    +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;
    +        this.executeUninstallCommand(uninstallCommand);
    +    }
    +    return;
    +}
    +
    +ParamedicAppUninstall.prototype.uninstallAppIOS = function(targetObj, app) {
    +   //No activity necessary at this point. App is automatically uninstalled
    +}
    +
    +ParamedicAppUninstall.prototype.executeUninstallCommand = function(uninstallCommand)
{
    +    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);
    --- End diff --
    
    changed the silent to false. This will give the result either way


---
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