Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA86010BC9 for ; Mon, 15 Apr 2013 18:51:52 +0000 (UTC) Received: (qmail 84997 invoked by uid 500); 15 Apr 2013 18:51:50 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 84922 invoked by uid 500); 15 Apr 2013 18:51:50 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 84126 invoked by uid 99); 15 Apr 2013 18:51:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Apr 2013 18:51:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A94181B5E6; Mon, 15 Apr 2013 18:51:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: timkim@apache.org To: commits@cordova.apache.org Date: Mon, 15 Apr 2013 18:52:20 -0000 Message-Id: <36b672a330af4b658ce2b13ab2c94766@git.apache.org> In-Reply-To: <9ce8167dc0c84a57a01fbbfad64cc72d@git.apache.org> References: <9ce8167dc0c84a57a01fbbfad64cc72d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [33/54] [abbrv] git commit: No tags for JS-only plugins. No 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 Authored: Tue Mar 26 16:40:59 2013 -0400 Committer: Tim Kim 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