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

[2/2] git commit: Move curl examples out of README in favour of harness-push.

Move curl examples out of README in favour of harness-push.


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

Branch: refs/heads/master
Commit: d58c684e97ceab7b5ec35f541b6fe8833bfbdfb7
Parents: a2aaeda
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue May 20 20:58:10 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue May 20 20:58:10 2014 -0400

----------------------------------------------------------------------
 README.md                     | 66 +-------------------------------------
 harness-push/README.md        | 19 +++++++++++
 www/cdvah/js/HarnessServer.js | 31 ++++++++++++++++++
 3 files changed, 51 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/d58c684e/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index c3d9d40..c72e163 100644
--- a/README.md
+++ b/README.md
@@ -45,69 +45,5 @@ Using a Unix environment, run:
 
 A server runs within the app that enables remote control functionality.
 
-## Port Forwarding (Android)
+Use [harness-push/harness-push.js](harness-push/README.md) to send commands to the App Harness.
 
-If you are not on the same network, you can use adb to port forward:
-
-    adb forward tcp:2424 tcp:2424
-
-And also use Chrome DevTool's [Reverse Port Forwarding](https://developers.google.com/chrome-developer-tools/docs/remote-debugging#reverse-port-forwarding):
-
-    Map 8000 -> localhost:8000
-
-## Commands
-
-### /menu
-
-Show in-app overlay menu.
-
-    curl -v -X POST "http://$IP_ADDRESS:2424/menu"
-
-### /exec
-
-Executes a JS snippet:
-
-    curl -v -X POST "http://$IP_ADDRESS:2424/exec?code='alert(1)'"
-
-### /launch
-
-Starts the app with the given ID (or the first app if none is given).
-
-    curl -v -X POST "http://$IP_ADDRESS:2424/launch?appId=a.b.c"
-
-### /info
-
-Returns JSON of server info / app state
-
-    curl -v "http://$IP_ADDRESS:2424/info"
-
-### /assetmanifest
-
-Returns JSON of the asset manifest for the given app ID (or the first app if none is given).
-
-    curl -v "http://$IP_ADDRESS:2424/assetmanifest?appId=a.b.c"
-
-### /prepupdate
-
-Tell the interface that an update is in progress for the given app ID (or the first app if none is given).
-
-    echo '{"transferSize": 100}' | curl -v -X POST -d @- "http://$IP_ADDRESS:2424/prepupdate?app=foo"
-
-### /deletefiles
-
-Deletes a set of files within the given app ID (or the first app if none is given).
-
-    echo '{"paths":["www/index.html"]}' | curl -v -X POST -d @- "http://$IP_ADDRESS:2424/deletefiles?appId=a.b.c"
-
-### /putfile
-
-Updates a single file within the given app ID (or the first app if none is given).
-
-    cat file | curl -v -X PUT -d @- "http://$IP_ADDRESS:2424/assetmanifest?appId=a.b.c&path=www/index.html&etag=1234"
-
-### /deleteapp
-
-Deletes the app with the given ID (or the first app if none is given).
-
-    curl -v -X POST "http://$IP_ADDRESS:2424/deleteapp?appId=a.b.c"
-    curl -v -X POST "http://$IP_ADDRESS:2424/deleteapp?all=true" # Delete all apps.

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/d58c684e/harness-push/README.md
----------------------------------------------------------------------
diff --git a/harness-push/README.md b/harness-push/README.md
new file mode 100644
index 0000000..e173bce
--- /dev/null
+++ b/harness-push/README.md
@@ -0,0 +1,19 @@
+# harness-push
+
+A node module & command-line tool for controlling the Cordova App Harness.
+
+# Usage:
+
+For usage, run:
+
+   harness-push.js --help
+
+## Port Forwarding (Android)
+
+If are connected via `adb`, you can port forward via:
+
+    adb forward tcp:2424 tcp:2424
+
+## Port Forwarding (iOS)
+
+TODO: Should be possible to port forward via usbmuxd (as described [here](http://www.oodlestechnologies.com/blogs/Data-transfer-to-iOS-devices-from-PC-using-USB-cable--(using-USB-Multiplex-Daemon))

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/d58c684e/www/cdvah/js/HarnessServer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/HarnessServer.js b/www/cdvah/js/HarnessServer.js
index 8f9e45b..a596ab4 100644
--- a/www/cdvah/js/HarnessServer.js
+++ b/www/cdvah/js/HarnessServer.js
@@ -20,6 +20,37 @@
     'use strict';
     /* global myApp */
     /* global chrome */
+
+// Server actions:
+//
+// Show in-app overlay menu:
+//     curl -v -X POST "http://$IP_ADDRESS:2424/menu"
+//
+// Execute a JS snippet:
+//     curl -v -X POST "http://$IP_ADDRESS:2424/exec?code='alert(1)'"
+//
+// Starts the app with the given ID (or the first app if none is given):
+//     curl -v -X POST "http://$IP_ADDRESS:2424/launch?appId=a.b.c"
+//
+// Returns JSON of server info / app state:
+//     curl -v "http://$IP_ADDRESS:2424/info"
+//
+// Returns JSON of the asset manifest for the given app ID (or the first app if none is given):
+//     curl -v "http://$IP_ADDRESS:2424/assetmanifest?appId=a.b.c"
+//
+// Tell the interface that an update is in progress for the given app ID (or the first app if none is given):
+//     echo '{"transferSize": 100}' | curl -v -X POST -d @- "http://$IP_ADDRESS:2424/prepupdate?app=foo"
+//
+// Deletes a set of files within the given app ID (or the first app if none is given):
+//     echo '{"paths":["www/index.html"]}' | curl -v -X POST -d @- "http://$IP_ADDRESS:2424/deletefiles?appId=a.b.c"
+//
+// Updates a single file within the given app ID (or the first app if none is given):
+//     cat file | curl -v -X PUT -d @- "http://$IP_ADDRESS:2424/assetmanifest?appId=a.b.c&path=www/index.html&etag=1234"
+//
+// Deletes the app with the given ID (or the first app if none is given):
+//     curl -v -X POST "http://$IP_ADDRESS:2424/deleteapp?appId=a.b.c"
+//     curl -v -X POST "http://$IP_ADDRESS:2424/deleteapp?all=true" # Delete all apps.
+
     myApp.factory('HarnessServer', ['$q', 'HttpServer', 'ResourcesLoader', 'AppHarnessUI', 'AppsService', 'notifier', function($q, HttpServer, ResourcesLoader, AppHarnessUI, AppsService, notifier) {
 
         var server = null;