You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/08/27 23:32:44 UTC

[1/7] git commit: using npm-published version of pluginstall. line drawn in sand regarding minimum cordova version. added asyncblock for flow control. fixed an issue with express deprecation warning.

Updated Branches:
  refs/heads/cordova-client a963a21a3 -> e91530b03


using npm-published version of pluginstall. line drawn in sand regarding minimum cordova version. added asyncblock for flow control. fixed an issue with express deprecation warning.


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

Branch: refs/heads/cordova-client
Commit: e91530b03524acf164d7ef5df9d9cea9a1e11a5b
Parents: 7c802bb
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Aug 27 14:32:29 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Aug 27 14:32:29 2012 -0700

----------------------------------------------------------------------
 README.md       |    3 ++
 package.json    |    6 ++--
 src/docs.js     |    2 +-
 src/platform.js |    6 ----
 src/plugin.js   |   63 +++++++++++++++++++++++--------------------------
 5 files changed, 37 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e91530b0/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index c0c7324..c0be20e 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,9 @@ cordova-client, you will need to install the SDK for that platform. See:
 
 Cordova client has been tested on Windows, Linux and Mas OS X.
 
+In it's prototype stages, cordova-client will only work on Cordova v2.1
+and above.
+
 # Getting Started
 
 You should (eventually) be able to `npm install cordova-client -g`.

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e91530b0/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 6a376bc..e3bd783 100644
--- a/package.json
+++ b/package.json
@@ -23,9 +23,9 @@
     "colors":">=0.6.0",
     "wrench":"1.3.9",
     "elementtree":"0.1.1",
-    "pluginstall":"git+https://github.com/filmaj/pluginstall.git",
-    "ncallbacks":"1.0.0",
-    "express":"3.0"
+    "pluginstall":"0.5.0",
+    "express":"3.0",
+    "asyncblock":"2.1.4"
   },
   "devDependencies": {
     "jasmine-node":">=1.0.0"

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e91530b0/src/docs.js
----------------------------------------------------------------------
diff --git a/src/docs.js b/src/docs.js
index ba8bde0..db734af 100644
--- a/src/docs.js
+++ b/src/docs.js
@@ -3,7 +3,7 @@ var express = require('express'),
     colors  = require('colors'),
     port    = 2222,
     statik  = path.join(__dirname, '..', 'doc'),
-    server  = express.createServer();
+    server  = express();
 
 module.exports = function docs () {
     server.configure(function() {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e91530b0/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 407f582..5c4bf63 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -65,12 +65,6 @@ module.exports = function platform(command, target, callback) {
                 var outPath = path.join(__dirname, '..', 'lib', target);
                 var cmd = util.format('git clone %s %s', repos[target], outPath);
                 
-                // TODO: refactor post-clone hooks
-                // make sure we run "make install" if we're cloning ios
-                if (target == 'ios') {
-                    cmd += ' && cd "' + output + '" && make install';
-                }
-
                 console.log('Cloning ' + repos[target] + ', this may take a while...');
                 exec(cmd, function(err, stderr, stdout) {
                     if (err) {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e91530b0/src/plugin.js
----------------------------------------------------------------------
diff --git a/src/plugin.js b/src/plugin.js
index afba9f5..46da082 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -4,9 +4,9 @@ var cordova_util = require('./util'),
     cpr = wrench.copyDirSyncRecursive,
     fs = require('fs'),
     path = require('path'),
-    nCalls = require('ncallbacks'),
     config_parser = require('./config_parser'),
     exec = require('child_process').exec,
+    asyncblock = require('asyncblock'),
     ls = fs.readdirSync;
 
 module.exports = function plugin(command, target, callback) {
@@ -53,42 +53,39 @@ module.exports = function plugin(command, target, callback) {
 
             var pluginWww = path.join(target, 'www');
             var wwwContents = ls(pluginWww);
-
-            var n = wwwContents.length + platforms.length;
-            var end = nCalls(n, callback || function(){});
-
-            // Iterate over all platforms in the project and install the
-            // plugin.
             var cli = path.join(__dirname, '..', 'node_modules', 'pluginstall', 'cli.js');
-            platforms.forEach(function(platform) {
-                var cmd = util.format('%s %s "%s" "%s"', cli, platform, path.join(projectRoot, 'platforms', platform), target);
-                console.log('executing ' + cmd);
-                exec(cmd, function(err, stderr, stdout) {
-                    end();
-                    if (err) {
-                        console.error(stderr);
-                        // TODO: remove plugin. requires pluginstall to
-                        // support removal.
-                        throw 'An error occured during plugin installation. ' + err;
+
+            asyncblock(function(flow) {
+                // Iterate over all platforms in the project and install the
+                // plugin.
+                platforms.forEach(function(platform) {
+                    var cmd = util.format('%s %s "%s" "%s"', cli, platform, path.join(projectRoot, 'platforms', platform), target);
+                    console.log('executing ' + cmd);
+                    var key = 'pluginstall-' + platform;
+                    exec(cmd, flow.set({
+                      key:key,
+                      firstArgIsError:false,
+                      responseFormat:['err', 'stdout', 'stderr']
+                    }));
+                    var buffers = flow.get(key);
+                    if (buffers.err) throw 'An error occured during plugin installation for ' + platform + '. ' + buffers.err;
+                });
+                
+                // Add the plugin web assets to the www folder as well
+                // TODO: assumption that web assets go under www folder
+                // inside plugin dir; instead should read plugin.xml
+                wwwContents.forEach(function(asset) {
+                    asset = path.resolve(path.join(pluginWww, asset));
+                    var info = fs.lstatSync(asset);
+                    var name = asset.substr(asset.lastIndexOf('/')+1);
+                    var wwwPath = path.join(projectWww, name);
+                    if (info.isDirectory()) {
+                        cpr(asset, wwwPath);
+                    } else {
+                        fs.writeFileSync(wwwPath, fs.readFileSync(asset));
                     }
                 });
             });
-            
-            // Add the plugin web assets to the www folder as well
-            // TODO: assumption that web assets go under www folder
-            // inside plugin dir; instead should read plugin.xml
-            wwwContents.forEach(function(asset) {
-                asset = path.resolve(path.join(pluginWww, asset));
-                var info = fs.lstatSync(asset);
-                var name = asset.substr(asset.lastIndexOf('/')+1);
-                var wwwPath = path.join(projectWww, name);
-                if (info.isDirectory()) {
-                    cpr(asset, wwwPath);
-                } else {
-                    fs.writeFileSync(wwwPath, fs.readFileSync(asset));
-                }
-                end();
-            });
 
             break;
         case 'remove':