cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [09/16] git commit: checking error in shell commands
Date Wed, 03 Apr 2013 03:09:05 GMT
checking error in shell commands


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/2aeef83c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/2aeef83c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/2aeef83c

Branch: refs/heads/master
Commit: 2aeef83c62034d9d156614ba4ccbf1b763b08044
Parents: 8d5d7a8
Author: Anis Kadri <anis@apache.org>
Authored: Mon Apr 1 17:02:00 2013 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Mon Apr 1 17:02:00 2013 -0700

----------------------------------------------------------------------
 platforms/ios.js |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2aeef83c/platforms/ios.js
----------------------------------------------------------------------
diff --git a/platforms/ios.js b/platforms/ios.js
index 2f221c3..edddbeb 100644
--- a/platforms/ios.js
+++ b/platforms/ios.js
@@ -35,7 +35,6 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
       , version = plugin_et._root.attrib['version']
       , i = 0
       , matched;
-
     variables = variables || {}
 
     // grab and parse pbxproj
@@ -100,11 +99,14 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
         var stat = fs.statSync(srcPath);
         if(stat.isDirectory()) {
             shell.mkdir('-p', targetPath);
+            checkLastCommand();
         }
         if (action == 'install') {
             shell.cp('-r', srcPath, targetPath);
+            checkLastCommand();
         } else {
             shell.rm('-rf', targetPath);
+            checkLastCommand();
         }
     });
 
@@ -118,12 +120,15 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
         if (action == 'install') {
             xcodeproj.addSourceFile('Plugins/' + path.relative(pluginsDir, destFile));
             shell.mkdir('-p', targetDir);
+            checkLastCommand();
             shell.cp(srcFile, destFile);
+            checkLastCommand();
         } else {
             xcodeproj.removeSourceFile('Plugins/' + path.basename(src));   
             if(fs.existsSync(destFile))
                 fs.unlinkSync(destFile);
             shell.rm('-rf', targetDir);    
+            checkLastCommand();
         }
     });
 
@@ -136,12 +141,15 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
         if (action == 'install') {     
             xcodeproj.addHeaderFile('Plugins/' + path.relative(pluginsDir, destFile));
             shell.mkdir('-p', targetDir);
+            checkLastCommand();
             shell.cp(srcFile, destFile);
+            checkLastCommand();
         } else {
             xcodeproj.removeHeaderFile('Plugins/' + path.basename(src));
             if(fs.existsSync(destFile))
                 fs.unlinkSync(destFile);
             shell.rm('-rf', targetDir);
+            checkLastCommand();
         }
     });
 
@@ -155,12 +163,15 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
             var st = fs.statSync(srcFile);
             if (st.isDirectory()) {
                 shell.cp('-R', srcFile, resourcesDir);
+                checkLastCommand();
             } else {
                 shell.cp(srcFile, destFile);
+                checkLastCommand();
             }
         } else {
             xcodeproj.removeResourceFile('Resources/' + path.basename(src));
             shell.rm('-rf', destFile);
+            checkLastCommand();
         }
     });
 
@@ -353,3 +364,7 @@ function updateConfig(action, config_path, plugin_et) {
         updatePlistFile(action, config_path, plugin_et);
     }
 }
+
+function checkLastCommand() {
+    if(shell.error() != null) throw {name: "ShellError", message: shell.error()};
+}


Mime
View raw message