cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [26/30] git commit: Readme update. String to Regex conversion bugfix.
Date Thu, 23 May 2013 20:03:49 GMT
Readme update. String to Regex conversion bugfix.

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/7d48f4a9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/7d48f4a9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/7d48f4a9

Branch: refs/heads/master
Commit: 7d48f4a97a301b4754c1896e39e2009423b6eecd
Parents: 1105393
Author: Shravan Narayan <shravanrn@google.com>
Authored: Thu May 16 22:58:23 2013 -0400
Committer: Shravan Narayan <shravanrn@google.com>
Committed: Thu May 16 22:58:23 2013 -0400

----------------------------------------------------------------------
 README.md                      |   13 +++++++++----
 www/cdvah_js/AppBundleAlias.js |   35 ++++++++++++++++++++++++-----------
 2 files changed, 33 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7d48f4a9/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 8e87aff..5610c12 100644
--- a/README.md
+++ b/README.md
@@ -86,11 +86,16 @@ An App harness for Cordova that can download and run Cordova apps as well
as Chr
 
 ###Test by using cordova serve
 *   Go to cordova project of the app you want to test in a terminal and run.
-        cordova prepare
+
         cordova serve <platform>
-*   If you want to test the app in an actual device, find the network address of your computer
by running
-        ifconfig
-*   If you are running this on a simulator, you can use `http://localhost` as your address
+
+*   Open a new terminal to the same location and run
+
+        cordova prepare
+
+*   If you want to test the app in an actual device, find the network address of your computer
by running ifconfig
+    If you are running this on the iOS simulator, you can use "http://localhost" as your
address
+    If you are running this on the android simulator, you can use "http://10.0.2.2" as your
address
 *   Click add new app
 *   Choose the option "Enter the URL to the server hosting the app"
 *   Give a name and the url as follows. Let's assume the network address discovered above
is `a.b.c.d`

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7d48f4a9/www/cdvah_js/AppBundleAlias.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/AppBundleAlias.js b/www/cdvah_js/AppBundleAlias.js
index 05fdd4d..5e1bbb8 100644
--- a/www/cdvah_js/AppBundleAlias.js
+++ b/www/cdvah_js/AppBundleAlias.js
@@ -24,18 +24,31 @@
             }
         }
 
+        function replaceCharWithString(string, searchChar, replaceString){
+            var ret = "";
+            for(var i = 0; i < string.length; i++){
+                if(string[i] === searchChar){
+                    ret += replaceString;
+                } else {
+                    ret += string[i];
+                }
+            }
+            return ret;
+        }
+
         function getRegex(string){
-            return string.replace("[", "\\[")
-            .replace("\\", "\\\\")
-            .replace("^", "\\^")
-            .replace("$", "\\$")
-            .replace(".", "\\.")
-            .replace("|", "\\|")
-            .replace("?", "\\?")
-            .replace("*", "\\*")
-            .replace("+", "\\+")
-            .replace("(", "\\(")
-            .replace(")", "\\)");
+            string = replaceCharWithString(string, "\\", "\\\\");
+            string = replaceCharWithString(string, "[", "\\[");
+            string = replaceCharWithString(string, "^", "\\^");
+            string = replaceCharWithString(string, "$", "\\$");
+            string = replaceCharWithString(string, ".", "\\.");
+            string = replaceCharWithString(string, "|", "\\|");
+            string = replaceCharWithString(string, "?", "\\?");
+            string = replaceCharWithString(string, "*", "\\*");
+            string = replaceCharWithString(string, "+", "\\+");
+            string = replaceCharWithString(string, "(", "\\(");
+            string = replaceCharWithString(string, ")", "\\)");
+            return string;
         }
 
         AppsService.addPreLaunchHook(function(appEntry, appInstallLocation, wwwLocation)
{


Mime
View raw message