You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2014/01/06 21:25:50 UTC
[10/13] git commit: Plugins now loading and saving correctly.
Plugins now loading and saving correctly.
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/82f00ef0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/82f00ef0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/82f00ef0
Branch: refs/heads/master
Commit: 82f00ef0705587e52de9a276bb14f526616be799
Parents: 3188903
Author: Braden Shepherdson <br...@gmail.com>
Authored: Mon Dec 2 11:42:18 2013 -0800
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Mon Jan 6 15:24:12 2014 -0500
----------------------------------------------------------------------
www/cdvah/index.html | 1 +
www/cdvah/js/AppsService.js | 6 +++---
www/cdvah/js/Installer.js | 4 ++--
www/cdvah/js/PluginMetadata.js | 10 +++++++++-
www/cdvah/views/list.html | 1 +
5 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/82f00ef0/www/cdvah/index.html
----------------------------------------------------------------------
diff --git a/www/cdvah/index.html b/www/cdvah/index.html
index 5a816b2..1570336 100644
--- a/www/cdvah/index.html
+++ b/www/cdvah/index.html
@@ -12,6 +12,7 @@
<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>
<script type="text/javascript" src="js/UrlRemap.js"></script>
<script type="text/javascript" src="js/ListCtrl.js"></script>
<script type="text/javascript" src="js/AddCtrl.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/82f00ef0/www/cdvah/js/AppsService.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/AppsService.js b/www/cdvah/js/AppsService.js
index d86af42..c316f18 100644
--- a/www/cdvah/js/AppsService.js
+++ b/www/cdvah/js/AppsService.js
@@ -1,7 +1,7 @@
(function() {
'use strict';
/* global myApp */
- myApp.factory('AppsService', ['$q', 'ResourcesLoader', 'INSTALL_DIRECTORY', 'APPS_JSON', 'pluginMetadata', function($q, ResourcesLoader, INSTALL_DIRECTORY, APPS_JSON, pluginMetadata) {
+ myApp.factory('AppsService', ['$q', 'ResourcesLoader', 'INSTALL_DIRECTORY', 'APPS_JSON', 'PluginMetadata', function($q, ResourcesLoader, INSTALL_DIRECTORY, APPS_JSON, PluginMetadata) {
// Map of type -> installer.
var _installerFactories = {};
@@ -17,7 +17,7 @@
var installer = factory.createFromJson(entry.appUrl, entry.appId);
installer.lastUpdated = entry.lastUpdated && new Date(entry.lastUpdated);
installer.installPath = entry.installPath;
- installer.plugins = pluginMetadata.process(entry.plugins);
+ installer.plugins = PluginMetadata.process(entry.plugins);
ret.push(installer);
}
return ret;
@@ -58,7 +58,7 @@
'appUrl' : installer.url,
'lastUpdated': installer.lastUpdated && +installer.lastUpdated,
'installPath': installer.installPath,
- 'plugins': installer.plugins
+ 'plugins': installer.plugins.raw
});
}
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/82f00ef0/www/cdvah/js/Installer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/Installer.js b/www/cdvah/js/Installer.js
index 18d1093..8a58d1c 100644
--- a/www/cdvah/js/Installer.js
+++ b/www/cdvah/js/Installer.js
@@ -1,7 +1,7 @@
(function(){
'use strict';
/* global myApp */
- myApp.factory('Installer', ['$q', 'UrlRemap', 'ResourcesLoader', 'ContextMenuInjectScript', function($q, UrlRemap, ResourcesLoader, ContextMenuInjectScript) {
+ myApp.factory('Installer', ['$q', 'UrlRemap', 'ResourcesLoader', 'ContextMenuInjectScript', 'PluginMetadata', function($q, UrlRemap, ResourcesLoader, ContextMenuInjectScript, PluginMetadata) {
function getAppStartPageFromConfig(configFile) {
return ResourcesLoader.readFileContents(configFile)
@@ -76,7 +76,7 @@
}, null, function(status) {
self.updatingStatus = Math.round(status * 100);
}).then(function(metadata) {
- self.plugins = metadata;
+ self.plugins = PluginMetadata.process(metadata);
});
};
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/82f00ef0/www/cdvah/js/PluginMetadata.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/PluginMetadata.js b/www/cdvah/js/PluginMetadata.js
index 544c49a..8a2bed4 100644
--- a/www/cdvah/js/PluginMetadata.js
+++ b/www/cdvah/js/PluginMetadata.js
@@ -1,7 +1,7 @@
(function() {
'use strict';
/* global myApp */
- myApp.factory('pluginMetadata', function() {
+ myApp.factory('PluginMetadata', function() {
var harnessPlugins = cordova.require('cordova/plugin_list').metadata;
// Returns -1, (a > b), 0 (a = b), or 1 (a < b).
@@ -23,12 +23,18 @@
// Returns an object with plugin matching data.
process: function(childPlugins) {
var results = {
+ raw: childPlugins,
matched: [],
missing: [],
newer: [], // Those dependencies which are newer in the child than the harness.
older: [] // And those which are older in the child than the harness.
};
+ if (!childPlugins) {
+ results.raw = {};
+ return results;
+ }
+
Object.keys(childPlugins).forEach(function(plugin) {
if (!harnessPlugins[plugin]) {
results.missing.push({ id: plugin, version: childPlugins[plugin] });
@@ -46,6 +52,8 @@
}
}
});
+
+ return results;
}
};
});
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/82f00ef0/www/cdvah/views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/list.html b/www/cdvah/views/list.html
index 5be2368..6f8f273 100644
--- a/www/cdvah/views/list.html
+++ b/www/cdvah/views/list.html
@@ -6,6 +6,7 @@
<div>{{app.url}}</div>
<div ng-show="app.updatingStatus === null">Last updated: {{app.lastUpdated || 'never'}}</div>
<div ng-show="app.updatingStatus !== null">Update in progress: {{app.updatingStatus}}%</div>
+ <div>Plugins: {{ app.plugins.missing.length }} missing, {{ app.plugins.newer.length + app.plugins.older.length }} differ</div>
<div>{{ app.plugins }}</div>
<button ng-click="launchApp(app)">Launch</button>
<button ng-click="updateApp(app)">Update</button>