You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/05/27 03:03:37 UTC

[1/2] git commit: harness-push: Print response body of non 200 responses

Repository: cordova-app-harness
Updated Branches:
  refs/heads/master 6548126a0 -> de2743ec8


harness-push: Print response body of non 200 responses


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/68e7118a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/68e7118a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/68e7118a

Branch: refs/heads/master
Commit: 68e7118ab32d4029e5981090d0056195e43d5888
Parents: 6548126
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon May 26 15:00:28 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon May 26 15:00:28 2014 -0400

----------------------------------------------------------------------
 .../node_modules/cordova-harness-client/harnessclient.js    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/68e7118a/harness-push/node_modules/cordova-harness-client/harnessclient.js
----------------------------------------------------------------------
diff --git a/harness-push/node_modules/cordova-harness-client/harnessclient.js b/harness-push/node_modules/cordova-harness-client/harnessclient.js
index 8f3677a..58ab5a7 100644
--- a/harness-push/node_modules/cordova-harness-client/harnessclient.js
+++ b/harness-push/node_modules/cordova-harness-client/harnessclient.js
@@ -93,11 +93,6 @@ function doRequest(method, target, action, options) {
 
     req.on('response', function(res) {
         process.stdout.write(' ==> ' + res.statusCode);
-        if (res.statusCode != 200) {
-            deferred.reject(new Error('Server returned status code: ' + res.statusCode));
-            res.destroy();
-            return;
-        }
         res.setEncoding('utf8');
         var body = '';
         res.on('data', function(chunk) {
@@ -105,6 +100,10 @@ function doRequest(method, target, action, options) {
         });
         res.on('end', function() {
             process.stdout.write(' (' + (new Date() - startTime) + ')\n');
+            if (res.statusCode != 200) {
+                deferred.reject(new Error('Server returned status code: ' + res.statusCode + '\n\n' + body));
+                return;
+            }
             try {
                 body = options.expectJson ? JSON.parse(body) : body;
             } catch (e) {


[2/2] git commit: harness-push: Allow pushes without config.xml

Posted by ag...@apache.org.
harness-push: Allow pushes without config.xml


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

Branch: refs/heads/master
Commit: de2743ec8306b43e292127ad77eef73d8c89d221
Parents: 68e7118
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon May 26 15:00:54 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon May 26 15:00:54 2014 -0400

----------------------------------------------------------------------
 .../cordova-harness-client/pushsession.js       | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/de2743ec/harness-push/node_modules/cordova-harness-client/pushsession.js
----------------------------------------------------------------------
diff --git a/harness-push/node_modules/cordova-harness-client/pushsession.js b/harness-push/node_modules/cordova-harness-client/pushsession.js
index 546978b..23934f7 100644
--- a/harness-push/node_modules/cordova-harness-client/pushsession.js
+++ b/harness-push/node_modules/cordova-harness-client/pushsession.js
@@ -109,11 +109,13 @@ function buildAssetManifest(dir, configXmlPath) {
             etag: calculateMd5(fileList[i]),
         };
     }
-    ret['config.xml'] = {
-        path: 'config.xml',
-        realPath: configXmlPath,
-        etag: calculateMd5(configXmlPath)
-    };
+    if (configXmlPath) {
+        ret['config.xml'] = {
+            path: 'config.xml',
+            realPath: configXmlPath,
+            etag: calculateMd5(configXmlPath)
+        };
+    }
     return ret;
 }
 
@@ -171,8 +173,8 @@ function zipDir(dir, zip) {
 
 function PushSession(harnessClient, dir) {
     this.launchAfterPush = true;
-    this.appType_ = 'cordova';
     this.harnessClient_ = harnessClient;
+    this.appType_ = null;
     this.rootDir_ = dir;
     this.wwwDir_ = null;
     this.appId_ = null;
@@ -195,8 +197,9 @@ PushSession.prototype.initialize = function(opts) {
         self.assetManifest_ = result.body['assetManifest'];
         self.assetManifestEtag_ = result.body['assetManifestEtag'];
         self.wwwDir_ = opts.wwwDir || getDerivedWwwDir(self.rootDir_, self.platformId_);
-        self.configXmlPath_ = opts.configXmlPath || getDerivedConfigXmlPath(self.rootDir_, self.platformId_);
+        self.configXmlPath_ = (typeof opts.configXmlPath == 'undefined') ? getDerivedConfigXmlPath(self.rootDir_, self.platformId_) : opts.configXmlPath;
         self.cordovaPluginsPath_ = !opts.skipCordovaPlugins && path.join(self.wwwDir_, 'cordova_plugins.js');
+        self.appType_ = opts.appType || 'cordova';
     });
 };
 
@@ -204,7 +207,7 @@ PushSession.prototype.push = function() {
     var self = this;
     return Q.when(this.platformId_ || this.initialize())
     .then(function() {
-        if (!fs.existsSync(self.configXmlPath_)) {
+        if (self.configXmlPath_ && !fs.existsSync(self.configXmlPath_)) {
             throw new Error('Could not find: ' + self.configXmlPath_ + ' you probably need to run: cordova platform add ' + self.platformId_);
         }
         if (self.cordovaPluginsPath_ && !fs.existsSync(self.cordovaPluginsPath_)) {
@@ -260,7 +263,9 @@ PushSession.prototype.doFileSync_ = function() {
 PushSession.prototype.doZipPush_ = function() {
     var zip = new JSZip();
     zipDir(this.wwwDir_, zip.folder('www'));
-    zip.file('config.xml', fs.readFileSync(this.configXmlPath_, 'binary'), { binary: true });
+    if (this.configXmlPath_) {
+        zip.file('config.xml', fs.readFileSync(this.configXmlPath_, 'binary'), { binary: true });
+    }
     var newAssetManifest = buildAssetManifest(this.wwwDir_, this.configXmlPath_);
     zip.file('zipassetmanifest.json', JSON.stringify(newAssetManifest));
     var zipData = new Buffer(zip.generate({ type: 'base64' }), 'base64');