UNPKG

cordova-plugin-camaa

Version:
50 lines (40 loc) 1.76 kB
#!/usr/bin/env node var exec = require('child_process').exec; /* Look @https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/ for more details */ module.exports = function(context) { var projectRoot = context.opts.projectRoot; projectRoot = projectRoot.replace(/(\s+)/g, '\\$1') // could just use a regex var scriptLocation = context.scriptLocation.split("/").slice(0,context.scriptLocation.split("/").length - 1).join("/") + "/"; scriptLocation = scriptLocation.replace(/(\s+)/g, '\\$1') // remove previous version // exec("cordova plugin remove CAMAA",function(e,s,std){ // this is causing errors // }); //cd to the plugin, run the script and come back new Promise(function(resolve, reject) { console.log("Running : ./rmPlugin.sh " + projectRoot); exec("cd " + scriptLocation +";" +"./rmPlugin.sh " + projectRoot + ";" +"cd " + projectRoot,function(error,stdout,stderr){ if(error){console.log("Error : " + error); resolve();}; if(stdout){console.log("stdout: " + stdout); resolve();}; if(stderr){console.log("stderr : " + stderr); resolve();}; }); configFileUpdate(); }).then (function() { // configFileUpdate(); }); function configFileUpdate() { console.log("Running : ./rmPluginConfig.sh " + projectRoot); exec("cd " + scriptLocation +";" +"./rmPluginConfig.sh " + projectRoot + ";" +"cd " + projectRoot,function(error,stdout,stderr){ if(error){console.log("Error : " + error)}; if(stdout){console.log("stdout: " + stdout)}; if(stderr){console.log("stderr : " + stderr)}; }); } };