cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [25/50] [abbrv] git commit: Tizen: Copy platform file verbatim from firefoxos
Date Fri, 11 Apr 2014 19:46:41 GMT
Tizen: Copy platform file verbatim from firefoxos


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

Branch: refs/heads/browserify
Commit: 2f18534b79b51955b534545356172ea4f6d5ebd9
Parents: 03b1299
Author: Gabriel Schulhof <gabriel.schulhof@intel.com>
Authored: Thu Mar 27 11:36:45 2014 +0200
Committer: Gabriel Schulhof <gabriel.schulhof@intel.com>
Committed: Thu Mar 27 11:36:45 2014 +0200

----------------------------------------------------------------------
 src/platforms/tizen.js | 63 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2f18534b/src/platforms/tizen.js
----------------------------------------------------------------------
diff --git a/src/platforms/tizen.js b/src/platforms/tizen.js
index d411709..6d42024 100644
--- a/src/platforms/tizen.js
+++ b/src/platforms/tizen.js
@@ -1,14 +1,71 @@
 var path = require('path')
-    , xml_helpers = require('../util/xml-helpers')
-    , common = require('./common');
+    , fs = require('fs')
+    , common = require('./common')
+    , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
 
 module.exports = {
     www_dir: function(project_dir) {
         return path.join(project_dir, 'www');
     },
     package_name:function(project_dir) {
-        var config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+        // preferred location if cordova >= 3.4
+        var preferred_path = path.join(project_dir, 'config.xml');
+        if (!fs.existsSync(preferred_path)) {
+            // older location
+            old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+            if (!fs.existsSync(old_config_path)) {
+                // output newer location and fail reading
+                config_path = preferred_path;
+                require('../../plugman').emit('verbose', 'unable to find '+config_path);
+            } else {
+                config_path = old_config_path;
+            }
+        } else {
+            config_path = preferred_path;
+        }
         var widget_doc = xml_helpers.parseElementtreeSync(config_path);
         return widget_doc._root.attrib['id'];
+    },
+    "source-file":{
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+            common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+        },
+        uninstall:function(source_el, project_dir, plugin_id) {
+            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+            common.removeFile(project_dir, dest);
+        }
+    },
+    "header-file": {
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'header-fileinstall is not supported
for firefoxos');
+        },
+        uninstall:function(source_el, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'header-file.uninstall is not supported
for firefoxos');
+        }
+    },
+    "resource-file":{
+        install:function(el, plugin_dir, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'resource-file.install is not supported
for firefoxos');
+        },
+        uninstall:function(el, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'resource-file.uninstall is not supported
for firefoxos');
+        }
+    },
+    "framework": {
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'framework.install is not supported
for firefoxos');
+        },
+        uninstall:function(source_el, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'framework.uninstall is not supported
for firefoxos');
+        }
+    },
+    "lib-file": {
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'lib-file.install is not supported for
firefoxos');
+        },
+        uninstall:function(source_el, project_dir, plugin_id) {
+            require('../../plugman').emit('verbose', 'lib-file.uninstall is not supported
for firefoxos');
+        }
     }
 };


Mime
View raw message