[jira] [Commented] (CB-8931) Path in download function plugin-file-transfer does not replace all slashes

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14518966#comment-14518966
 ] 

ASF GitHub Bot commented on CB-8931:


Github user starquake commented on the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/76#issuecomment-97352432
  
Create a JIRA ticket here:
https://issues.apache.org/jira/browse/CB-8931


> Path in download function plugin-file-transfer does not replace all slashes
> ---
>
> Key: CB-8931
> URL: https://issues.apache.org/jira/browse/CB-8931
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File Transfer
>Affects Versions: 1.0.0
> Environment: Windows 8.0 / 8.1
>Reporter: Jan Visser
>
> The following code only removes the first slash. It should replace all 
> slashes:
> {code:javascript}
> var nativeURI = storageFile.path.replace(appData.localFolder.path, 
> 'ms-appdata:///local')
>   .replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
>   .replace('\\', '/');
> {code}
> last line should read:
> {code:javascript}
> .replace(/\\/g, '/');
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8815) Possibility to clear the cache in iOS

2015-04-29 Thread Ruben Biesemans (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14518774#comment-14518774
 ] 

Ruben Biesemans commented on CB-8815:
-

I am sure that it didn't work as expected when I posted this.
But maybe we aren't using the latest version at work. I will have to check that 
and get back to you.

I also read in the comments of the pull request that the naming raises some 
questions and that it's only cookies that are cleared and not the actual cache.

Thanks for the response anyway. I'll look into this when I have the time.

> Possibility to clear the cache in iOS
> -
>
> Key: CB-8815
> URL: https://issues.apache.org/jira/browse/CB-8815
> Project: Apache Cordova
>  Issue Type: Wish
>  Components: Plugin InAppBrowser
> Environment: iOS
>Reporter: Ruben Biesemans
>Assignee: jcesarmobile
>Priority: Minor
>  Labels: newbie
>
> There's no possibility to clear the cache of the browser on iOS at the 
> moment. Only for Android.
> Googling a solution for iOS I found the following:
> http://anexinetmobility.blogspot.be/2013/10/clearing-inappbrowser-cache-on-ios-with.html
> Which seems to work for me.
> So is it not possible to provide some kind of way of exposing this the same 
> way as for android (option on window.open that triggers the clearcache)?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-6503) allow file uploads to be sent directly, rather than only as multipart form data

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-6503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14518889#comment-14518889
 ] 

ASF GitHub Bot commented on CB-6503:


Github user riaan53 commented on the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/27#issuecomment-97330361
  
+1


> allow file uploads to be sent directly, rather than only as multipart form 
> data
> ---
>
> Key: CB-6503
> URL: https://issues.apache.org/jira/browse/CB-6503
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Plugin File Transfer
>Affects Versions: 3.3.0
>Reporter: M C
>Priority: Minor
>
> > > on iOS, Android and Amazon, if upload has a header named Content-Type, 
> > > multipart form data will NOT be used 
> > I understand the problem, but wouldn't it be better if we just filtered out 
> > "Content-Type" for user-defined headers? (disallow setting it)
> In this use case, direct upload without the multipart encoding is desirable, 
> so disallowing the header and forcing multipart upload would have the 
> opposite effect of what was needed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Created] (CB-8931) Path in download function plugin-file-transfer does not replace all slashes

2015-04-29 Thread Jan Visser (JIRA)
Jan Visser created CB-8931:
--

 Summary: Path in download function plugin-file-transfer does not 
replace all slashes
 Key: CB-8931
 URL: https://issues.apache.org/jira/browse/CB-8931
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File Transfer
Affects Versions: 1.0.0
 Environment: Windows 8.0 / 8.1
Reporter: Jan Visser


The following code only removes the first slash. It should replace all slashes:

{code:javascript}
var nativeURI = storageFile.path.replace(appData.localFolder.path, 
'ms-appdata:///local')
  .replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
  .replace('\\', '/');
{code}
last line should read:
{code:javascript}
.replace(/\\/g, '/');
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Created] (CB-8932) windows: Make plugin add --link allow for direct editing of plugin source files

2015-04-29 Thread Vladimir Kotikov (JIRA)
Vladimir Kotikov created CB-8932:


 Summary: windows: Make plugin add --link allow for direct editing 
of plugin source files
 Key: CB-8932
 URL: https://issues.apache.org/jira/browse/CB-8932
 Project: Apache Cordova
  Issue Type: Improvement
  Components: Plugman
Reporter: Vladimir Kotikov


Since creating symlinks on Windows requires administrative privileges by 
default, the best way to enable pugin source files editing from Visual studio 
is to include them to project file from their source location.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8931) Path in download function plugin-file-transfer does not replace all slashes

2015-04-29 Thread Jan Visser (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14518965#comment-14518965
 ] 

Jan Visser commented on CB-8931:


I have submitted a pull request here:

https://github.com/apache/cordova-plugin-file-transfer/pull/76

> Path in download function plugin-file-transfer does not replace all slashes
> ---
>
> Key: CB-8931
> URL: https://issues.apache.org/jira/browse/CB-8931
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File Transfer
>Affects Versions: 1.0.0
> Environment: Windows 8.0 / 8.1
>Reporter: Jan Visser
>
> The following code only removes the first slash. It should replace all 
> slashes:
> {code:javascript}
> var nativeURI = storageFile.path.replace(appData.localFolder.path, 
> 'ms-appdata:///local')
>   .replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
>   .replace('\\', '/');
> {code}
> last line should read:
> {code:javascript}
> .replace(/\\/g, '/');
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Updated] (CB-8932) windows: Make plugin add --link allow for direct editing of plugin source files

2015-04-29 Thread Vladimir Kotikov (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Kotikov updated CB-8932:
-
Description: Similar for android and ios it will be great to support 
{{--link}} option. However, since creating symlinks on Windows requires 
administrative privileges by default, the best way to enable pugin source files 
editing from Visual studio is to include them to project file from their source 
location.  (was: Since creating symlinks on Windows requires administrative 
privileges by default, the best way to enable pugin source files editing from 
Visual studio is to include them to project file from their source location.)

> windows: Make plugin add --link allow for direct editing of plugin source 
> files
> ---
>
> Key: CB-8932
> URL: https://issues.apache.org/jira/browse/CB-8932
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: CordovaLib, Plugman
>Reporter: Vladimir Kotikov
>
> Similar for android and ios it will be great to support {{--link}} option. 
> However, since creating symlinks on Windows requires administrative 
> privileges by default, the best way to enable pugin source files editing from 
> Visual studio is to include them to project file from their source location.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Updated] (CB-8932) windows: Make plugin add --link allow for direct editing of plugin source files

2015-04-29 Thread Vladimir Kotikov (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Kotikov updated CB-8932:
-
Component/s: CordovaLib

> windows: Make plugin add --link allow for direct editing of plugin source 
> files
> ---
>
> Key: CB-8932
> URL: https://issues.apache.org/jira/browse/CB-8932
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: CordovaLib, Plugman
>Reporter: Vladimir Kotikov
>Assignee: Vladimir Kotikov
>
> Similar for android and ios it will be great to support {{--link}} option. 
> However, since creating symlinks on Windows requires administrative 
> privileges by default, the best way to enable pugin source files editing from 
> Visual studio is to include them to project file from their source location.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Assigned] (CB-8932) windows: Make plugin add --link allow for direct editing of plugin source files

2015-04-29 Thread Vladimir Kotikov (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Kotikov reassigned CB-8932:


Assignee: Vladimir Kotikov

> windows: Make plugin add --link allow for direct editing of plugin source 
> files
> ---
>
> Key: CB-8932
> URL: https://issues.apache.org/jira/browse/CB-8932
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: CordovaLib, Plugman
>Reporter: Vladimir Kotikov
>Assignee: Vladimir Kotikov
>
> Similar for android and ios it will be great to support {{--link}} option. 
> However, since creating symlinks on Windows requires administrative 
> privileges by default, the best way to enable pugin source files editing from 
> Visual studio is to include them to project file from their source location.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Created] (CB-8933) (Windows) File transfer plugin tests occasionally fail in mobilespec

2015-04-29 Thread Alexander Sorokin (JIRA)
Alexander Sorokin created CB-8933:
-

 Summary: (Windows) File transfer plugin tests occasionally fail in 
mobilespec
 Key: CB-8933
 URL: https://issues.apache.org/jira/browse/CB-8933
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File Transfer, Windows
Reporter: Alexander Sorokin


These failures are happening from time to time (all in a bunch):
{code}
Starting results verification for cordova-windows-1662
Total failures: 18
Test failures were detected. Open 
http://cdv-ms-buildbot.cloudapp.net:5984/_utils/document.html?mobilespec_results/cordova-windows-1662__6.3.9600.16384__Win64
 for details
Failing tests:
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.4 should download a file
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.5 should download a file using http basic auth
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.6 should get 401 status on http basic auth failure
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.8 should download a file using https://
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.11 should call the error callback on abort()
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.9 should not leave partial file due to abort
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.10 should be stopped by abort() right away
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.12 should get http status on failure
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.13 should get http body on failure
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.15 should handle unknown host
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.17 progress should work with gzip encoding
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods download 
filetransfer.spec.30 downloaded file entries should have a toNativeURL method
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.18 should be able to upload a file
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.19 should be able to upload a file with http basic auth
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.21 should be stopped by abort() right away
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.22 should get http status and body on failure
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.25 should handle unknown host
cordova-plugin-file-transfer-tests.tests >> FileTransfer methods upload 
filetransfer.spec.27 should be able to set custom headers
{code}
Tests fail by timeout.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519963#comment-14519963
 ] 

ASF GitHub Bot commented on CB-8870:


GitHub user dblotsky opened a pull request:

https://github.com/apache/cordova-medic/pull/47

[CB-8870] Consolidating medic code.

Consolidating medic code as the following commands to `medic.js`:

medic.js kill - kills emulators
medic.js clean- cleans workspace
medic.js checkout - checks out code
medic.js run  - runs mobilespec
medic.js check- checks run results

The old code can be deleted once this is accepted.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/MSOpenTech/cordova-medic CB-8870

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-medic/pull/47.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #47


commit 0497c2cdbefeb2752019fcbaa13be787ec9e5fb7
Author: Dmitry Blotsky 
Date:   2015-04-17T21:34:52Z

[CB-8870] Consolidating medic code.




> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519981#comment-14519981
 ] 

ASF GitHub Bot commented on CB-8870:


Github user muratsu commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29369965
  
--- Diff: bin/lib/couchdb.js ---
@@ -0,0 +1,151 @@
+
+/*
+Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
+
+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.
+*/
--- End diff --

is this an external lib? header license looks different


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519979#comment-14519979
 ] 

ASF GitHub Bot commented on CB-8870:


Github user muratsu commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29369904
  
--- Diff: bin/lib/couchdb.js ---
@@ -0,0 +1,151 @@
+
+/*
+Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
+
+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 request = require('request');
+var follow = require('follow');
+
+var DEFAULT_COUCHDB_URI = "http://localhost";;
+
+var couchdbURI = DEFAULT_COUCHDB_URI;
+
+function init(uri) {
+couchdbURI = uri;
+}
+
+// Generic interface + convenience functions for working with couch dbs
+function db(name) {
+this.name = name;
+this.db_url = couchdbURI + '/' + this.name;
+this.is_following = false;
+}
+
+db.prototype = {
+get:function(id, callback) {
+// Gets a specific document by id
+
+var db = this;
+var url = this.db_url + '/' + id;
+request.get(url, function(error, response, body) {
+if (error) {
+callback(error);
+} else {
+if (response.statusCode == 200) {
+callback(false, JSON.parse(body));
+} else if (response.statusCode == 404) {
+callback(true, 404);
+} else {
+callback(true, response.statusCode);
+}
+}
+});
+},
+query_view:function(design, view, callback) {
+// Queries a view.
+
+var db = this;
+var url = this.db_url + '/_design/' + design + '/_view/' + view;
+request.get(url, function(error, response, body) {
+if (error) {
+callback(error);
+} else {
+if (response.statusCode == 200) {
+callback(false, JSON.parse(body));
+} else if (response.statusCode == 404) {
+callback(true, 404);
+} else {
+callback(true, response.statusCode);
+}
+}
+});
+},
+clobber:function(id, document, callback) {
+// Overwrites a document
+var db = this;
+var url = this.db_url + '/' + id;
+
+request.put({
+url:url,
+json:document
+}, function(error, response, body) {
+if (error || response.statusCode === 404) {
+console.error('Request failed: ' + url);
+callback(true, JSON.stringify(body));
+return;
+}
+
+var status = response.statusCode;
+if (status == 201) callback(false, body);
+else if (status == 409) {
+request.get(url, function(err, resp, bod) {
+if (err) callback(err);
+else {
+if (resp.statusCode == 200) {
+var existing = JSON.parse(bod);
+var rev = existing._rev;
+request.del({
+url:url + '?rev=' + rev,
+}, function(er, res, boday) {
+if (er) callback(er);
+else {
+if (res.statusCode == 200) {
+request.put({
+url:url,
+json:document
+}, function(argh, r, bodee) {
+if (argh) callback(argh);
+else {
+if(r){
+if (r.statusCode == 
201) callback(false, bodee)

[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519986#comment-14519986
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370102
  
--- Diff: bin/medic.js ---
@@ -19,18 +19,44 @@
  * under the License.
  */
 
-"use strict";
+/* jshint node: true */
+
+// "use strict";
 
 // node dependencies
-var fs = require("fs");
-var os = require("os");
+var fs   = require("fs");
+var os   = require("os");
+var path = require("path");
 
 // external dependencies
 var shelljs  = require("shelljs");
 var optimist = require("optimist");
 
+// internal dependencies
+var testwait  = require("./lib/testwait");
+var testcheck = require("./lib/testcheck");
+
 // constants
-var MAX_REMOVAL_ATTEMPTS = 3;
+var MAX_REMOVAL_ATTEMPTS= 3;
+var CORDOVA_MEDIC_DIR   = "cordova-medic";
+var DEFAULT_APP_PATH= "mobilespec";
+var DEFAULT_APP_ENTRY   = "index.html";
+var ANDROID_TIMEOUT = 12;
+var MEDIC_BUILD_PREFIX  = "medic-cli-build";
+var DEFAULT_ENCODING= "utf-8";
+var DEFAULT_WINDOWS_VERSION = "store";
+var WINDOWS_VERSION_CHOICES = ["store", "store80", "phone"];
+var ONE_MINUTE  = 1 * 60;
--- End diff --

Seems like 1/1000th of a minute.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519989#comment-14519989
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370150
  
--- Diff: bin/medic.js ---
@@ -19,18 +19,44 @@
  * under the License.
  */
 
-"use strict";
+/* jshint node: true */
+
+// "use strict";
 
 // node dependencies
-var fs = require("fs");
-var os = require("os");
+var fs   = require("fs");
+var os   = require("os");
+var path = require("path");
 
 // external dependencies
 var shelljs  = require("shelljs");
 var optimist = require("optimist");
 
+// internal dependencies
+var testwait  = require("./lib/testwait");
+var testcheck = require("./lib/testcheck");
+
 // constants
-var MAX_REMOVAL_ATTEMPTS = 3;
+var MAX_REMOVAL_ATTEMPTS= 3;
+var CORDOVA_MEDIC_DIR   = "cordova-medic";
+var DEFAULT_APP_PATH= "mobilespec";
+var DEFAULT_APP_ENTRY   = "index.html";
+var ANDROID_TIMEOUT = 12;
+var MEDIC_BUILD_PREFIX  = "medic-cli-build";
+var DEFAULT_ENCODING= "utf-8";
+var DEFAULT_WINDOWS_VERSION = "store";
+var WINDOWS_VERSION_CHOICES = ["store", "store80", "phone"];
+var ONE_MINUTE  = 1 * 60;
--- End diff --

Why 1 times 60?  Time is in ms or s?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519992#comment-14519992
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370199
  
--- Diff: bin/medic.js ---
@@ -19,18 +19,44 @@
  * under the License.
  */
 
-"use strict";
+/* jshint node: true */
+
+// "use strict";
 
 // node dependencies
-var fs = require("fs");
-var os = require("os");
+var fs   = require("fs");
+var os   = require("os");
+var path = require("path");
 
 // external dependencies
 var shelljs  = require("shelljs");
 var optimist = require("optimist");
 
+// internal dependencies
+var testwait  = require("./lib/testwait");
+var testcheck = require("./lib/testcheck");
+
 // constants
-var MAX_REMOVAL_ATTEMPTS = 3;
+var MAX_REMOVAL_ATTEMPTS= 3;
+var CORDOVA_MEDIC_DIR   = "cordova-medic";
+var DEFAULT_APP_PATH= "mobilespec";
+var DEFAULT_APP_ENTRY   = "index.html";
+var ANDROID_TIMEOUT = 12;
--- End diff --

Android timeout is really, really long if minute is 60...  Maybe rewrite 
ANDROID_TIMEOUT in context of ONE_MINUTE?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519996#comment-14519996
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370291
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
--- End diff --

No tasks seems to equal success case.  If truly a usage error, throw, but 
otherwise this seems unnecessarily chatty.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520001#comment-14520001
 ] 

ASF GitHub Bot commented on CB-8870:


Github user muratsu commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370417
  
--- Diff: bin/lib/testcheck.js ---
@@ -0,0 +1,77 @@
+var http = require('http'),
+url = require('url'),
+q = require('q');
+
+module.exports = function (sha, dbHost) {
+
+function getDocumentIdBySha() {
+var options = {
+host : url.parse(dbHost).hostname,
+port : url.parse(dbHost).port,
+path : '/mobilespec_results/_all_docs?start_key="' + sha + 
'"&limit=1'
+},
+resultsDoc = '',
+d = q.defer();
+
+http.get(options, function (result) {
+result.on("data", function (chunk) {
+resultsDoc += chunk.toString();
+});
+result.on('end', function () {
+d.resolve(JSON.parse(resultsDoc).rows[0].id);
+});
+}).on('error', function (e) {
+console.log("Got error: " + e.message);
+d.reject(e);
+});
+
+return d.promise;
+};
+
+function getTestResult(resultId) {
+var options = {
+host : url.parse(dbHost).hostname,
+port : url.parse(dbHost).port,
+path : '/mobilespec_results/' + resultId
+};
+var d = q.defer();
+var resultsJSON = "";
+var failure;
--- End diff --

never used?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520007#comment-14520007
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370556
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
+return;
+}
+
+if (isWindows()) {
+var cli  = "taskkill /F";
+var args = taskNames.map(function (name) { return "/IM \"" + name 
+ "\""; });
+} else {
+var cli  = "killall";
+var args = taskNames.map(function (name) { return "\"" + name + 
"\""; });
+}
+
+var command = cli + " " + args.join(" ");
+medicLog("running the following command:");
+medicLog("" + command);
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+console.warn("WARNING: kill command returned " + returnCode);
+}
+});
+}
+
 function fatal(message) {
-console.error("ERROR: " + message);
-process.exit(1);
+console.error("FATAL: " + message);
+process.exit(ERROR);
+}
+
+function medicLog(message) {
+console.log("\033[32m[MEDIC LOG]\033[m " + message);
--- End diff --

Might be worth adding a comment so that people can parse out what your 
escaped characters are.  They look like octal encodings instead of Unicode.  
While valid, is uncommon because translating to octal and then to Latin-1 is a 
two-step process.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520011#comment-14520011
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370686
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
+return;
+}
+
+if (isWindows()) {
+var cli  = "taskkill /F";
+var args = taskNames.map(function (name) { return "/IM \"" + name 
+ "\""; });
+} else {
+var cli  = "killall";
+var args = taskNames.map(function (name) { return "\"" + name + 
"\""; });
+}
+
+var command = cli + " " + args.join(" ");
+medicLog("running the following command:");
+medicLog("" + command);
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+console.warn("WARNING: kill command returned " + returnCode);
+}
+});
+}
+
 function fatal(message) {
-console.error("ERROR: " + message);
-process.exit(1);
+console.error("FATAL: " + message);
+process.exit(ERROR);
+}
+
+function medicLog(message) {
+console.log("\033[32m[MEDIC LOG]\033[m " + message);
+}
+
+function currentMillisecond() {
+// NOTE:
+//  coercing a Date to a Number returns
+//  the Date's representation in milliseconds
+return Number(new Date());
--- End diff --

Consider new Date().valueOf() instead of the coercing operator.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520012#comment-14520012
 ] 

ASF GitHub Bot commented on CB-8870:


Github user dblotsky commented on the pull request:

https://github.com/apache/cordova-medic/pull/47#issuecomment-97549951
  
Comment from myself: fix license headers.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520014#comment-14520014
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29370995
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
+return;
+}
+
+if (isWindows()) {
+var cli  = "taskkill /F";
+var args = taskNames.map(function (name) { return "/IM \"" + name 
+ "\""; });
+} else {
+var cli  = "killall";
+var args = taskNames.map(function (name) { return "\"" + name + 
"\""; });
+}
+
+var command = cli + " " + args.join(" ");
+medicLog("running the following command:");
+medicLog("" + command);
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+console.warn("WARNING: kill command returned " + returnCode);
+}
+});
+}
+
 function fatal(message) {
-console.error("ERROR: " + message);
-process.exit(1);
+console.error("FATAL: " + message);
+process.exit(ERROR);
+}
+
+function medicLog(message) {
+console.log("\033[32m[MEDIC LOG]\033[m " + message);
+}
+
+function currentMillisecond() {
+// NOTE:
+//  coercing a Date to a Number returns
+//  the Date's representation in milliseconds
+return Number(new Date());
+}
+
+function generateBuildID() {
+var components = [MEDIC_BUILD_PREFIX, currentMillisecond()];
+return components.join("-");
+}
+
+function tasksOnPlatform(platformName) {
+switch (platformName) {
+case WINDOWS:
+return ["WWAHost.exe"];
+case WP8:
+return ["Xde.exe"];
+case IOS:
+return ["iOS Simulator"];
+case ANDROID:
+if (isWindows()) {
+return ["emulator-arm.exe", "adb.exe"];
+} else {
+return ["emulator64-x86"];
+}
+case BLACKBERRY:
+return [];
+default:
+fatal("unknown platform " + platformName);
+}
+}
+
+function cloneProject(projectName, projectsConfig) {
+
+var project  = projectsConfig[projectName];
+var codebase = project.codebases[project.codebase];
+var command  = "git clone " + codebase.repo + " --branch=" + 
codebase.branch + " --depth 1"
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+fatal("command \"" + command + "\" failed with code " + 
returnCode);
+}
+});
+}
+
+function createMedicJson(appPath, buildId, couchdbURI) {
+
+medicLog("Writing medic.json to " + appPath);
+medicLog("sha: " + buildId);
+medicLog("couchdb: " + couchdbURI);
+
+// NOTE:
+//  the "sha" name is a misnomer, but is kept
+//  to be compatible with plugin-test-framework
+var medicConfig = {
+sha: buildId,
+couchdb: couchdbURI
+};
+
+var medicConfigContents = JSON.stringify(medicConfig) + "\n";
+var medicConfigPath = path.join(appPath, "www", "medic.json");
+
+fs.writeFileSync(medicConfigPath, medicConfigContents, 
DEFAULT_ENCODING);
+}
+
+function isWindows() {
+return /^win/.test(os.platform());
--- End diff --

Why assert at the beginning of the string?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520016#comment-14520016
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29371130
  
--- Diff: bin/medic.js ---
@@ -55,6 +181,210 @@ function exclusiveLs(lsPath, excludes) {
 });
 }
 
+function getConfigPath(appPath) {
+return path.join(appPath, "config.xml");
+}
+
+function getCSPPath(appPath) {
+return path.join(appPath, "www", "csp-incl.js");
+}
+
+function addURIToWhitelist(appPath, uri) {
+
+var configFile = getConfigPath(appPath);
+var cspFile= getCSPPath(appPath);
+
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+var cspContent= fs.readFileSync(cspFile, DEFAULT_ENCODING);
+
+// add whitelisting rule allow access to couch server
+medicLog("Adding whitelist rule for CouchDB host: " + uri);
+var accessOriginTag = "";
+if (!contains(configContent, accessOriginTag)) {
+configContent = configContent.split("").join("");
+configContent += "" + accessOriginTag + "\n\n";
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+// add couchdb address to csp rules
+medicLog("Adding CSP rule for CouchDB host: " + uri);
+var cspRule = "connect-src " + uri;
+if (!contains(cspContent, cspRule)) {
+cspContent = cspContent.replace("connect-src", cspRule);
+fs.writeFileSync(cspFile, cspContent, DEFAULT_ENCODING);
+}
+}
+
+function setEntryPoint(appPath, entryPoint) {
+
+var configFile = getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+// replace/add start page preference
+// check if config.xml already contains  element
+medicLog("Setting entry point to " + entryPoint + " in config.xml");
+
+if (configContent.match(//gi)) {
+configContent = configContent.replace(
+//gi,
+""
+);
+
+} else {
+
+// add entry point to config
+configContent = configContent.split("").join("") +
+"\n";
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function changeLoadTimeout(appPath, timeout) {
+
+medicLog("Increasing url loading timeout for android to " + timeout);
+
+var timeoutRegex   = /)|(>.*?<\/\s*preference>))/i;
--- End diff --

Searching SGML-type languages with regex is gross.  Did you consider using 
a lib like ElementTree instead?  That would probably make your code a lot 
cleaner, to find elements via xpath.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520020#comment-14520020
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29371372
  
--- Diff: bin/medic.js ---
@@ -55,6 +181,210 @@ function exclusiveLs(lsPath, excludes) {
 });
 }
 
+function getConfigPath(appPath) {
+return path.join(appPath, "config.xml");
+}
+
+function getCSPPath(appPath) {
+return path.join(appPath, "www", "csp-incl.js");
+}
+
+function addURIToWhitelist(appPath, uri) {
+
+var configFile = getConfigPath(appPath);
+var cspFile= getCSPPath(appPath);
+
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+var cspContent= fs.readFileSync(cspFile, DEFAULT_ENCODING);
+
+// add whitelisting rule allow access to couch server
+medicLog("Adding whitelist rule for CouchDB host: " + uri);
+var accessOriginTag = "";
+if (!contains(configContent, accessOriginTag)) {
+configContent = configContent.split("").join("");
+configContent += "" + accessOriginTag + "\n\n";
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+// add couchdb address to csp rules
+medicLog("Adding CSP rule for CouchDB host: " + uri);
+var cspRule = "connect-src " + uri;
+if (!contains(cspContent, cspRule)) {
+cspContent = cspContent.replace("connect-src", cspRule);
+fs.writeFileSync(cspFile, cspContent, DEFAULT_ENCODING);
+}
+}
+
+function setEntryPoint(appPath, entryPoint) {
+
+var configFile = getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+// replace/add start page preference
+// check if config.xml already contains  element
+medicLog("Setting entry point to " + entryPoint + " in config.xml");
+
+if (configContent.match(//gi)) {
+configContent = configContent.replace(
+//gi,
+""
+);
+
+} else {
+
+// add entry point to config
+configContent = configContent.split("").join("") +
+"\n";
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function changeLoadTimeout(appPath, timeout) {
+
+medicLog("Increasing url loading timeout for android to " + timeout);
+
+var timeoutRegex   = /)|(>.*?<\/\s*preference>))/i;
+var timeoutTag = "";
+var timeoutTagWithPlatform = "\n
\n
\n";
+var platformRegex  = //i;
+var widgetRegex= /<\/s*widget\s*>/i;
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+if (timeoutRegex.test(configContent)) {
+configContent = configContent.replace(timeoutRegex, timeoutTag);
+medicLog("Found \"loadUrlTimeoutValue\" preference, replacing with 
desired value");
+} else if (platformRegex.test(configContent)) {
+var oldPlatformTag = platformRegex.exec(configContent)[0];
+configContent = configContent.replace(platformRegex, 
oldPlatformTag + "\n" + timeoutTag);
+medicLog("Found platform tag, appending \"loadUrlTimeoutValue\" 
preference");
+} else if (widgetRegex.test(configContent)) {
+var oldWidgetTag = widgetRegex.exec(configContent)[0];
+configContent = configContent.replace(widgetRegex, 
timeoutTagWithPlatform + oldWidgetTag);
+medicLog("Did not find platform tag, adding preference with 
platform tag");
+} else {
+medicLog("Warning: could not modify config.xml for android: no 
 tag found!");
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function setWindowsTargetStoreVersion(appPath, version) {
+
+medicLog('setting target store version to ' + version);
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+var versionPreference = '';
--- End diff --

Another example where you should be using ElementTree instead.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordo

[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520022#comment-14520022
 ] 

ASF GitHub Bot commented on CB-8870:


Github user robpaveza commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29371466
  
--- Diff: bin/medic.js ---
@@ -55,6 +181,210 @@ function exclusiveLs(lsPath, excludes) {
 });
 }
 
+function getConfigPath(appPath) {
+return path.join(appPath, "config.xml");
+}
+
+function getCSPPath(appPath) {
+return path.join(appPath, "www", "csp-incl.js");
+}
+
+function addURIToWhitelist(appPath, uri) {
+
+var configFile = getConfigPath(appPath);
+var cspFile= getCSPPath(appPath);
+
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+var cspContent= fs.readFileSync(cspFile, DEFAULT_ENCODING);
+
+// add whitelisting rule allow access to couch server
+medicLog("Adding whitelist rule for CouchDB host: " + uri);
+var accessOriginTag = "";
+if (!contains(configContent, accessOriginTag)) {
+configContent = configContent.split("").join("");
+configContent += "" + accessOriginTag + "\n\n";
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+// add couchdb address to csp rules
+medicLog("Adding CSP rule for CouchDB host: " + uri);
+var cspRule = "connect-src " + uri;
+if (!contains(cspContent, cspRule)) {
+cspContent = cspContent.replace("connect-src", cspRule);
+fs.writeFileSync(cspFile, cspContent, DEFAULT_ENCODING);
+}
+}
+
+function setEntryPoint(appPath, entryPoint) {
+
+var configFile = getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+// replace/add start page preference
+// check if config.xml already contains  element
+medicLog("Setting entry point to " + entryPoint + " in config.xml");
+
+if (configContent.match(//gi)) {
+configContent = configContent.replace(
+//gi,
+""
+);
+
+} else {
+
+// add entry point to config
+configContent = configContent.split("").join("") +
+"\n";
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function changeLoadTimeout(appPath, timeout) {
+
+medicLog("Increasing url loading timeout for android to " + timeout);
+
+var timeoutRegex   = /)|(>.*?<\/\s*preference>))/i;
+var timeoutTag = "";
+var timeoutTagWithPlatform = "\n
\n
\n";
+var platformRegex  = //i;
+var widgetRegex= /<\/s*widget\s*>/i;
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+if (timeoutRegex.test(configContent)) {
+configContent = configContent.replace(timeoutRegex, timeoutTag);
+medicLog("Found \"loadUrlTimeoutValue\" preference, replacing with 
desired value");
+} else if (platformRegex.test(configContent)) {
+var oldPlatformTag = platformRegex.exec(configContent)[0];
+configContent = configContent.replace(platformRegex, 
oldPlatformTag + "\n" + timeoutTag);
+medicLog("Found platform tag, appending \"loadUrlTimeoutValue\" 
preference");
+} else if (widgetRegex.test(configContent)) {
+var oldWidgetTag = widgetRegex.exec(configContent)[0];
+configContent = configContent.replace(widgetRegex, 
timeoutTagWithPlatform + oldWidgetTag);
+medicLog("Did not find platform tag, adding preference with 
platform tag");
+} else {
+medicLog("Warning: could not modify config.xml for android: no 
 tag found!");
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function setWindowsTargetStoreVersion(appPath, version) {
+
+medicLog('setting target store version to ' + version);
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+var versionPreference = '';
+configContent = configContent.replace('', versionPreference + 
'\r\n');
+
+fs.writeFileSync(configFile, configContent, "utf8");
+}
+
+function androidSpecifics(argv) {
--- End diff --

Your "(platform)Specifics" functions don't really indicate what it is they 
do by their names.


> Medic sh

[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520104#comment-14520104
 ] 

ASF GitHub Bot commented on CB-8870:


Github user dblotsky commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29374599
  
--- Diff: bin/lib/couchdb.js ---
@@ -0,0 +1,151 @@
+
+/*
+Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
+
+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.
+*/
--- End diff --

Nope, it's just the license this file had. It's this file: 
https://github.com/apache/cordova-medic/blob/master/src/couchdb/interface.js. 
What should the license be?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520107#comment-14520107
 ] 

ASF GitHub Bot commented on CB-8870:


Github user dblotsky commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29374675
  
--- Diff: bin/medic.js ---
@@ -19,18 +19,44 @@
  * under the License.
  */
 
-"use strict";
+/* jshint node: true */
+
+// "use strict";
 
 // node dependencies
-var fs = require("fs");
-var os = require("os");
+var fs   = require("fs");
+var os   = require("os");
+var path = require("path");
 
 // external dependencies
 var shelljs  = require("shelljs");
 var optimist = require("optimist");
 
+// internal dependencies
+var testwait  = require("./lib/testwait");
+var testcheck = require("./lib/testcheck");
+
 // constants
-var MAX_REMOVAL_ATTEMPTS = 3;
+var MAX_REMOVAL_ATTEMPTS= 3;
+var CORDOVA_MEDIC_DIR   = "cordova-medic";
+var DEFAULT_APP_PATH= "mobilespec";
+var DEFAULT_APP_ENTRY   = "index.html";
+var ANDROID_TIMEOUT = 12;
+var MEDIC_BUILD_PREFIX  = "medic-cli-build";
+var DEFAULT_ENCODING= "utf-8";
+var DEFAULT_WINDOWS_VERSION = "store";
+var WINDOWS_VERSION_CHOICES = ["store", "store80", "phone"];
+var ONE_MINUTE  = 1 * 60;
--- End diff --

Good catch. Will add comments regarding units and fix the redundant 
multiplication.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520120#comment-14520120
 ] 

ASF GitHub Bot commented on CB-8870:


Github user nikhilkh commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29375447
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
+return;
+}
+
+if (isWindows()) {
+var cli  = "taskkill /F";
+var args = taskNames.map(function (name) { return "/IM \"" + name 
+ "\""; });
+} else {
+var cli  = "killall";
+var args = taskNames.map(function (name) { return "\"" + name + 
"\""; });
+}
+
+var command = cli + " " + args.join(" ");
+medicLog("running the following command:");
+medicLog("" + command);
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+console.warn("WARNING: kill command returned " + returnCode);
--- End diff --

Does it make sense to print the output also here - along with the return 
code?


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520132#comment-14520132
 ] 

ASF GitHub Bot commented on CB-8870:


Github user nikhilkh commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29375808
  
--- Diff: bin/medic.js ---
@@ -39,9 +65,109 @@ var argv = optimist
 .argv;
 
 // helpers
+function killTasks(taskNames) {
+
+if (!taskNames || taskNames.length < 1) {
+console.warn("no tasks to kill");
+return;
+}
+
+if (isWindows()) {
+var cli  = "taskkill /F";
+var args = taskNames.map(function (name) { return "/IM \"" + name 
+ "\""; });
+} else {
+var cli  = "killall";
+var args = taskNames.map(function (name) { return "\"" + name + 
"\""; });
+}
+
+var command = cli + " " + args.join(" ");
+medicLog("running the following command:");
+medicLog("" + command);
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+console.warn("WARNING: kill command returned " + returnCode);
+}
+});
+}
+
 function fatal(message) {
-console.error("ERROR: " + message);
-process.exit(1);
+console.error("FATAL: " + message);
+process.exit(ERROR);
+}
+
+function medicLog(message) {
+console.log("\033[32m[MEDIC LOG]\033[m " + message);
+}
+
+function currentMillisecond() {
+// NOTE:
+//  coercing a Date to a Number returns
+//  the Date's representation in milliseconds
+return Number(new Date());
+}
+
+function generateBuildID() {
+var components = [MEDIC_BUILD_PREFIX, currentMillisecond()];
+return components.join("-");
+}
+
+function tasksOnPlatform(platformName) {
+switch (platformName) {
+case WINDOWS:
+return ["WWAHost.exe"];
+case WP8:
+return ["Xde.exe"];
+case IOS:
+return ["iOS Simulator"];
+case ANDROID:
+if (isWindows()) {
+return ["emulator-arm.exe", "adb.exe"];
+} else {
+return ["emulator64-x86"];
+}
+case BLACKBERRY:
+return [];
+default:
+fatal("unknown platform " + platformName);
+}
+}
+
+function cloneProject(projectName, projectsConfig) {
+
+var project  = projectsConfig[projectName];
+var codebase = project.codebases[project.codebase];
+var command  = "git clone " + codebase.repo + " --branch=" + 
codebase.branch + " --depth 1"
+
+shelljs.exec(command, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode !== 0) {
+fatal("command \"" + command + "\" failed with code " + 
returnCode);
--- End diff --

It will be nice to provide the `output` for diagnostics of why it failed


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520135#comment-14520135
 ] 

ASF GitHub Bot commented on CB-8870:


Github user nikhilkh commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29376101
  
--- Diff: bin/medic.js ---
@@ -55,6 +181,210 @@ function exclusiveLs(lsPath, excludes) {
 });
 }
 
+function getConfigPath(appPath) {
+return path.join(appPath, "config.xml");
+}
+
+function getCSPPath(appPath) {
+return path.join(appPath, "www", "csp-incl.js");
+}
+
+function addURIToWhitelist(appPath, uri) {
+
+var configFile = getConfigPath(appPath);
+var cspFile= getCSPPath(appPath);
+
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+var cspContent= fs.readFileSync(cspFile, DEFAULT_ENCODING);
+
+// add whitelisting rule allow access to couch server
+medicLog("Adding whitelist rule for CouchDB host: " + uri);
+var accessOriginTag = "";
+if (!contains(configContent, accessOriginTag)) {
+configContent = configContent.split("").join("");
+configContent += "" + accessOriginTag + "\n\n";
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+// add couchdb address to csp rules
+medicLog("Adding CSP rule for CouchDB host: " + uri);
+var cspRule = "connect-src " + uri;
+if (!contains(cspContent, cspRule)) {
+cspContent = cspContent.replace("connect-src", cspRule);
+fs.writeFileSync(cspFile, cspContent, DEFAULT_ENCODING);
+}
+}
+
+function setEntryPoint(appPath, entryPoint) {
+
+var configFile = getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+// replace/add start page preference
+// check if config.xml already contains  element
+medicLog("Setting entry point to " + entryPoint + " in config.xml");
+
+if (configContent.match(//gi)) {
+configContent = configContent.replace(
+//gi,
+""
+);
+
+} else {
+
+// add entry point to config
+configContent = configContent.split("").join("") +
+"\n";
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function changeLoadTimeout(appPath, timeout) {
+
+medicLog("Increasing url loading timeout for android to " + timeout);
+
+var timeoutRegex   = /)|(>.*?<\/\s*preference>))/i;
+var timeoutTag = "";
+var timeoutTagWithPlatform = "\n
\n
\n";
+var platformRegex  = //i;
+var widgetRegex= /<\/s*widget\s*>/i;
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+if (timeoutRegex.test(configContent)) {
+configContent = configContent.replace(timeoutRegex, timeoutTag);
+medicLog("Found \"loadUrlTimeoutValue\" preference, replacing with 
desired value");
+} else if (platformRegex.test(configContent)) {
+var oldPlatformTag = platformRegex.exec(configContent)[0];
+configContent = configContent.replace(platformRegex, 
oldPlatformTag + "\n" + timeoutTag);
+medicLog("Found platform tag, appending \"loadUrlTimeoutValue\" 
preference");
+} else if (widgetRegex.test(configContent)) {
+var oldWidgetTag = widgetRegex.exec(configContent)[0];
+configContent = configContent.replace(widgetRegex, 
timeoutTagWithPlatform + oldWidgetTag);
+medicLog("Did not find platform tag, adding preference with 
platform tag");
+} else {
+medicLog("Warning: could not modify config.xml for android: no 
 tag found!");
+}
+
+// write the changes
+fs.writeFileSync(configFile, configContent, DEFAULT_ENCODING);
+}
+
+function setWindowsTargetStoreVersion(appPath, version) {
+
+medicLog('setting target store version to ' + version);
+
+var configFile= getConfigPath(appPath);
+var configContent = fs.readFileSync(configFile, DEFAULT_ENCODING);
+
+var versionPreference = '';
+configContent = configContent.replace('', versionPreference + 
'\r\n');
+
+fs.writeFileSync(configFile, configContent, "utf8");
+}
+
+function androidSpecifics(argv) {
--- End diff --

+1 Please provide meaningful names.


> Medic should display test failures in build status
> ---

[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520138#comment-14520138
 ] 

ASF GitHub Bot commented on CB-8870:


Github user nikhilkh commented on a diff in the pull request:

https://github.com/apache/cordova-medic/pull/47#discussion_r29376311
  
--- Diff: bin/medic.js ---
@@ -109,10 +441,175 @@ function commandClean() {
 
 // if loop exited without success, return an error
 if (success === false) {
-fatal("failed to remove files");
+console.error("failed to remove files");
+process.exitCode = ERROR;
+} else {
+medicLog("cleanup succeeded");
 }
 }
 
+function commandKill() {
+
+// get command-specific args
+argv = optimist
+.usage("Usage: $0 --platform {platform}")
+.demand("platform")
+.argv;
+
+var platform = argv.platform;
+
+// get and kill platform tasks
+var platformTasks = tasksOnPlatform(platform)
+killTasks(platformTasks);
+}
+
+function commandCheckout() {
+
+// get command-specific args
+argv = optimist
+.usage("Usage: $0 --config {path} --exclude {name[,name[,...]]}")
+.demand("config")
+.argv;
+
+var configFile= argv.config;
+var excludedNames = [];
+
+// parse excludes
+if (argv.exclude) {
+excludedNames = argv.exclude.split(",");
+}
+
+// read in config
+var projectsConfig = JSON.parse(fs.readFileSync(configFile, 
DEFAULT_ENCODING));
+
+// clone all projects in the config
+for (var projectName in projectsConfig) {
+if (excludedNames.indexOf(projectName) === (-1)) {
+cloneProject(projectName, projectsConfig);
+}
+}
+}
+
+function commandRun() {
+
+// get command-specific args
+argv = optimist
+.usage("Usage: $0 {options}")
+.demand("platform")
+.demand("couchdb")
+.default("entry", DEFAULT_APP_ENTRY)
+.default("id", generateBuildID())
+.default("app", DEFAULT_APP_PATH)
+.default("timeout", DEFAULT_TIMEOUT).describe("timeout", "timeout 
in seconds")
+.default("winvers", DEFAULT_WINDOWS_VERSION).describe("winvers", 
"[" + WINDOWS_VERSION_CHOICES.join("|") + "]")
+.argv;
+
+var platform   = argv.platform;
+var buildId= argv.id;
+var appPath= argv.app;
+var couchdbURI = argv.couchdb;
+var entryPoint = argv.entry;
+var timeout= argv.timeout;
+
+var cli = getLocalCLI();
+
+// check that the app exists
+if (!fs.existsSync(appPath)) {
+fatal("app " + appPath + " does not exist");
+}
+
+// modify the app to run autonomously
+createMedicJson(appPath, buildId, couchdbURI);
+setEntryPoint(appPath, entryPoint);
+addURIToWhitelist(appPath, couchdbURI);
+
+// do platform-specific modifications
+var platformArgs = "";
+if (platform === ANDROID) {
+platformArgs = androidSpecifics(argv);
+} else if (platform === WINDOWS) {
+platformArgs = windowsSpecifics(argv);
+} else if (platform === WP8) {
+platformArgs = wp8Specifics(argv);
+}
+
+// enter the app directory
+shelljs.pushd(appPath);
+
+// build the code (synchronously)
+var buildCommand = cli + " build " + platform + " -- " + platformArgs;
+medicLog("building:");
+medicLog("" + buildCommand);
+
+var result = shelljs.exec(buildCommand, {silent: false, async: false});
+if (result.code != 0) {
+console.error("BUILD FAILED:\n" + result.output);
+fatal("build failed");
+}
+
+// run the code (asynchronously)
+var runCommand = cli + " run " + platform + " -- " + platformArgs;
+medicLog("running:");
+medicLog("" + runCommand);
+
+shelljs.exec(runCommand, {silent: false, async: true}, function 
(returnCode, output) {
+if (returnCode != 0) {
--- End diff --

`returncode` is not always set correctly - cordova build & run.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h

[jira] [Commented] (CB-8930) Vibration on Windows fails without a helpful error message when the SDK isn't available

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520349#comment-14520349
 ] 

ASF GitHub Bot commented on CB-8930:


GitHub user robpaveza opened a pull request:

https://github.com/apache/cordova-plugin-vibration/pull/34

CB-8930: Vibration on Windows fails without a helpful error message when

vibration functionality is missing from the platform.  This detects such a
case and instead fails gracefully that the feature isn't available.  Also
supports the Windows 10 vibration mechanism.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/MSOpenTech/cordova-plugin-vibration CB-8930

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-plugin-vibration/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #34


commit d6a741c6f2deababa2671d7b0e9c98b28a29f8a9
Author: Rob Paveza 
Date:   2015-04-29T00:36:07Z

CB-8930: Vibration on Windows fails without a helpful error message when
vibration functionality is missing from the platform.  This detects such a
case and instead fails gracefully that the feature isn't available.  Also
supports the Windows 10 vibration mechanism.




> Vibration on Windows fails without a helpful error message when the SDK isn't 
> available
> ---
>
> Key: CB-8930
> URL: https://issues.apache.org/jira/browse/CB-8930
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Vibration, Windows
>Reporter: Rob Paveza
>Priority: Minor
>
> ReferenceError: "Vibration" is not defined, when trying to use the vibration 
> plugin on a Windows device that doesn't support vibration.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8930) Vibration on Windows fails without a helpful error message when the SDK isn't available

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520388#comment-14520388
 ] 

ASF GitHub Bot commented on CB-8930:


Github user purplecabbage commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-vibration/pull/34#discussion_r29386717
  
--- Diff: src/windows/VibrationProxy.js ---
@@ -35,26 +35,74 @@ function tryDoAction(actionName, success, fail, args, 
action) {
 }
 
 action(args);
-success();
+success && success();
--- End diff --

Proxy calls are always called with a valid success + fail callback 
function.  No need for the extra checks.


> Vibration on Windows fails without a helpful error message when the SDK isn't 
> available
> ---
>
> Key: CB-8930
> URL: https://issues.apache.org/jira/browse/CB-8930
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Vibration, Windows
>Reporter: Rob Paveza
>Priority: Minor
>
> ReferenceError: "Vibration" is not defined, when trying to use the vibration 
> plugin on a Windows device that doesn't support vibration.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520612#comment-14520612
 ] 

ASF subversion and git services commented on CB-8870:
-

Commit 021e9e1575af14fc3db42471cd08b24a4bf08cba in cordova-medic's branch 
refs/heads/master from [~dblotsky]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-medic.git;h=021e9e1 ]

[CB-8870] Removing refactored code.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520614#comment-14520614
 ] 

ASF subversion and git services commented on CB-8870:
-

Commit 2aeaebcf948c8059e50e9c08cdbc7759bb0b7d4b in cordova-medic's branch 
refs/heads/master from [~dblotsky]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-medic.git;h=2aeaebc ]

[CB-8870] Addressing code review comments and properly detecting and returning 
errors.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520610#comment-14520610
 ] 

ASF subversion and git services commented on CB-8870:
-

Commit 49da31f2aed90d4c1cff5175a7cb27abc99ae9e3 in cordova-medic's branch 
refs/heads/master from [~dblotsky]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-medic.git;h=49da31f ]

[CB-8870] Splitting medic file into subcommands and adding missing commands.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520609#comment-14520609
 ] 

ASF subversion and git services commented on CB-8870:
-

Commit 0ad8700e997fba1c8a91a8485c80f5b47c54bf48 in cordova-medic's branch 
refs/heads/master from [~dblotsky]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-medic.git;h=0ad8700 ]

[CB-8870] Moving CouchDB code and Windows patch over to lib/.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520615#comment-14520615
 ] 

ASF GitHub Bot commented on CB-8870:


Github user asfgit closed the pull request at:

https://github.com/apache/cordova-medic/pull/47


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520611#comment-14520611
 ] 

ASF subversion and git services commented on CB-8870:
-

Commit fe8f70e1acc2f67eb3a868d4c772c88c3f65f572 in cordova-medic's branch 
refs/heads/master from [~dblotsky]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-medic.git;h=fe8f70e ]

[CB-8870] Updating dependencies and making cordova.conf use new medic.js.


> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Resolved] (CB-8870) Medic should display test failures in build status

2015-04-29 Thread Dmitry Blotsky (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Blotsky resolved CB-8870.

Resolution: Implemented

> Medic should display test failures in build status
> --
>
> Key: CB-8870
> URL: https://issues.apache.org/jira/browse/CB-8870
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>  Labels: improvement, medic
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Closed] (CB-8803) Medic builds sometimes fail cleanup on Windows

2015-04-29 Thread Dmitry Blotsky (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Blotsky closed CB-8803.
--

> Medic builds sometimes fail cleanup on Windows
> --
>
> Key: CB-8803
> URL: https://issues.apache.org/jira/browse/CB-8803
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Medic, Windows
>Affects Versions: Master
> Environment: Any cordova-medic setup on Windows.
>Reporter: Dmitry Blotsky
>Priority: Minor
>  Labels: medic, rm, windows
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> On Windows, sometimes the cleanup step fails because of some stray process 
> briefly looking at a directory while the directory is being deleted.
> Although medic uses shelljs's implementation of {{rm}}, it still fails 
> sometimes. This should be fixed with more persistent cleanup code.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Closed] (CB-8805) Allow specifying repo versions for on-demand medic builds

2015-04-29 Thread Dmitry Blotsky (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Blotsky closed CB-8805.
--

> Allow specifying repo versions for on-demand medic builds
> -
>
> Key: CB-8805
> URL: https://issues.apache.org/jira/browse/CB-8805
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: Medic
>Affects Versions: Master
>Reporter: Dmitry Blotsky
>Priority: Critical
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Right now medic only does builds from master for multi-repo builds (e.g. 
> plugins builds). There should be a way to specify the version of each repo 
> that goes into a build. This is needed for release testing and for PR testing.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Closed] (CB-8846) Media plugin test failures on Android Windows, Windows Phone 8.1, WP8, and iOS

2015-04-29 Thread Dmitry Blotsky (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Blotsky closed CB-8846.
--

> Media plugin test failures on Android Windows, Windows Phone 8.1, WP8, and iOS
> --
>
> Key: CB-8846
> URL: https://issues.apache.org/jira/browse/CB-8846
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, iOS, Plugin Media, Windows
>Affects Versions: Master
> Environment: Windows
>Reporter: Dmitry Blotsky
>Assignee: Tony Homer
>  Labels: android, ios, plugin-media, test-fail, windows
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Test results here: 
> http://ci.apache.org/builders/cordova-android-win/builds/1048/steps/running-tests/logs/stdio
> {noformat}
> cordova-plugin-media-tests.tests >> Media media.spec.16 position should be 
> set properly
> cordova-plugin-media-tests.tests >> Media media.spec.17 duration should be 
> set properly
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Resolved] (CB-8846) Media plugin test failures on Android Windows, Windows Phone 8.1, WP8, and iOS

2015-04-29 Thread Dmitry Blotsky (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Blotsky resolved CB-8846.

Resolution: Fixed

> Media plugin test failures on Android Windows, Windows Phone 8.1, WP8, and iOS
> --
>
> Key: CB-8846
> URL: https://issues.apache.org/jira/browse/CB-8846
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Android, iOS, Plugin Media, Windows
>Affects Versions: Master
> Environment: Windows
>Reporter: Dmitry Blotsky
>Assignee: Tony Homer
>  Labels: android, ios, plugin-media, test-fail, windows
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Test results here: 
> http://ci.apache.org/builders/cordova-android-win/builds/1048/steps/running-tests/logs/stdio
> {noformat}
> cordova-plugin-media-tests.tests >> Media media.spec.16 position should be 
> set properly
> cordova-plugin-media-tests.tests >> Media media.spec.17 duration should be 
> set properly
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Created] (CB-8934) cordova.config not being used during cordova.create

2015-04-29 Thread Steve Gill (JIRA)
Steve Gill created CB-8934:
--

 Summary: cordova.config not being used during cordova.create
 Key: CB-8934
 URL: https://issues.apache.org/jira/browse/CB-8934
 Project: Apache Cordova
  Issue Type: Bug
  Components: CordovaLib
Affects Versions: 5.0.0
Reporter: Steve Gill
Assignee: Steve Gill
 Fix For: 5.0.1


With the recent changes of getting cordova app-hello-world from npm, 
cordova.config stopped being used during cordova create. 

The offending line is 
https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/create.js#L58

Issue is, by the time it reaches that line, cfg is always {} if no config was 
passed in via the command line. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Resolved] (CB-8934) cordova.config not being used during cordova.create

2015-04-29 Thread Steve Gill (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-8934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Gill resolved CB-8934.

Resolution: Fixed

Fixed the issue. Now config.json will get merged into cfg object. cfg takes 
preference though. 

Downstreams might encounter this bug. Ran into this problem because the 
PhoneGap-CLI was using config.json to set templates. 

> cordova.config not being used during cordova.create
> ---
>
> Key: CB-8934
> URL: https://issues.apache.org/jira/browse/CB-8934
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: CordovaLib
>Affects Versions: 5.0.0
>Reporter: Steve Gill
>Assignee: Steve Gill
> Fix For: 5.0.1
>
>
> With the recent changes of getting cordova app-hello-world from npm, 
> cordova.config stopped being used during cordova create. 
> The offending line is 
> https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/create.js#L58
> Issue is, by the time it reaches that line, cfg is always {} if no config was 
> passed in via the command line. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org