cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject android commit: CB-10138 Adds missing plugin metadata to plugin_list module. This closes #254
Date Thu, 28 Jan 2016 09:46:11 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 7669378c6 -> e08d0671a


CB-10138 Adds missing plugin metadata to plugin_list module. This closes #254


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

Branch: refs/heads/master
Commit: e08d0671ab7a7fc9dbaffd937f6bb5e7a3640c28
Parents: 7669378
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Wed Jan 27 15:39:11 2016 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Thu Jan 28 12:45:19 2016 +0300

----------------------------------------------------------------------
 bin/templates/cordova/Api.js | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e08d0671/bin/templates/cordova/Api.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index 7b7731f..9a8938c 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -431,6 +431,11 @@ Api.prototype._addModulesInfo = function(plugin, targetDir) {
     });
 
     this._platformJson.root.modules = installedModules.concat(modulesToInstall);
+    if (!this._platformJson.root.plugin_metadata) {
+        this._platformJson.root.plugin_metadata = {};
+    }
+    this._platformJson.root.plugin_metadata[plugin.id] = plugin.version;
+
     this._writePluginModules(targetDir);
     this._platformJson.save();
 };
@@ -457,6 +462,10 @@ Api.prototype._removeModulesInfo = function(plugin, targetDir) {
     });
 
     this._platformJson.root.modules = updatedModules;
+    if (this._platformJson.root.plugin_metadata) {
+        delete this._platformJson.root.plugin_metadata[plugin.id];
+    }
+
     this._writePluginModules(targetDir);
     this._platformJson.save();
 };
@@ -470,20 +479,13 @@ Api.prototype._removeModulesInfo = function(plugin, targetDir) {
  *   directories.
  */
 Api.prototype._writePluginModules = function (targetDir) {
-    var self = this;
     // Write out moduleObjects as JSON wrapped in a cordova module to cordova_plugins.js
     var final_contents = 'cordova.define(\'cordova/plugin_list\', function(require, exports,
module) {\n';
     final_contents += 'module.exports = ' + JSON.stringify(this._platformJson.root.modules,
null, '    ') + ';\n';
     final_contents += 'module.exports.metadata = \n';
     final_contents += '// TOP OF METADATA\n';
 
-    var pluginMetadata = Object.keys(this._platformJson.root.installed_plugins)
-    .reduce(function (metadata, plugin) {
-        metadata[plugin] = self._platformJson.root.installed_plugins[plugin].version;
-        return metadata;
-    }, {});
-
-    final_contents += JSON.stringify(pluginMetadata, null, 4) + '\n';
+    final_contents += JSON.stringify(this._platformJson.root.plugin_metadata, null, 4) +
';\n';
     final_contents += '// BOTTOM OF METADATA\n';
     final_contents += '});'; // Close cordova.define.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message