You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/08/30 05:44:55 UTC

[2/4] cordova-common git commit: CB-13145: added variable replacing to framework tag

CB-13145: added variable replacing to framework tag


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

Branch: refs/heads/master
Commit: 5d678586774e5abf707ecfd6cc1a64a5e10e21d0
Parents: 93fe7ea
Author: Steve Gill <st...@gmail.com>
Authored: Thu Aug 17 17:18:12 2017 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Aug 29 22:42:42 2017 -0700

----------------------------------------------------------------------
 src/PluginInfo/PluginInfo.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-common/blob/5d678586/src/PluginInfo/PluginInfo.js
----------------------------------------------------------------------
diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js
index 5b088ca..4cb5307 100644
--- a/src/PluginInfo/PluginInfo.js
+++ b/src/PluginInfo/PluginInfo.js
@@ -310,9 +310,8 @@ function PluginInfo (dirname) {
     self.getFrameworks = function (platform, options) {
         return _getTags(self._et, 'framework', platform, function (el) {
             var src = el.attrib.src;
-            var vars = {};
             if (options) {
-                vars = options.cli_variables;
+                var vars = options.cli_variables || {};
                 if (Object.keys(vars).length === 0) {
                     // get variable defaults from plugin.xml for removal
                     vars = self.getPreferences(platform);
@@ -322,8 +321,10 @@ function PluginInfo (dirname) {
                 // Iterate over plugin variables.
                 // Replace them in framework src if they exist
                 Object.keys(vars).forEach(function (name) {
-                    regExp = new RegExp('\\$' + name, 'g');
-                    src = src.replace(regExp, vars[name]);
+                    if (vars[name]) {
+                        regExp = new RegExp('\\$' + name, 'g');
+                        src = src.replace(regExp, vars[name]);
+                    }
                 });
             }
             var ret = {


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