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/af2a9013
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/af2a9013
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/af2a9013

Branch: refs/heads/future
Commit: af2a90138878bb51ae09783861fda3ea3089b2f2
Parents: b649373
Author: Braden Shepherdson <[email protected]>
Authored: Tue Mar 26 16:40:59 2013 -0400
Committer: Tim Kim <[email protected]>
Committed: Tue Apr 9 13:44:01 2013 -0700

----------------------------------------------------------------------
 platforms/android.js    |   46 ++++++++++++-----------------------------
 platforms/blackberry.js |   35 +++++++------------------------
 platforms/ios.js        |   42 ++++---------------------------------
 platforms/www.js        |   43 ---------------------------------------
 plugman.js              |    6 ++--
 5 files changed, 30 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/af2a9013/platforms/android.js
----------------------------------------------------------------------
diff --git a/platforms/android.js b/platforms/android.js
index 323ff28..41ac491 100644
--- a/platforms/android.js
+++ b/platforms/android.js
@@ -22,22 +22,28 @@ var fs = require('fs')  // use existsSync in 0.6.x
    , util = require('util')
    , shell = require('shelljs')
    , et = require('elementtree')
-   , getConfigChanges = require('../util/config-changes')
-   , searchAndReplace = require('../util/search-and-replace')
-   , xml_helpers = require('../util/xml-helpers')
+   , getConfigChanges = require(path.join(__dirname, '..', 'util', 
'config-changes')
+   , searchAndReplace = require(path.join(__dirname, '..', 'util', 
'search-and-replace')
+   , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
    , assetsDir = 'assets/www'
    , sourceDir = 'src';
 
-
 exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et, 
variables) {
     var plugin_id = plugin_et._root.attrib['id']
       , 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')
+      , 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);
 
@@ -79,30 +85,6 @@ exports.handlePlugin = function (action, project_dir, 
plugin_dir, plugin_et, var
         }
     });
 
-    // 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/af2a9013/platforms/blackberry.js
----------------------------------------------------------------------
diff --git a/platforms/blackberry.js b/platforms/blackberry.js
index c927181..8e3cb5a 100644
--- a/platforms/blackberry.js
+++ b/platforms/blackberry.js
@@ -30,14 +30,17 @@ exports.handlePlugin = function (action, project_dir, 
plugin_dir, plugin_et) {
     var plugin_id = plugin_et._root.attrib['id']
       , 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="blackberry"]')
-      , 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))) {
@@ -56,28 +59,6 @@ exports.handlePlugin = function (action, project_dir, 
plugin_dir, plugin_et) {
       action = action.replace('force-', '');
     }
     
-    // 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/af2a9013/platforms/ios.js
----------------------------------------------------------------------
diff --git a/platforms/ios.js b/platforms/ios.js
index 6473936..5431787 100644
--- a/platforms/ios.js
+++ b/platforms/ios.js
@@ -25,16 +25,16 @@ var path = require('path')
   , plist = require('plist')
   , bplist = require('bplist-parser')
   , shell = require('shelljs')
-  , xml_helpers = require('../util/xml-helpers')
-  , searchAndReplace = require('../util/search-and-replace')
-  , getConfigChanges = require('../util/config-changes')
-  , assetsDir = 'www';    // relative path to project's web assets
-
+  , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'))
+  , searchAndReplace = require(path.join(__dirname, '..', 'util', 
'search-and-replace')
+  , getConfigChanges = require(path.join(__dirname, '..', 'util', 
'config-changes'));
+  
 exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et, 
variables) {
     var plugin_id = plugin_et._root.attrib['id']
       , version = plugin_et._root.attrib['version']
       , i = 0
       , matched;
+
     variables = variables || {}
 
     // grab and parse pbxproj
@@ -80,38 +80,6 @@ exports.handlePlugin = function (action, project_dir, 
plugin_dir, plugin_et, var
     } else {
       action = action.replace('force-', '');
     }
-    
-    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']);
-        if (action == 'install') {
-            var stat = fs.statSync(srcPath);
-            if(stat.isDirectory()) {
-              shell.mkdir('-p', targetPath);
-              checkLastCommand();
-              shell.cp('-r', srcPath, targetPath);
-              checkLastCommand();
-            } else {
-              shell.cp(srcPath, targetPath);
-            }
-            checkLastCommand();
-        } else {
-            shell.rm('-rf', targetPath);
-            checkLastCommand();
-        }
-    });
 
     // move native files (source/header/resource)
     sourceFiles && sourceFiles.forEach(function (sourceFile) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/af2a9013/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/af2a9013/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index f129247..fa2e33b 100755
--- a/plugman.js
+++ b/plugman.js
@@ -31,11 +31,11 @@ var fs = require('fs')
   , platform_modules = {
         'android': require('./platforms/android'),
         'ios': require('./platforms/ios'),
-        'blackberry': require('./platforms/blackberry'),
-        'www': require('./platforms/www')
+        'blackberry': require('./platforms/blackberry')
     };
 
-var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry' ,'www' ]
+var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry' ]
+
             , 'project' : path
             , 'plugin' : [String, path, url]
             , 'remove' : Boolean

Reply via email to