[GitHub] cordova-lib pull request #590: CB-13145: Create playservices version prefere...

2017-08-31 Thread audreyso
Github user audreyso closed the pull request at:

https://github.com/apache/cordova-lib/pull/590


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #590: CB-13145: Create playservices version prefere...

2017-08-28 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/590#discussion_r135664127
  
--- Diff: src/cordova/plugin/util.js ---
@@ -35,3 +40,39 @@ function saveToConfigXmlOn (config_json, options) {
 var autosave = config_json.auto_save_plugins || false;
 return autosave || options.save;
 }
+
+/*
+ * Merges cli and config.xml variables.
+ *
+ * @param   {object}pluginInfo
+ * @param   {object}config.xml
+ * @param   {object}options
+ *
+ * @return  {object}object containing the new merged variables
+ */
+
+function mergeVariables (pluginInfo, cfg, opts) {
+// Validate top-level required variables
+var pluginVariables = pluginInfo.getPreferences();
+opts.cli_variables = opts.cli_variables || {};
+var pluginEntry = cfg.getPlugin(pluginInfo.id);
+// Get variables from config.xml
+var configVariables = pluginEntry ? pluginEntry.variables : {};
+// Add config variable if it's missing in cli_variables
+Object.keys(configVariables).forEach(function (variable) {
+opts.cli_variables[variable] = opts.cli_variables[variable] || 
configVariables[variable];
+});
+var missingVariables = Object.keys(pluginVariables)
+.filter(function (variableName) {
+// discard variables with default value
+return !(pluginVariables[variableName] || 
opts.cli_variables[variableName]);
+});
+
+if (missingVariables.length) {
+events.emit('verbose', 'Removing ' + pluginInfo.dir + ' because 
mandatory plugin variables were missing.');
+shell.rm('-rf', pluginInfo.dir);
+var msg = 'Variable(s) missing (use: --variable ' + 
missingVariables.join('=value --variable ') + '=value).';
+return Q.reject(new CordovaError(msg));
--- End diff --

get rid of Q dep


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #590: CB-13145: Create playservices version prefere...

2017-08-28 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/590#discussion_r135664112
  
--- Diff: src/cordova/plugin/util.js ---
@@ -35,3 +40,39 @@ function saveToConfigXmlOn (config_json, options) {
 var autosave = config_json.auto_save_plugins || false;
 return autosave || options.save;
 }
+
+/*
+ * Merges cli and config.xml variables.
+ *
+ * @param   {object}pluginInfo
+ * @param   {object}config.xml
+ * @param   {object}options
+ *
+ * @return  {object}object containing the new merged variables
+ */
+
+function mergeVariables (pluginInfo, cfg, opts) {
+// Validate top-level required variables
+var pluginVariables = pluginInfo.getPreferences();
+opts.cli_variables = opts.cli_variables || {};
+var pluginEntry = cfg.getPlugin(pluginInfo.id);
+// Get variables from config.xml
+var configVariables = pluginEntry ? pluginEntry.variables : {};
+// Add config variable if it's missing in cli_variables
+Object.keys(configVariables).forEach(function (variable) {
+opts.cli_variables[variable] = opts.cli_variables[variable] || 
configVariables[variable];
+});
+var missingVariables = Object.keys(pluginVariables)
+.filter(function (variableName) {
+// discard variables with default value
+return !(pluginVariables[variableName] || 
opts.cli_variables[variableName]);
+});
+
+if (missingVariables.length) {
+events.emit('verbose', 'Removing ' + pluginInfo.dir + ' because 
mandatory plugin variables were missing.');
+shell.rm('-rf', pluginInfo.dir);
+var msg = 'Variable(s) missing (use: --variable ' + 
missingVariables.join('=value --variable ') + '=value).';
+return Q.reject(new CordovaError(msg));
--- End diff --

Change this to `throw new CordovaError(msg)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #590: CB-13145: Create playservices version prefere...

2017-08-24 Thread audreyso
GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/590

CB-13145: Create playservices version preference in config.xml  

Still need to add in tests


### Platforms affected


### What does this PR do?
CB-13145: Create playservices version preference in config.xml

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-13145-Steve

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/590.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #590


commit 315e6a80b95a425a07a0a32e53e24ce10e1ef89c
Author: Steve Gill 
Date:   2017-08-23T04:39:24Z

CB-13145: pass full options to plugman uninstall

commit faa48e255fc02dd42f2bcc7eaa43f816967305cb
Author: Audrey So 
Date:   2017-08-23T20:27:45Z

CB-13145 : added variable-merge.js to deal with plugin.xml variables for 
uninstall




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org