cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [24/54] [abbrv] git commit: adding force actions for blackberry and android
Date Mon, 15 Apr 2013 18:52:11 GMT
adding force actions for blackberry and android


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

Branch: refs/heads/future
Commit: 120944104328065b17405ca2d05bfdb51d2d2332
Parents: 8a00a0b
Author: Anis Kadri <anis@apache.org>
Authored: Thu Apr 4 13:45:25 2013 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Thu Apr 4 13:45:25 2013 -0700

----------------------------------------------------------------------
 platforms/android.js    |   38 +++++++++++++++++++++-----------------
 platforms/blackberry.js |   12 ++++++++----
 2 files changed, 29 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/12094410/platforms/android.js
----------------------------------------------------------------------
diff --git a/platforms/android.js b/platforms/android.js
index 2f78bf4..323ff28 100644
--- a/platforms/android.js
+++ b/platforms/android.js
@@ -43,32 +43,36 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et,
var
 
     variables = variables || {}
 
-	// get config.xml filename
-	var config_xml_filename = 'res/xml/config.xml';
+	  // get config.xml filename
+	  var config_xml_filename = 'res/xml/config.xml';
     if(fs.existsSync(path.resolve(project_dir, 'res/xml/plugins.xml'))) {
         config_xml_filename = 'res/xml/plugins.xml';
     }
 
     // collision detection 
-    if(action == "install" && pluginInstalled(plugin_et, project_dir, config_xml_filename))
{
-        throw "Plugin "+plugin_id+" already installed"
-    } else if(action == "uninstall" && !pluginInstalled(plugin_et, project_dir, config_xml_filename))
{
-        throw "Plugin "+plugin_id+" not installed"
+    if(action.match(/force-/) == null) {
+      if(action == "install" && pluginInstalled(plugin_et, project_dir, config_xml_filename))
{
+          throw "Plugin "+plugin_id+" already installed"
+      } else if(action == "uninstall" && !pluginInstalled(plugin_et, project_dir,
config_xml_filename)) {
+          throw "Plugin "+plugin_id+" not installed"
+      }
+    } else {
+      action = action.replace('force-', '');
     }
 
-	root = et.Element("config-file");
-	root.attrib['parent'] = '.'
-    plugin_et.findall('./access').forEach(function (tag) { 
-		root.append(tag);
-	});
+    root = et.Element("config-file");
+    root.attrib['parent'] = '.'
+      plugin_et.findall('./access').forEach(function (tag) { 
+      root.append(tag);
+    });
 
-	if (root.len()) {
-		(configChanges[config_xml_filename]) ?
-        	configChanges[config_xml_filename].push(root) :
-        	configChanges[config_xml_filename] = [root];
-	}
+    if (root.len()) {
+      (configChanges[config_xml_filename]) ?
+            configChanges[config_xml_filename].push(root) :
+            configChanges[config_xml_filename] = [root];
+    }
 
-	// find which config-files we're interested in
+    // find which config-files we're interested in
     Object.keys(configChanges).forEach(function (configFile) {
         if (!fs.existsSync(path.resolve(project_dir, configFile))) {
             delete configChanges[configFile];

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/12094410/platforms/blackberry.js
----------------------------------------------------------------------
diff --git a/platforms/blackberry.js b/platforms/blackberry.js
index 718e9ff..c927181 100644
--- a/platforms/blackberry.js
+++ b/platforms/blackberry.js
@@ -46,10 +46,14 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
     });
 
     // collision detection 
-    if(action == "install" && pluginInstalled(plugin_et, project_dir)) {
-        throw "Plugin "+plugin_id+" already installed"
-    } else if(action == "uninstall" && !pluginInstalled(plugin_et, project_dir))
{
-        throw "Plugin "+plugin_id+" not installed"
+    if(action.match(/force-/) == null) {
+      if(action == "install" && pluginInstalled(plugin_et, project_dir)) {
+          throw "Plugin "+plugin_id+" already installed"
+      } else if(action == "uninstall" && !pluginInstalled(plugin_et, project_dir))
{
+          throw "Plugin "+plugin_id+" not installed"
+      }
+    } else {
+      action = action.replace('force-', '');
     }
     
     // move asset files


Mime
View raw message