cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alsoro...@apache.org
Subject cordova-paramedic git commit: Added --fileTransferServer arg to specify a custom file transfer server address
Date Tue, 24 Jan 2017 10:52:20 GMT
Repository: cordova-paramedic
Updated Branches:
  refs/heads/master b27449fd9 -> ce67362e9


Added --fileTransferServer arg to specify a custom file transfer server address


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

Branch: refs/heads/master
Commit: ce67362e92ef940df960e2fcc9e17b095c2aefde
Parents: b27449f
Author: Alexander Sorokin <alexander.sorokin@akvelon.com>
Authored: Tue Jan 24 13:16:04 2017 +0300
Committer: Alexander Sorokin <alexander.sorokin@akvelon.com>
Committed: Tue Jan 24 13:16:12 2017 +0300

----------------------------------------------------------------------
 lib/ParamedicConfig.js | 11 ++++++++++-
 lib/PluginsManager.js  | 13 ++++++++++---
 lib/paramedic.js       |  2 +-
 main.js                |  5 +++++
 4 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/ce67362e/lib/ParamedicConfig.js
----------------------------------------------------------------------
diff --git a/lib/ParamedicConfig.js b/lib/ParamedicConfig.js
index 12d781c..9a674c1 100644
--- a/lib/ParamedicConfig.js
+++ b/lib/ParamedicConfig.js
@@ -66,7 +66,8 @@ ParamedicConfig.parseFromArguments = function (argv) {
         skipAppiumTests:      argv.skipAppium,
         skipMainTests:        argv.skipMainTests,
         ci:                   argv.ci,
-        target:               argv.target
+        target:               argv.target,
+        fileTransferServer:   argv.fileTransferServer,
     });
 };
 
@@ -261,4 +262,12 @@ ParamedicConfig.prototype.setTarget = function (target) {
     this._config.target = target;
 };
 
+ParamedicConfig.prototype.getFileTransferServer = function () {
+    return this._config.fileTransferServer;
+}
+
+ParamedicConfig.prototype.setFileTransferServer = function (server) {
+    this._config.fileTransferServer = server;
+}
+
 module.exports = ParamedicConfig;

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/ce67362e/lib/PluginsManager.js
----------------------------------------------------------------------
diff --git a/lib/PluginsManager.js b/lib/PluginsManager.js
index 222193f..df966f6 100644
--- a/lib/PluginsManager.js
+++ b/lib/PluginsManager.js
@@ -45,9 +45,16 @@ PluginsManager.prototype.installTestsForExistingPlugins = function () {
         if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
             var additionalArgs = '';
             if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
-                var server = new Server(0, me.config.getExternalServerUrl());
-                var fileServerUrl = server.getConnectionAddress(me.config.getPlatformId())
+ ':5000';
-                additionalArgs += ' --variable FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+                if (me.config.getFileTransferServer()) {
+                    // user specified a file transfer server address, so using it
+                    additionalArgs += ' --variable FILETRANSFER_SERVER_ADDRESS=' + me.config.getFileTransferServer();
+                } else {
+                    // no server address specified, starting a local server
+                    var server = new Server(0, me.config.getExternalServerUrl());
+                    var fileServerUrl = server.getConnectionAddress(me.config.getPlatformId())
+ ':5000';
+                    additionalArgs += ' --variable FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+                }
+                
             }
             me.installSinglePlugin(path.join(plugin.dir, 'tests') + additionalArgs);
         }

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/ce67362e/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index acf24e9..9c377f3 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -246,7 +246,7 @@ ParamedicRunner.prototype.maybeRunFileTransferServer = function () {
     return Q().then(function () {
         var plugins = self.config.getPlugins();
         for (var i = 0; i < plugins.length; i++) {
-            if (plugins[i].indexOf('cordova-plugin-file-transfer') >= 0) {
+            if (plugins[i].indexOf('cordova-plugin-file-transfer') >= 0 && !self.config.getFileTransferServer())
{
                 return self.server.startFileTransferServer(self.tempFolder.name);
             }
         }

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/ce67362e/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 4846db8..8563acb 100755
--- a/main.js
+++ b/main.js
@@ -58,6 +58,7 @@ var USAGE           = "Error missing args. \n" +
     "--skipMainTests : (optional) Do not run main (cordova-test-framework) tests\n" +
     "--skipAppiumTests : (optional) Do not run Appium tests\n" +
     "--ci : (optional) Skip tests that require user interaction\n" +
+    "--fileTransferServer : (optional) (cordova-plugin-file-transfer only) A server address
tests should connect to\n" +
     "";
 
 var argv = parseArgs(process.argv.slice(2));
@@ -152,6 +153,10 @@ if (pathToParamedicConfig || // --config
         paramedicConfig.setTarget(argv.target);
     }
 
+    if (argv.fileTransferServer) {
+        paramedicConfig.setFileTransferServer(argv.fileTransferServer);
+    }
+
     paramedic.run(paramedicConfig)
     .catch(function (error) {
         if (error && error.stack) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message