function runCommand (command, appPath) { if (appPath) { shell.pushd(appPath); } exec(command); if (appPath) { shell.popd(); } }
function installAppiumServer () { const installPath = path.join(__dirname, '..', '..'); logger.normal('paramedic-appium: Installing Appium server to ' + installPath); shell.pushd(installPath); return execPromise('npm install appium').then(() => { shell.popd(); }); }
cleanUpProject () { this.server && this.server.cleanUp(); if (this.config.shouldCleanUpAfterRun()) { logger.info('cordova-paramedic: Deleting the application: ' + this.tempFolder.name); shell.popd(); shell.rm('-rf', this.tempFolder.name); } }
popd(dir) { shell.popd("-q", dir); }
startFileTransferServer (tempPath) { process.on('uncaughtException', () => { if (this.exiting) return; this.exiting = true; this.cleanUp(); }); return Q().then(() => { shell.pushd(tempPath); logger.normal('local-server: cloning file transfer server'); return execPromise('git clone https://github.com/apache/cordova-labs --branch cordova-filetransfer'); }).then(() => { shell.pushd('cordova-labs'); logger.normal('local-server: installing local file transfer server'); return execPromise('npm i'); }).then(() => { logger.normal('local-server: starting local file transfer server'); this.server.process = spawn('node', [ 'server.js' ]); this.server.alive = true; logger.info('local-server: local file transfer server started'); shell.popd(); shell.popd(); return this.server; }); }
packageApp () { switch (this.platformId) { case utilities.IOS: { return Q.Promise((resolve, reject) => { const zipCommand = 'zip -r ' + this.getPackageName() + ' ' + this.getBinaryName(); shell.pushd(this.getPackageFolder()); shell.rm('-rf', this.getPackageName()); console.log('Running command: ' + zipCommand + ' in dir: ' + shell.pwd()); exec(zipCommand, (code) => { shell.popd(); if (code) { reject('zip command returned with error code ' + code); } else { resolve(); } }); }); } case utilities.ANDROID: break; // don't need to zip the app for Android case utilities.BROWSER: break; // don't need to bundle the app on Browser platform at all default: throw new Error('Don\'t know how to package the app for platform: ' + this.platformId); } return Q.resolve(); }
shell.popd(); break;