cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [1/8] cordova-medic git commit: [CB-8870] Moving CouchDB code and Windows patch over to lib/.
Date Thu, 30 Apr 2015 00:35:54 GMT
Repository: cordova-medic
Updated Branches:
  refs/heads/master a85184db5 -> 2aeaebcf9


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


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

Branch: refs/heads/master
Commit: 0ad8700e997fba1c8a91a8485c80f5b47c54bf48
Parents: a85184d
Author: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Authored: Wed Apr 29 15:22:35 2015 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Wed Apr 29 15:22:35 2015 -0700

----------------------------------------------------------------------
 lib/couchdb.js                            | 152 +++++++++++++++++++++++++
 lib/patches/EnableDebuggingForPackage.ps1 |  83 ++++++++++++++
 lib/testcheck.js                          | 100 ++++++++++++++++
 lib/testwait.js                           |  76 +++++++++++++
 src/build/makers/testRunner.js            |  46 --------
 src/couchdb/interface.js                  | 138 ----------------------
 src/utils/EnableDebuggingForPackage.ps1   |  83 --------------
 testchecker.js                            |  77 -------------
 8 files changed, 411 insertions(+), 344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/lib/couchdb.js
----------------------------------------------------------------------
diff --git a/lib/couchdb.js b/lib/couchdb.js
new file mode 100644
index 0000000..c151f0c
--- /dev/null
+++ b/lib/couchdb.js
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/* jshint node: true */
+
+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);
+                                                    else callback(true, r.statusCode);
+                                                } else {
+                                                    callback(true,"URL failed?");
+                                                }
+                                            }
+                                        });
+                                    } else callback(true, res.statusCode);
+                                }
+                            });
+                        } else callback(true, resp.statusCode);
+                    }
+                });
+            } else callback(true, response.statusCode);
+
+        });
+    },
+    follow:function(callback) {
+        if (!this.is_following) {
+            this.is_following = true;
+            follow({
+                db:this.db_url,
+                since:'now',
+                include_docs:true
+            }, function(err, change) {
+                if (!err) callback(false, change);
+                else callback(err);
+            });
+            return true;
+        } else return false;
+    }
+};
+
+module.exports = {
+    init: init,
+    db:   db,
+};

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/lib/patches/EnableDebuggingForPackage.ps1
----------------------------------------------------------------------
diff --git a/lib/patches/EnableDebuggingForPackage.ps1 b/lib/patches/EnableDebuggingForPackage.ps1
new file mode 100644
index 0000000..80414bd
--- /dev/null
+++ b/lib/patches/EnableDebuggingForPackage.ps1
@@ -0,0 +1,83 @@
+<#
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you 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.
+#>
+
+param(
+    [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+    [string] $ID <# package.appxmanifest//Identity@name #>
+)
+
+$code = @"
+using System;
+using System.Runtime.InteropServices;
+namespace PackageDebug
+{
+    public enum PACKAGE_EXECUTION_STATE
+    {
+        PES_UNKNOWN,
+        PES_RUNNING,
+        PES_SUSPENDING,
+        PES_SUSPENDED,
+        PES_TERMINATED
+    }
+
+    [ComImport, Guid("B1AEC16F-2383-4852-B0E9-8F0B1DC66B4D")]
+    public class PackageDebugSettings
+    {
+    }
+
+    [ComImport, Guid("F27C3930-8029-4AD1-94E3-3DBA417810C1"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public interface IPackageDebugSettings
+    {
+        int EnableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, [MarshalAs(UnmanagedType.LPWStr)]
string debuggerCommandLine, IntPtr environment);
+        int DisableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int Suspend([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int Resume([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int TerminateAllProcesses([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int SetTargetSessionId(int sessionId);
+        int EnumerageBackgroundTasks([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                                                      out uint taskCount, out int intPtr,
[Out] string[] array);
+        int ActivateBackgroundTask(IntPtr something);
+        int StartServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int StopServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int StartSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
uint sessionId);
+        int StopSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+        int GetPackageExecutionState([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                                            out PACKAGE_EXECUTION_STATE packageExecutionState);
+        int RegisterForPackageStateChanges([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+                               IntPtr pPackageExecutionStateChangeNotification, out uint
pdwCookie);
+        int UnregisterForPackageStateChanges(uint dwCookie);
+    }
+
+    public class DebugTool
+    {
+        public static void EnableDebug(String packageFullName)
+        {
+            // Set debug mode for App and activate installed application
+            var debugSettings = (IPackageDebugSettings)(new PackageDebugSettings());
+            debugSettings.EnableDebugging(packageFullName, null, (IntPtr)null);
+        }
+    }
+}
+"@
+
+Add-Type -TypeDefinition $code
+
+$packageFullName = $(Get-AppxPackage $ID).PackageFullName
+Write-Host "Setting debug mode for application:" $ID
+[PackageDebug.DebugTool]::EnableDebug($packageFullName) | Out-Null

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/lib/testcheck.js
----------------------------------------------------------------------
diff --git a/lib/testcheck.js b/lib/testcheck.js
new file mode 100644
index 0000000..37de8df
--- /dev/null
+++ b/lib/testcheck.js
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/* jshint node: true */
+
+"use strict";
+
+module.exports = function (sha, dbHost) {
+
+    var http = require('http'),
+        url = require('url'),
+        q = require('q');
+
+    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;
+
+        http.get(options, function (res) {
+            res.on("data", function (chunk) {
+                resultsJSON += chunk;
+            });
+            res.on('end', function () {
+                d.resolve(JSON.parse(resultsJSON));
+            });
+        }).on('error', function (e) {
+            console.log("Got error: " + e.message);
+            d.reject(e);
+        });
+
+        return d.promise;
+    };
+
+    function checkFailure(testResult) {
+        if (typeof testResult.mobilespec.failures == "undefined" || testResult.mobilespec.failures
=== 0) {
+            console.log("No failures were detected");
+            return true;
+        } else {
+            console.log("Total failures: " + testResult.mobilespec.failures);
+            console.log('Test failures were detected. Open ' + dbHost + '/_utils/document.html?mobilespec_results/'
+ testResult._id + ' for details');
+            console.log("Failing tests:");
+            testResult.mobilespec.results.forEach(function (result) {
+                if (result.status === "failed") {
+                    console.log(result.fullName);
+                }
+            });
+
+            return false;
+        }
+    };
+
+    console.log('Starting results verification for ' + sha);
+
+    return getDocumentIdBySha().then(getTestResult).then(checkFailure);
+};

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/lib/testwait.js
----------------------------------------------------------------------
diff --git a/lib/testwait.js b/lib/testwait.js
new file mode 100644
index 0000000..98fb062
--- /dev/null
+++ b/lib/testwait.js
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/* jshint node: true */
+
+var shell = require('shelljs');
+var q     = require('q');
+
+var couchdb = require('./couchdb');
+
+var mobilespec_results = null;
+
+function init(uri) {
+    couchdb.init(uri);
+    mobilespec_results = new couchdb.db("mobilespec_results");
+}
+
+function query_for_sha(sha, callback) {
+    var view = 'sha?key="' + sha + '"';
+    // get build errors from couch for each repo
+    mobilespec_results.query_view('results', view, function(error, result) {
+        if (error) {
+            console.error('query failed for mobilespec_results', error);
+            callback(true, error);
+            return;
+        }
+        callback(false, result);
+    });
+}
+
+function isTestsCompleted(sha, callback) {
+    query_for_sha(sha, function(isFailed, res) {
+        // return True if there is no error and there are test results in db for specified
sha
+        callback(!isFailed && res.rows.length > 0);
+    });
+}
+
+function waitTestsCompleted(sha, timeoutMs) {
+   var defer = q.defer();
+   var startTime = Date.now(),
+       timeoutTime = startTime + timeoutMs,
+       checkInterval = 10 * 1000; // 10 secs
+
+    var testFinishedFn = setInterval(function(){
+
+        isTestsCompleted(sha, function(isSuccess) {
+            // if tests are finished or timeout
+            if (isSuccess || Date.now() > timeoutTime) {
+                clearInterval(testFinishedFn);
+                isSuccess ? defer.resolve() : defer.reject('timed out');
+            }
+        });
+    }, checkInterval);
+    return defer.promise;
+}
+
+module.exports = {
+    init:               init,
+    waitTestsCompleted: waitTestsCompleted,
+}

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/src/build/makers/testRunner.js
----------------------------------------------------------------------
diff --git a/src/build/makers/testRunner.js b/src/build/makers/testRunner.js
deleted file mode 100644
index 237a22b..0000000
--- a/src/build/makers/testRunner.js
+++ /dev/null
@@ -1,46 +0,0 @@
-var shell        = require('shelljs'),
-    couch        = require('../../couchdb/interface'),
-    q            = require('q');
-
-function query_for_sha(sha, callback) {
-    var view = 'sha?key="' + sha + '"';
-    // get build errors from couch for each repo
-    couch.mobilespec_results.query_view('results', view, function(error, result) {
-        if (error) {
-            console.error('query failed for mobilespec_results', error);
-            callback(true, error);
-            return;
-        }
-        callback(false, result);
-    });
-}
-
-function isTestsCompleted(sha, callback) {
-    query_for_sha(sha, function(isFailed, res) {
-        // return True if there is no error and there are test results in db for specified
sha
-        callback(!isFailed && res.rows.length > 0);
-    });
-}
-
-function waitTestsCompleted(sha, timeoutMs) {
-   var defer = q.defer();
-   var startTime = Date.now(),
-       timeoutTime = startTime + timeoutMs,
-       checkInterval = 10 * 1000; // 10 secs
-
-    var testFinishedFn = setInterval(function(){
-
-        isTestsCompleted(sha, function(isSuccess) {
-            // if tests are finished or timeout
-            if (isSuccess || Date.now() > timeoutTime) {
-                clearInterval(testFinishedFn);
-                isSuccess ? defer.resolve() : defer.reject('timed out');
-            }
-        });
-    }, checkInterval);
-    return defer.promise;
-}
-
-module.exports = {
-    waitTestsCompleted:waitTestsCompleted
-}

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/src/couchdb/interface.js
----------------------------------------------------------------------
diff --git a/src/couchdb/interface.js b/src/couchdb/interface.js
deleted file mode 100644
index ca13ecb..0000000
--- a/src/couchdb/interface.js
+++ /dev/null
@@ -1,138 +0,0 @@
-
-/*
-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'),
-    follow = require('follow'),
-    config = require('../../config');
-
-var couch = config.couchdb.uri;
-
-if (couch.length < 4 || couch.indexOf('http') == -1) {
-    throw ('Pretty sure your couch config URL is wrong. Here it is wtf man: ' + couch);
-}
-
-// Generic interface + convenience functions for working with couch dbs
-function db(name) {
-    this.name = name;
-    this.db_url = couch + '/' + 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);
-                                                    else callback(true, r.statusCode);
-                                                } else {
-                                                    callback(true,"URL failed?");
-                                                }
-                                            }
-                                        });
-                                    } else callback(true, res.statusCode);
-                                }
-                            });
-                        } else callback(true, resp.statusCode);
-                    }
-                });
-            } else callback(true, response.statusCode);
-
-        });
-    },
-    follow:function(callback) {
-        if (!this.is_following) {
-            this.is_following = true;
-            follow({
-                db:this.db_url,
-                since:'now',
-                include_docs:true
-            }, function(err, change) {
-                if (!err) callback(false, change);
-                else callback(err);
-            });
-            return true;
-        } else return false;
-    }
-};
-
-module.exports = {
-    build_errors:new db('build_errors'),
-    mobilespec_results:new db('mobilespec_results'),
-    test_details:new db('test_details')
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/src/utils/EnableDebuggingForPackage.ps1
----------------------------------------------------------------------
diff --git a/src/utils/EnableDebuggingForPackage.ps1 b/src/utils/EnableDebuggingForPackage.ps1
deleted file mode 100644
index 15436bd..0000000
--- a/src/utils/EnableDebuggingForPackage.ps1
+++ /dev/null
@@ -1,83 +0,0 @@
-<#
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you 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.
-#>
-
-param(
-    [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
-    [string] $ID <# package.appxmanifest//Identity@name #>
-)
-
-$code = @"
-using System;
-using System.Runtime.InteropServices;
-namespace PackageDebug
-{
-    public enum PACKAGE_EXECUTION_STATE
-    {
-        PES_UNKNOWN,
-        PES_RUNNING,
-        PES_SUSPENDING,
-        PES_SUSPENDED,
-        PES_TERMINATED
-    }
-
-    [ComImport, Guid("B1AEC16F-2383-4852-B0E9-8F0B1DC66B4D")]
-    public class PackageDebugSettings
-    {
-    }
-
-    [ComImport, Guid("F27C3930-8029-4AD1-94E3-3DBA417810C1"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-    public interface IPackageDebugSettings
-    {
-        int EnableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, [MarshalAs(UnmanagedType.LPWStr)]
string debuggerCommandLine, IntPtr environment);
-        int DisableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int Suspend([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int Resume([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int TerminateAllProcesses([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int SetTargetSessionId(int sessionId);
-        int EnumerageBackgroundTasks([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
-                                                      out uint taskCount, out int intPtr,
[Out] string[] array);
-        int ActivateBackgroundTask(IntPtr something);
-        int StartServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int StopServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int StartSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
uint sessionId);
-        int StopSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
-        int GetPackageExecutionState([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
-                                            out PACKAGE_EXECUTION_STATE packageExecutionState);
-        int RegisterForPackageStateChanges([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
-                               IntPtr pPackageExecutionStateChangeNotification, out uint
pdwCookie);
-        int UnregisterForPackageStateChanges(uint dwCookie);
-    }
-
-    public class DebugTool
-    {
-        public static void EnableDebug(String packageFullName)
-        {
-            // Set debug mode for App and activate installed application
-            var debugSettings = (IPackageDebugSettings)(new PackageDebugSettings());
-            debugSettings.EnableDebugging(packageFullName, null, (IntPtr)null);
-        }
-    }
-}
-"@
-
-Add-Type -TypeDefinition $code
-
-$packageFullName = $(Get-AppxPackage $ID).PackageFullName
-Write-Host "Setting debug mode for application:" $ID
-[PackageDebug.DebugTool]::EnableDebug($packageFullName) | Out-Null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/0ad8700e/testchecker.js
----------------------------------------------------------------------
diff --git a/testchecker.js b/testchecker.js
deleted file mode 100644
index 22581db..0000000
--- a/testchecker.js
+++ /dev/null
@@ -1,77 +0,0 @@
-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
-        },
-            d = q.defer(),
-            resultsJSON = "",
-            failure;
-
-        http.get(options, function (res) {
-            res.on("data", function (chunk) {
-                resultsJSON += chunk;
-            });
-            res.on('end', function () {
-                d.resolve(JSON.parse(resultsJSON));
-            });
-        }).on('error', function (e) {
-            console.log("Got error: " + e.message);
-            d.reject(e)
-        });
-
-        return d.promise;
-    };
-
-    function checkFailure(testResult) {
-        if (typeof testResult.mobilespec.failures == "undefined" || testResult.mobilespec.failures
=== 0) {
-            console.log("No failures were detected");
-            return true;
-        } else {
-            console.log("Total failures: " + testResult.mobilespec.failures);
-            console.log('Test failures were detected. Open ' + dbHost + '/_utils/document.html?mobilespec_results/'
+ testResult._id + ' for details');
-            console.log("Failing tests:");
-            testResult.mobilespec.results.forEach(function (result) {
-                if (result.status === "failed") {
-                    console.log(result.fullName);
-                }
-            });
-
-            return false;
-        }
-    };
-
-    console.log('Starting results verification for ' + sha);
-
-    return getDocumentIdBySha().then(getTestResult).then(checkFailure);
-};


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


Mime
View raw message