CB-13145: added variable replacing to framework tag
authorSteve Gill <stevengill97@gmail.com>
Fri, 18 Aug 2017 00:18:12 +0000 (17:18 -0700)
committerSteve Gill <stevengill97@gmail.com>
Wed, 30 Aug 2017 05:42:42 +0000 (22:42 -0700)
src/PluginInfo/PluginInfo.js

index 5b088ca..4cb5307 100644 (file)
@@ -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 = {