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/06 22:18:21 UTC
[1/2] git commit: Don't add cordova-plugins/ to createproject.sh if
it doesn't exist
Repository: cordova-app-harness
Updated Branches:
refs/heads/master 97472e490 -> c29e06c34
Don't add cordova-plugins/ to createproject.sh if it doesn't exist
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/c7616fe2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/c7616fe2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/c7616fe2
Branch: refs/heads/master
Commit: c7616fe28518e6965482d3193fc18cf5d87335ac
Parents: 97472e4
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue May 6 15:37:20 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue May 6 15:37:20 2014 -0400
----------------------------------------------------------------------
createproject.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c7616fe2/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index 4379a92..77150d0 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -20,7 +20,10 @@ APP_VERSION=${APP_VERSION-0.0.1}
DIR_NAME="${1}"
AH_PATH="$(cd $(dirname $0) && pwd)"
extra_search_path="$PLUGIN_SEARCH_PATH"
-PLUGIN_SEARCH_PATH="$(dirname "$AH_PATH"):$(dirname "$AH_PATH")/cordova-plugins"
+PLUGIN_SEARCH_PATH="$(dirname "$AH_PATH")"
+if [[ -d $(dirname "$AH_PATH")/cordova-plugins ]]; then
+ PLUGIN_SEARCH_PATH="$PLUGIN_SEARCH_PATH:$(dirname "$AH_PATH")/cordova-plugins"
+fi
if [[ -n "$extra_search_path" ]]; then
PLUGIN_SEARCH_PATH="${extra_search_path}:$PLUGIN_SEARCH_PATH"
fi
@@ -52,9 +55,11 @@ echo Installing plugins.
org.chromium.zip \
org.apache.cordova.file-system-roots \
--searchpath="$PLUGIN_SEARCH_PATH"
-
# org.apache.cordova.device isn't used directly, but is convenient to test mobilespec.
+# To enable barcode scanning:
+# $CORDOVA plugin add https://github.com/wildabeast/BarcodeScanner.git # Optional
+
if [[ $? != 0 ]]; then
echo "Plugin installation failed. Probably you need to set PLUGIN_SEARCH_PATH env variable so that it contains the plugin that failed to install."
exit 1
@@ -91,8 +96,3 @@ mkdir node_modules
exit 0
npm install grunt grunt-contrib-watch || exit 1
-# $CORDOVA plugin add org.apache.cordova.device # Not used by harness, but used by mobile-spec.
-# $CORDOVA plugin add https://github.com/wildabeast/BarcodeScanner.git # Optional
-
-# cordova plugin add "https://git-wip-us.apache.org/repos/asf/cordova-plugins.git#:file-system-roots"
-
[2/2] git commit: Delete CRX logic (moving to downstream
chrome-app-harness.git)
Posted by ag...@apache.org.
Delete CRX logic (moving to downstream chrome-app-harness.git)
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/c29e06c3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/c29e06c3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/c29e06c3
Branch: refs/heads/master
Commit: c29e06c340c619064c169ae97aaf8cd17ea4147d
Parents: c7616fe
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue May 6 16:17:39 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue May 6 16:17:39 2014 -0400
----------------------------------------------------------------------
HarnessPush/README.md | 10 ---
HarnessPush/src/android/Push.java | 44 +---------
www/cdvah/crx_files/config.android.xml | 105 ------------------------
www/cdvah/crx_files/config.ios.xml | 110 -------------------------
www/cdvah/index.html | 1 -
www/cdvah/js/CrxInstaller.js | 121 ----------------------------
www/cdvah/views/add.html | 1 -
7 files changed, 3 insertions(+), 389 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/HarnessPush/README.md
----------------------------------------------------------------------
diff --git a/HarnessPush/README.md b/HarnessPush/README.md
index c780e19..7eb116f 100644
--- a/HarnessPush/README.md
+++ b/HarnessPush/README.md
@@ -24,16 +24,6 @@ Make a `POST` request on port 2424 to:
and this will cause the App Harness to return to the main menu, and fetch the app from `cordova serve`.
-### Push - `.crx` files
-
-Make a `POST` request on port 2424 to
-
- /push?type=crx&name=appname
-
-with the file passed as an HTTP form submission, with the key `file`. The following curl line will do it, for example:
-
- curl -X POST "http://192.168.1.102:2424/push?type=crx&name=myapp" -F "file=@path/to/myapp.crx"
-
### Menu - Return to the App Harness menu
Sometimes, especially on emulators, it's hard or impossible to do the three-point touch that triggers the App Harness context menu. Sending a `POST` request on port 2424 to `/menu` will return to the App Harness main menu.
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/HarnessPush/src/android/Push.java
----------------------------------------------------------------------
diff --git a/HarnessPush/src/android/Push.java b/HarnessPush/src/android/Push.java
index 1e36b6b..cf6b407 100644
--- a/HarnessPush/src/android/Push.java
+++ b/HarnessPush/src/android/Push.java
@@ -121,47 +121,7 @@ public class Push extends CordovaPlugin {
if (typeList != null) type = typeList.get(0);
if (type == null) return new Response(Response.Status.BAD_REQUEST, "text/plain", "No push type specified");
- if ("crx".equals(type)) {
- // Receive the file that came with the request, and save it under /data/data/my.app.id/push.crx.
- try {
- Map<String, String> files = new HashMap<String, String>();
- session.parseBody(files);
- if (!files.containsKey("file")) {
- return new Response(Response.Status.BAD_REQUEST, "text/plain", "You must send a file with the form key 'file'.");
- }
-
- // Copy the file out of the ephemeral cache/foo location and into somewhere permanent.
- String source = files.get("file");
- String target = source.replaceFirst("/cache/", "/crx_cache/") + ".crx";
- String dir = target.replaceFirst("/[^/]*$", "");
-
- File cacheDir = new File(dir);
- if (! (cacheDir.mkdir() || cacheDir.isDirectory()))
- return new Response(Response.Status.INTERNAL_ERROR, "text/plain", "Could not create cache directory");
-
- InputStream in = new FileInputStream(new File(source));
- OutputStream out = new FileOutputStream(new File(target));
- byte[] buf = new byte[1024];
- int len;
- while((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- in.close();
- out.close();
-
- // Now prepare the return value for the harness.
- String url = "file://" + target;
- JSONObject payload = new JSONObject();
- payload.put("name", params.get("name").get(0));
- payload.put("type", "crx");
- payload.put("url", url);
- Push.this.latestPush = payload;
- Push.this.restartAppHarness();
- return new Response(Response.Status.OK, "text/plain", "Push successful");
- } catch (Exception e) {
- Log.w(LOG_TAG, "Exception while receiving files", e);
- }
- } else if ("serve".equals(type)) {
+ if ("serve".equals(type)) {
// Create the latestPush value from the parameters.
try {
JSONObject payload = new JSONObject();
@@ -175,6 +135,8 @@ public class Push extends CordovaPlugin {
Log.w(LOG_TAG, "JSONException while building 'serve' mode push data", je);
return new Response(Response.Status.INTERNAL_ERROR, "text/plain", "Error building JSON result");
}
+ } else {
+ Log.w(LOG_TAG, "Unrecognized application type: " + type);
}
return new Response(Response.Status.BAD_REQUEST, "text/plain", "Push type '" + type + "' unknown");
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/www/cdvah/crx_files/config.android.xml
----------------------------------------------------------------------
diff --git a/www/cdvah/crx_files/config.android.xml b/www/cdvah/crx_files/config.android.xml
deleted file mode 100644
index 27f4782..0000000
--- a/www/cdvah/crx_files/config.android.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
- <name>Hello Cordova</name>
- <description>
- Default config.xml for Chrome apps launched through the app harness.
- </description>
- <author email="cordova-team@google.com" href="https://github.com/MobileChromeApps/cordova-app-harness">
- Google Mobile Chrome Apps team
- </author>
-
- <log level="DEBUG" />
-
-
- <feature name="App">
- <param name="android-package" value="org.apache.cordova.App" />
- </feature>
- <feature name="Geolocation">
- <param name="android-package" value="org.apache.cordova.GeoBroker" />
- </feature>
- <feature name="Device">
- <param name="android-package" value="org.apache.cordova.Device" />
- </feature>
- <feature name="Accelerometer">
- <param name="android-package" value="org.apache.cordova.AccelListener" />
- </feature>
- <feature name="Compass">
- <param name="android-package" value="org.apache.cordova.CompassListener" />
- </feature>
- <feature name="Media">
- <param name="android-package" value="org.apache.cordova.AudioHandler" />
- </feature>
- <feature name="Camera">
- <param name="android-package" value="org.apache.cordova.CameraLauncher" />
- </feature>
- <feature name="Contacts">
- <param name="android-package" value="org.apache.cordova.ContactManager" />
- </feature>
- <feature name="File">
- <param name="android-package" value="org.apache.cordova.FileUtils" />
- </feature>
- <feature name="NetworkStatus">
- <param name="android-package" value="org.apache.cordova.NetworkManager" />
- </feature>
- <feature name="Notification">
- <param name="android-package" value="org.apache.cordova.Notification" />
- </feature>
- <feature name="Storage">
- <param name="android-package" value="org.apache.cordova.Storage" />
- </feature>
- <feature name="FileTransfer">
- <param name="android-package" value="org.apache.cordova.FileTransfer" />
- </feature>
- <feature name="Capture">
- <param name="android-package" value="org.apache.cordova.Capture" />
- </feature>
- <feature name="Battery">
- <param name="android-package" value="org.apache.cordova.BatteryListener" />
- </feature>
- <feature name="SplashScreen">
- <param name="android-package" value="org.apache.cordova.SplashScreen" />
- </feature>
- <feature name="Echo">
- <param name="android-package" value="org.apache.cordova.Echo" />
- </feature>
- <feature name="Globalization">
- <param name="android-package" value="org.apache.cordova.Globalization" />
- </feature>
- <feature name="InAppBrowser">
- <param name="android-package" value="org.apache.cordova.InAppBrowser" />
- </feature>
- <plugins>
- </plugins>
- <feature name="ChromeBootstrap">
- <param name="android-package" value="com.google.cordova.ChromeBootstrap" />
- <param name="onload" value="true" />
- </feature>
- <feature name="ChromeExtensionURLs">
- <param name="android-package" value="com.google.cordova.ChromeExtensionURLs" />
- <param name="onload" value="true" />
- </feature>
- <feature name="ChromeStorage">
- <param name="android-package" value="com.google.cordova.ChromeStorage" />
- </feature>
- <feature name="ChromeSocket">
- <param name="android-package" value="com.google.cordova.ChromeSocket" />
- </feature>
- <feature name="Zip">
- <param name="android-package" value="org.apache.cordova.Zip" />
- </feature>
- <feature name="AppBundle">
- <param name="android-package" value="org.apache.cordova.AppBundle" />
- <param name="onload" value="true" />
- </feature>
-
- <content src="plugins/org.chromium.bootstrap/chromeapp.html" />
- <access origin="*" />
- <access origin="chrome-extension://*" />
- <access origin="cdv-app-harness://*" />
- <preference name="useBrowserHistory" value="true" />
- <preference name="exit-on-suspend" value="false" />
- <preference name="phonegap-version" value="1.9.0" />
- <preference name="orientation" value="default" />
- <preference name="target-device" value="universal" />
- <preference name="fullscreen" value="false" />
-</widget>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/www/cdvah/crx_files/config.ios.xml
----------------------------------------------------------------------
diff --git a/www/cdvah/crx_files/config.ios.xml b/www/cdvah/crx_files/config.ios.xml
deleted file mode 100644
index 422f393..0000000
--- a/www/cdvah/crx_files/config.ios.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
- <name>Hello Cordova</name>
- <description>
- Default config.xml for iOS apps in the Cordova App Harness
- </description>
- <author email="cordova-team@google.com" href="https://github.com/MobileChromeApps/cordova-app-harness">
- Google Mobile Chrome Apps Team
- </author>
- <feature name="Geolocation">
- <param name="ios-package" value="CDVLocation" />
- </feature>
- <feature name="Device">
- <param name="ios-package" value="CDVDevice" />
- </feature>
- <feature name="Accelerometer">
- <param name="ios-package" value="CDVAccelerometer" />
- </feature>
- <feature name="Compass">
- <param name="ios-package" value="CDVLocation" />
- </feature>
- <feature name="Media">
- <param name="ios-package" value="CDVSound" />
- </feature>
- <feature name="Camera">
- <param name="ios-package" value="CDVCamera" />
- </feature>
- <feature name="Contacts">
- <param name="ios-package" value="CDVContacts" />
- </feature>
- <feature name="File">
- <param name="ios-package" value="CDVFile" />
- </feature>
- <feature name="NetworkStatus">
- <param name="ios-package" value="CDVConnection" />
- </feature>
- <feature name="Notification">
- <param name="ios-package" value="CDVNotification" />
- </feature>
- <feature name="FileTransfer">
- <param name="ios-package" value="CDVFileTransfer" />
- </feature>
- <feature name="Capture">
- <param name="ios-package" value="CDVCapture" />
- </feature>
- <feature name="Battery">
- <param name="ios-package" value="CDVBattery" />
- </feature>
- <feature name="SplashScreen">
- <param name="ios-package" value="CDVSplashScreen" />
- </feature>
- <feature name="Echo">
- <param name="ios-package" value="CDVEcho" />
- </feature>
- <feature name="Globalization">
- <param name="ios-package" value="CDVGlobalization" />
- </feature>
- <feature name="InAppBrowser">
- <param name="ios-package" value="CDVInAppBrowser" />
- </feature>
- <feature name="Logger">
- <param name="ios-package" value="CDVLogger" />
- </feature>
- <feature name="LocalStorage">
- <param name="ios-package" value="CDVLocalStorage" />
- </feature>
- <plugins>
- </plugins>
- <feature name="AppBundle">
- <param name="ios-package" value="AppBundle" />
- <param name="onload" value="true" />
- </feature>
- <feature name="ChromeBootstrap">
- <param name="ios-package" value="ChromeBootstrap" />
- <param name="onload" value="true" />
- </feature>
- <feature name="ChromeExtensionURLs">
- <param name="ios-package" value="ChromeExtensionURLs" />
- <param name="onload" value="true" />
- </feature>
- <content src="plugins/org.chromium.bootstrap/chromeapp.html" />
- <feature name="ChromeSocket">
- <param name="ios-package" value="ChromeSocket" />
- </feature>
- <feature name="ChromeStorage">
- <param name="ios-package" value="ChromeStorage" />
- </feature>
- <feature name="Zip">
- <param name="ios-package" value="Zip" />
- </feature>
- <access origin="*" />
- <access origin="chrome-extension://*" />
- <access origin="cdv-app-harness://*" />
- <preference name="KeyboardDisplayRequiresUserAction" value="true" />
- <preference name="SuppressesIncrementalRendering" value="false" />
- <preference name="UIWebViewBounce" value="true" />
- <preference name="TopActivityIndicator" value="gray" />
- <preference name="EnableLocation" value="false" />
- <preference name="EnableViewportScale" value="false" />
- <preference name="AutoHideSplashScreen" value="true" />
- <preference name="ShowSplashScreenSpinner" value="true" />
- <preference name="MediaPlaybackRequiresUserAction" value="false" />
- <preference name="AllowInlineMediaPlayback" value="false" />
- <preference name="OpenAllWhitelistURLsInWebView" value="false" />
- <preference name="BackupWebStorage" value="cloud" />
- <preference name="phonegap-version" value="1.9.0" />
- <preference name="orientation" value="default" />
- <preference name="target-device" value="universal" />
- <preference name="fullscreen" value="false" />
-</widget>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/www/cdvah/index.html
----------------------------------------------------------------------
diff --git a/www/cdvah/index.html b/www/cdvah/index.html
index 0d2ada0..0294e65 100644
--- a/www/cdvah/index.html
+++ b/www/cdvah/index.html
@@ -10,7 +10,6 @@
<script type="text/javascript" src="js/ContextMenuInjectScript.js"></script>
<script type="text/javascript" src="js/Installer.js"></script>
<script type="text/javascript" src="js/ServeInstaller.js"></script>
- <script type="text/javascript" src="js/CrxInstaller.js"></script>
<script type="text/javascript" src="js/ResourcesLoader.js"></script>
<script type="text/javascript" src="js/AppsService.js"></script>
<script type="text/javascript" src="js/PluginMetadata.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/www/cdvah/js/CrxInstaller.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/CrxInstaller.js b/www/cdvah/js/CrxInstaller.js
deleted file mode 100644
index e905c4c..0000000
--- a/www/cdvah/js/CrxInstaller.js
+++ /dev/null
@@ -1,121 +0,0 @@
-(function(){
- 'use strict';
- // TODO: put these constants into an npm module.
- // TODO: Move CRX support into MobileChromeApps/harness.
- var DEFAULT_PLUGINS = [
- 'org.apache.cordova.file',
- 'org.apache.cordova.inappbrowser',
- 'org.apache.cordova.network-information',
- 'org.apache.cordova.keyboard',
- 'org.apache.cordova.statusbar',
- 'org.chromium.navigation',
- 'org.chromium.bootstrap',
- 'org.chromium.i18n',
- 'org.chromium.polyfill.CustomEvent',
- 'org.chromium.polyfill.xhr_features',
- 'org.chromium.polyfill.blob_constructor'
- ];
-
- var PLUGIN_MAP = {
- 'alarms': ['org.chromium.alarms'],
- 'fileSystem': ['org.chromium.fileSystem',
- 'org.chromium.FileChooser'],
- 'gcm': ['org.chromium.gcm'],
- 'identity': ['org.chromium.identity'],
- 'idle': ['org.chromium.idle'],
- 'notifications': ['org.chromium.notifications'],
- 'payments': ['com.google.payments'],
- 'power': ['org.chromium.power'],
- 'pushMessaging': ['org.chromium.pushMessaging'],
- 'socket': ['org.chromium.socket'],
- 'storage': ['org.chromium.storage'],
- 'syncFileSystem': ['org.chromium.syncFileSystem'],
- 'unlimitedStorage': []
- };
- function extractPluginsFromManifest(manifest) {
- var permissions = [],
- plugins = [],
- i;
- if (manifest.permissions) {
- for (i = 0; i < manifest.permissions.length; ++i) {
- if (typeof manifest.permissions[i] === 'string') {
- var matchPatternParts = /<all_urls>|([^:]+:\/\/[^\/]+)(\/.*)$/.exec(manifest.permissions[i]);
- if (!matchPatternParts) {
- permissions.push(manifest.permissions[i]);
- }
- } else {
- permissions = permissions.concat(Object.keys(manifest.permissions[i]));
- }
- }
- }
- for (i = 0; i < permissions.length; i++) {
- var pluginsForPermission = PLUGIN_MAP[permissions[i]];
- if (pluginsForPermission) {
- for (var j = 0; j < pluginsForPermission.length; ++j) {
- plugins.push(pluginsForPermission[j]);
- }
- } else {
- console.warn('Permission not supported: ' + permissions[i] + ' (skipping)');
- }
- }
- return DEFAULT_PLUGINS.concat(plugins);
- }
-
- /* global myApp */
- myApp.run(['$q', 'Installer', 'AppsService', 'ResourcesLoader', 'urlCleanup', function($q, Installer, AppsService, ResourcesLoader, urlCleanup){
-
- var platformId = cordova.require('cordova/platform').id;
-
- function CrxInstaller(url, appId) {
- Installer.call(this, url, appId);
- }
-
- CrxInstaller.prototype = Object.create(Installer.prototype);
-
- CrxInstaller.prototype.type = 'crx';
-
- CrxInstaller.prototype.getPluginMetadata = function() {
- return ResourcesLoader.readJSONFileContents(this.installPath + '/www/manifest.json')
- .then(function(manifestJson) {
- var pluginIds = extractPluginsFromManifest(manifestJson);
- var harnessPluginMetadata = cordova.require('cordova/plugin_list').metadata;
- var ret = {};
- // Make all versions match what is installed.
- for (var i = 0; i < pluginIds.length; ++i) {
- ret[pluginIds[i]] = harnessPluginMetadata[pluginIds[i]] || '0';
- }
- return ret;
- });
- };
-
- CrxInstaller.prototype.doUpdateApp = function() {
- var installPath = this.installPath;
- var platformConfig = location.pathname.replace(/\/[^\/]*$/, '/crx_files/config.' + platformId + '.xml');
- var targetConfig = installPath + '/config.xml';
-
- // The filename doesn't matter, but it needs to end with .crx for the zip plugin to unpack
- // it properly. So we always set the filename to package.crx.
- var crxFile = installPath + '/package.crx';
-
- return ResourcesLoader.downloadFromUrl(this.url, crxFile).then(function() {
- return ResourcesLoader.extractZipFile(crxFile, installPath + '/www');
- }).then(function() {
- // Copy in the config.<platform>.xml file from the harness.
- // TODO: We should be constructing this based on installed plugins.
- return ResourcesLoader.downloadFromUrl(platformConfig, targetConfig);
- });
- };
-
- AppsService.registerInstallerFactory({
- type: 'crx',
- createFromUrl: function(url, /*optional*/appId) {
- url = urlCleanup(url);
- return $q.when(new CrxInstaller(url, appId || 'New Chrome App'));
- },
-
- createFromJson: function(url, appId) {
- return new CrxInstaller(url, appId);
- }
- });
- }]);
-})();
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/c29e06c3/www/cdvah/views/add.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/add.html b/www/cdvah/views/add.html
index d894469..7bfebf0 100644
--- a/www/cdvah/views/add.html
+++ b/www/cdvah/views/add.html
@@ -8,7 +8,6 @@
<label ng-show="!editing">How to retrieve the app:<br>
<select ng-model="appData.installerType">
<option value="serve">cordova serve</option>
- <option value="crx">.crx file</option>
</select>
</label>
</div>