You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/03/26 21:41:30 UTC

git commit: No tags for JS-only plugins.

Updated Branches:
  refs/heads/future dde313cbc -> eeb5f0104


No <platform> tags for JS-only plugins.


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

Branch: refs/heads/future
Commit: eeb5f0104f449ae5cac6045786874559fe1edf50
Parents: dde313c
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Mar 26 16:40:59 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue Mar 26 16:40:59 2013 -0400

----------------------------------------------------------------------
 platforms/android.js |   41 +++++++++++------------------------------
 platforms/bb10.js    |   34 ++++++++--------------------------
 platforms/ios.js     |   40 ++++++++++++++--------------------------
 platforms/www.js     |   43 -------------------------------------------
 plugman.js           |    5 ++---
 5 files changed, 35 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eeb5f010/platforms/android.js
----------------------------------------------------------------------
diff --git a/platforms/android.js b/platforms/android.js
index 892f7b0..b0f8da7 100644
--- a/platforms/android.js
+++ b/platforms/android.js
@@ -24,7 +24,6 @@ var fs = require('fs')  // use existsSync in 0.6.x
    , et = require('elementtree')
    , getConfigChanges = require('../util/config-changes')
 
-   , assetsDir = 'assets/www'  // relative path to project's web assets
    , sourceDir = 'src'
    , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
 
@@ -34,12 +33,18 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
       , version = plugin_et._root.attrib['version']
       , external_hosts = []
       , i = 0
-      // look for assets in the plugin 
-      , assets = plugin_et.findall('./asset')
-      , platformTag = plugin_et.find('./platform[@name="android"]')
-      , sourceFiles = platformTag.findall('./source-file')
-      , libFiles = platformTag.findall('./library-file')
       , PACKAGE_NAME = androidPackageName(project_dir)
+
+
+    var platformTag = plugin_et.find('./platform[@name="android"]');
+    if (!platformTag) {
+        // Either this plugin doesn't support this platform, or it's a JS-only plugin.
+        // Either way, return now.
+        return;
+    }
+
+    var sourceFiles = platformTag.findall('./source-file')
+      , libFiles = platformTag.findall('./library-file')
       , configChanges = getConfigChanges(platformTag);
 
 	// get config.xml filename
@@ -74,30 +79,6 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
         }
     });
 
-    // move asset files
-    assets.forEach(function (asset) {
-        var srcPath = path.resolve(
-                        plugin_dir,
-                        asset.attrib['src']);
-
-        var targetPath = path.resolve(
-                            project_dir,
-                            assetsDir,
-                            asset.attrib['target']);
-
-        var stats = fs.statSync(srcPath);
-        if (action == 'install') {
-            if(stats.isDirectory()) {
-                shell.mkdir('-p', targetPath);
-                shell.cp('-R', srcPath, path.join(project_dir, assetsDir));
-            } else {
-                shell.cp(srcPath, targetPath);
-            }
-        } else {
-            shell.rm('-rf', targetPath);
-        }
-    });
-
     // move source files
     sourceFiles.forEach(function (sourceFile) {
         var srcDir = path.resolve(project_dir,

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eeb5f010/platforms/bb10.js
----------------------------------------------------------------------
diff --git a/platforms/bb10.js b/platforms/bb10.js
index 5d3f649..1142fec 100644
--- a/platforms/bb10.js
+++ b/platforms/bb10.js
@@ -31,13 +31,17 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
       , version = plugin_et._root.attrib['version']
       , external_hosts = []
 
-      // look for assets in the plugin 
-      , assets = plugin_et.findall('./asset')
       , platformTag = plugin_et.find('./platform[@name="BlackBerry10"]')
-      , sourceFiles = platformTag.findall('./source-file')
+
+    if (!platformTag) {
+        // Either this plugin doesn't support this platform, or it's a JS-only plugin.
+        // Either way, return now.
+        return;
+    }
+
+    var sourceFiles = platformTag.findall('./source-file')
       , libFiles = platformTag.findall('./library-file')
       , configChanges = getConfigChanges(platformTag);
-      
     // find which config-files we're interested in
     Object.keys(configChanges).forEach(function (configFile) {
         if (!fs.existsSync(path.resolve(project_dir, configFile))) {
@@ -52,28 +56,6 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
         throw "Plugin "+plugin_id+" not installed"
     }
     
-    // move asset files
-    assets.forEach(function (asset) {
-        var srcPath = path.resolve(
-                        plugin_dir,
-                        asset.attrib['src']);
-
-        var targetPath = path.resolve(
-                            project_dir,
-                            asset.attrib['target']);
-        var stats = fs.statSync(srcPath);
-        if (action == 'install') {
-            if(stats.isDirectory()) {
-                shell.mkdir('-p', targetPath);
-                shell.cp('-R', srcPath, project_dir);
-            } else {
-                shell.cp(srcPath, targetPath);
-            }
-        } else {
-            shell.rm('-rf', targetPath);
-        }
-    });
-
     // move source files
     sourceFiles.forEach(function (sourceFile) {
         var srcDir = path.resolve(project_dir,

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eeb5f010/platforms/ios.js
----------------------------------------------------------------------
diff --git a/platforms/ios.js b/platforms/ios.js
index b0cec42..cc9ac75 100644
--- a/platforms/ios.js
+++ b/platforms/ios.js
@@ -27,13 +27,26 @@ var path = require('path')
   , shell = require('shelljs')
   , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'))
   , getConfigChanges = require(path.join(__dirname, '..', 'util', 'config-changes'))
-  , assetsDir = 'www';    // relative path to project's web assets
 
 exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
     var plugin_id = plugin_et._root.attrib['id']
       , version = plugin_et._root.attrib['version']
       , i = 0
       , matched;
+
+    var platformTag = plugin_et.find('./platform[@name="ios"]');
+
+    if (!platformTag) {
+        // Either this plugin doesn't support this platform, or it's a JS-only plugin.
+        // Either way, return now.
+        return;
+    }
+
+    var sourceFiles = platformTag.findall('./source-file'),
+        headerFiles = platformTag.findall('./header-file'),
+        resourceFiles = platformTag.findall('./resource-file'),
+        frameworks = platformTag.findall('./framework');
+
     // grab and parse pbxproj
     // we don't want CordovaLib's xcode project
     var project_files = glob.sync(project_dir + '/*.xcodeproj/project.pbxproj');
@@ -67,31 +80,6 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {
     } else if(action == "uninstall" && !pluginInstalled(plugin_et, config_files[0])) {
         throw "Plugin "+plugin_id+" not installed"
     }
-    var assets = plugin_et.findall('./asset'),
-        platformTag = plugin_et.find('./platform[@name="ios"]'),
-        sourceFiles = platformTag.findall('./source-file'),
-        headerFiles = platformTag.findall('./header-file'),
-        resourceFiles = platformTag.findall('./resource-file'),
-        frameworks = platformTag.findall('./framework');
-
-    // move asset files into www
-    assets && assets.forEach(function (asset) {
-        var srcPath = path.resolve(
-                        plugin_dir, asset.attrib['src']);
-
-        var targetPath = path.resolve(
-                            project_dir,
-                            assetsDir, asset.attrib['target']);
-        var stat = fs.statSync(srcPath);
-        if(stat.isDirectory()) {
-            shell.mkdir('-p', targetPath);
-        }
-        if (action == 'install') {
-            shell.cp('-r', srcPath, targetPath);
-        } else {
-            shell.rm('-rf', targetPath);
-        }
-    });
 
     // move native files (source/header/resource)
     sourceFiles && sourceFiles.forEach(function (sourceFile) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eeb5f010/platforms/www.js
----------------------------------------------------------------------
diff --git a/platforms/www.js b/platforms/www.js
deleted file mode 100644
index 1b5b001..0000000
--- a/platforms/www.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Copyright 2013 Anis Kadri
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var path = require('path')
-  , fs = require('fs')
-  , shell = require('shelljs');
-
-exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) {    
-    var assets = plugin_et.findall('./asset')
-      , i = 0;
-   
-    // move asset files into www
-    assets.forEach(function (asset) {
-        var srcPath = path.resolve(
-                        plugin_dir, asset.attrib['src']);
-
-        var targetPath = path.resolve(
-                            project_dir, asset.attrib['target']);
-
-        var st = fs.statSync(srcPath);    
-        if (st.isDirectory()) {
-            shell.cp('-R', srcPath, project_dir);
-        } else {
-            shell.cp(srcPath, targetPath);
-        }
-    });
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eeb5f010/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index ad4be96..6db4804 100755
--- a/plugman.js
+++ b/plugman.js
@@ -31,11 +31,10 @@ var fs = require('fs')
   , platform_modules = {
         'android': require('./platforms/android'),
         'ios': require('./platforms/ios'),
-        'bb10': require('./platforms/bb10'),
-        'www': require('./platforms/www')
+        'bb10': require('./platforms/bb10')
     };
 
-var known_opts = { 'platform' : [ 'ios', 'android', 'bb10' ,'www' ]
+var known_opts = { 'platform' : [ 'ios', 'android', 'bb10' ]
             , 'project' : path
             , 'plugin' : [String, path, url]
             , 'remove' : Boolean