cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [21/30] git commit: Small UI & code fixes.Test cordova serve apps' config.xml during install
Date Thu, 23 May 2013 20:03:44 GMT
Small UI & code fixes.Test cordova serve apps' config.xml during install


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

Branch: refs/heads/master
Commit: 633074b6234e3fe8c001651c98486c763ad0bba9
Parents: aee835b
Author: Shravan Narayan <shravanrn@google.com>
Authored: Thu May 16 13:56:19 2013 -0400
Committer: Braden Shepherdson <braden@google.com>
Committed: Thu May 16 15:11:42 2013 -0400

----------------------------------------------------------------------
 README.md                       |   52 +++++++++++++++++++++++++++++----
 www/cdvah_js/AddCtrl.js         |   17 ++++++----
 www/cdvah_js/AppBundleAlias.js  |    1 -
 www/cdvah_js/AppsService.js     |   22 +++++++++++++-
 www/cdvah_js/ListCtrl.js        |    6 ++--
 www/cdvah_js/ResourcesLoader.js |    2 +-
 www/cdvah_views/add.html        |    4 +-
 www/cdvah_views/list.html       |    2 +-
 8 files changed, 83 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 9e4c631..986bb1a 100644
--- a/README.md
+++ b/README.md
@@ -6,10 +6,9 @@ An App harness for Cordova that can download and run Cordova apps as well
as Chr
 ##Setting up environment
 
 *   Clone the the cordova-app-harness, cordova-android, cordova-ios, cordova-js, plugman,
cordova-cli, zip(https://github.com/MobileChromeApps/zip) and AppBundle(https://github.com/MobileChromeApps/AppBundle)
repos into folders of the same name in a common directory - eg 'Repo'.
-*   Use the future branch of plugman and cordova-cli
+*   Use the future branch for cordova-cli and master everywhere else
 *   Link these plugman and cordova-cli of this branch as the globally symlinked plugman and
cordova-cli commands. (You may want to see 'npm link')
 *   Build the cordova-js repo and grab the cordova.android.js and cordova.ios.js
-*   Note this project uses a slightly modified version of cordova.android.js and cordova.ios.js
 *   Replace the cordova-cli/lib/cordova-android/framework/assets/js/cordova.android.js and
the cordova-cli/lib/cordova-ios/CordovaLib/cordova.ios.js files with the ones above
 *   Build the cordova-android repository and generate new cordova.jar
 *   Run the following commands
@@ -27,18 +26,57 @@ An App harness for Cordova that can download and run Cordova apps as well
as Chr
 *   Replace the contents of CordovaAppHarness/platforms/ios/CordovaLib with /Repo/cordova-ios/CordovaLib
 *   Go to eclipse and got to new, other, android, android project from existing code. Navigate
to CordovaAppHarness/platforms/android and then add the project
 *   Double click the  .xcodeproj file in CordovaAppHarnessNew/platforms/ios/
+*   Ensure the config.xml for android (Project Folder In IDE/res/xml/config.xml) and ios
(Project Folder In IDE/config.xml) have the content tag's src set to
+
+        <content src="app-bundle:///cdvah_index.html" />
+
+*   Ensure the config.xml for ios has the tag
+
+        <access origin="app-bundle://*" />
+
 *   You can now build the app harness from the ides or with cordova compile
 
-##Using the app
+##Features
+*   Install and test multiple applications.
+*   Run apps locally or run them directly from cordova serve.
+*   Edit and Refresh workflow with cordova serve.
+*   In App context menu to switch between apps.
+*   Firebug Lite and Weinre support for debugging.
+*   Support for bundle paths such as "file:///android_asset/www" - These point to the tested
application's bundle and not the app harness' bundle. (In development)
 
-*   Run the packapp script and point it to a cordova project. This will package the app into
a cdvh file. (Note: it is expected that you add all relevant platforms. For example, if you
want to test on the iphone, you need to have added the ios platform to the project)
+##Install an app in the harness
+
+*   Install the app in one of the two ways below
+
+###Test by installing the app on the phone through app harness
+*   Run the packapp script and point it to a cordova project of the app you want to test.
This will package the app into a cdvh file. (Note: it is expected that you have added all
relevant platforms. For example, if you want to test on the iphone, you need to have added
the ios platform to the project)
         Repo/cordova-app-harness/packapp -p ./TestApp TestApp.cdvh
 *   Upload the the cdvh onto any hosting site.
 *   Run the app harness
 *   Click add new app
-*   Give a name and the url to the zip.
+*   Give a name and the url to the cdvh file.
+
+        Name: App1
+        URL to file: http://www.somesite.com/myapp.cdvh
+
+###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
+*   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
+
+        Name: App1
+        URL to server: http://a.b.c.d:8000/config.xml
+
 *   Go back to the main screen after you see the prompt "successfully installed"
-*   Click launch on the newly installed app
+
+##Running an app in the harness
+*   Click launch on the installed app
 *   See if the app looks as expected
 *   Use the 3 finger tap to access the app menu while testing your app
-*   Press Back to Main Menu to return to the main screen
+*   The context menu that pops up, will allow you to return to the main screen, restart or
update the app, open a firebug console in the device, setup remote debugging using weinre
etc.

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_js/AddCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/AddCtrl.js b/www/cdvah_js/AddCtrl.js
index 8827b1d..4fc52a4 100644
--- a/www/cdvah_js/AddCtrl.js
+++ b/www/cdvah_js/AddCtrl.js
@@ -26,13 +26,16 @@
                 serviceCall = AppsService.addAppFromServe($scope.appData.appName, $scope.appData.appSourceServe);
             }
 
-            serviceCall && serviceCall.then(function() {
-                alert("Successfully installed");
-            }, function(error) {
-                console.error(error);
-                alert("Unable to add application because: \n" + error);
-            });
-
+            if(serviceCall){
+                serviceCall.then(function() {
+                    alert("Successfully installed");
+                }, function(error) {
+                    console.error(error);
+                    alert("Unable to add application because: \n" + error);
+                });
+            } else {
+                alert("Add application error: Unrecognized application source - " + $scope.appData.appSource);
+            }
         };
     }]);
 

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_js/AppBundleAlias.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/AppBundleAlias.js b/www/cdvah_js/AppBundleAlias.js
index 7c244a6..05fdd4d 100644
--- a/www/cdvah_js/AppBundleAlias.js
+++ b/www/cdvah_js/AppBundleAlias.js
@@ -39,7 +39,6 @@
         }
 
         AppsService.addPreLaunchHook(function(appEntry, appInstallLocation, wwwLocation)
{
-            console.log("Adding aliases for " + appEntry.Name);
             wwwLocation += (wwwLocation.charAt(wwwLocation.length - 1) === "/")? "" : "/";
             appInstallLocation += (appInstallLocation.charAt(appInstallLocation.length -
1) === "/")? "" : "/";
             //Make any direct references to the bundle paths such as file:///android_asset
point to the installed location without redirecting

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_js/AppsService.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/AppsService.js b/www/cdvah_js/AppsService.js
index f7def39..0e59e3b 100644
--- a/www/cdvah_js/AppsService.js
+++ b/www/cdvah_js/AppsService.js
@@ -277,7 +277,27 @@
             },
 
             addAppFromServe : function(appName, appSourceServe) {
-                return isUniqueApp(appName)
+                return ResourcesLoader.readFileContents(appSourceServe)
+                .then(function(contents){
+                    if(!contents){
+                        throw new Error("The contents of config.xml at " + appSourceServe
+ " could not be read.");
+                    }
+                })
+                .then(null, function(error){
+                    // Code reaches here either because the get request to config.xml fails
or config.xml is empty
+                    var continueInstall = confirm("The contents of config.xml at " + appSourceServe
+ " could not be read.\n" +
+                    "Have you run cordova serve?\n\n" +
+                    "Press OK to continue the install process. Note that the config.xml should
be visible before you start the app.");
+                    if(!continueInstall){
+                        throw error;
+                    }
+                })
+                .then(function(){
+                    return isUniqueApp(appName);
+                })
+                .then(function(){
+                    return ResourcesLoader.deleteDirectory(INSTALL_DIRECTORY + appName);
+                })
                 .then(function(){
                     return addNewAppFromServe(appName, appSourceServe);
                 });

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/ListCtrl.js b/www/cdvah_js/ListCtrl.js
index 326f394..938b5b2 100644
--- a/www/cdvah_js/ListCtrl.js
+++ b/www/cdvah_js/ListCtrl.js
@@ -32,7 +32,7 @@
                     return AppsService.getLastRunApp()
                     .then(AppsService.launchApp, function(e){
                         e = e || {};
-                        console.error("Error launching last run app: " + e.message);
+                        console.error("Error launching last run app: " + e);
                         alert("Error launching last run app. Please try again.");
                     });
                 }
@@ -49,7 +49,7 @@
                         return AppsService.launchApp(app);
                     }, function(e){
                         e = e || {};
-                        console.error("Error updating last run app: " + e.message);
+                        console.error("Error updating last run app: " + e);
                         alert("Error updating last run app. Please try again.");
                     });
                 }
@@ -78,7 +78,7 @@
                 }
             }, function(error){
                 var str = "There was an error retrieving the apps list";
-                console.error(str + JSON.stringify(error));
+                console.error(str + ": " + error);
                 alert(str);
             });
         };

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_js/ResourcesLoader.js
----------------------------------------------------------------------
diff --git a/www/cdvah_js/ResourcesLoader.js b/www/cdvah_js/ResourcesLoader.js
index 1f84681..e6c5ae8 100644
--- a/www/cdvah_js/ResourcesLoader.js
+++ b/www/cdvah_js/ResourcesLoader.js
@@ -229,7 +229,7 @@
                     if(xhr.status === 200) {
                         deferred.resolve(xhr);
                     } else {
-                        deferred.reject("XHR return status: " + xhr.statusText);
+                        deferred.reject("XHR return status: " + xhr.status + " for url: "
+ url);
                     }
                 }
             };

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_views/add.html
----------------------------------------------------------------------
diff --git a/www/cdvah_views/add.html b/www/cdvah_views/add.html
index 77778e6..edb4dfb 100644
--- a/www/cdvah_views/add.html
+++ b/www/cdvah_views/add.html
@@ -8,12 +8,12 @@
 
     <input type="radio" ng-model="appData.appSource" name="appSource" value="pattern"
ng-checked="appData.appSource=='pattern'" />
         <label for="inputAppPattern">Enter the URL to a file</label><br />
-        <input id="inputAppPattern" type="text" name="appSourcePattern" ng-model="appData.appSourcePattern"
ng-disabled="appData.appSource!='pattern'" ng-required="appSource=='pattern'" />
+        <input id="inputAppPattern" type="text" name="appSourcePattern" ng-model="appData.appSourcePattern"
ng-disabled="appData.appSource!='pattern'" ng-required="appData.appSource=='pattern'" autocorrect="off"
autocapitalize="off" />
         <span ng-show="addForm.appSourcePattern.$error.required">Required</span>
         <br />
     <input type="radio" ng-model="appData.appSource" name="appSource" value="serve" ng-checked="appData.appSource=='serve'"
/>
         <label for="inputAppServe">Enter the URL to the server hosting the app</label><br
/>
-        <input id="inputAppServe" type="text" name="appSourceServe" ng-model="appData.appSourceServe"
ng-disabled="appData.appSource!='serve'" ng-pattern="/.*\/config.xml(\?.*|#.*)?$/" ng-required="appSource=='serve'"
/>
+        <input id="inputAppServe" type="text" name="appSourceServe" ng-model="appData.appSourceServe"
ng-disabled="appData.appSource!='serve'" ng-pattern="/.*\/config.xml(\?.*|#.*)?$/" ng-required="appData.appSource=='serve'"
autocorrect="off" autocapitalize="off" />
         <span ng-show="addForm.appSourceServe.$error.required">Required</span>
         <span ng-show="addForm.appSourceServe.$error.pattern">Url must point to a config.xml
file</span>
         <br />

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/633074b6/www/cdvah_views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah_views/list.html b/www/cdvah_views/list.html
index b73f196..b563845 100644
--- a/www/cdvah_views/list.html
+++ b/www/cdvah_views/list.html
@@ -3,7 +3,7 @@
         <p>{{app.Name}}</p>
         <p>Installed on: {{app.Installed}}</p>
         <button ng-click="launchApp(app.Name)">Launch</button>
-		<button ng-click="updateApp(app.Name)">Update</button>
+		<button ng-click="updateApp(app.Name)" ng-disabled="app.Source==='serve'">Update</button>
 		<button ng-click="removeApp(app.Name)">Remove</button>
 	</li>
 </ul>


Mime
View raw message