This is an automated email from the ASF dual-hosted git repository.
jcesarmobile pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/master by this push:
new bc9acac fix: replace variables in Podfile (#754)
bc9acac is described below
commit bc9acac461b43362b68934d0b0370c198d364940
Author: jcesarmobile <[email protected]>
AuthorDate: Fri Dec 20 09:51:04 2019 +0100
fix: replace variables in Podfile (#754)
---
bin/templates/scripts/cordova/Api.js | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/bin/templates/scripts/cordova/Api.js
b/bin/templates/scripts/cordova/Api.js
index 67e3baf..6b7a6fc 100644
--- a/bin/templates/scripts/cordova/Api.js
+++ b/bin/templates/scripts/cordova/Api.js
@@ -44,6 +44,10 @@ function setupEvents (externalEventEmitter) {
}
}
+function getVariableSpec (spec, options) {
+ return spec.includes('$') ? options.cli_variables[spec.replace('$', '')] :
spec;
+}
+
/**
* Creates a new PlatformApi instance.
*
@@ -268,7 +272,7 @@ Api.prototype.addPlugin = function (plugin, installOptions)
{
const frameworkPods = frameworkTags.filter(function (obj) {
return (obj.type === 'podspec');
});
- return self.addPodSpecs(plugin, podSpecs, frameworkPods);
+ return self.addPodSpecs(plugin, podSpecs, frameworkPods,
installOptions);
}
})
// CB-11022 return non-falsy value to indicate
@@ -322,7 +326,7 @@ Api.prototype.removePlugin = function (plugin,
uninstallOptions) {
const frameworkPods = frameworkTags.filter(function (obj) {
return (obj.type === 'podspec');
});
- return self.removePodSpecs(plugin, podSpecs, frameworkPods);
+ return self.removePodSpecs(plugin, podSpecs, frameworkPods,
uninstallOptions);
}
})
// CB-11022 return non-falsy value to indicate
@@ -340,7 +344,7 @@ Api.prototype.removePlugin = function (plugin,
uninstallOptions) {
* @return {Promise} Return a promise
*/
-Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods) {
+Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods,
installOptions) {
const self = this;
const project_dir = self.locations.root;
@@ -389,6 +393,9 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs,
frameworkPods) {
// libraries
Object.keys(obj.libraries).forEach(function (key) {
const podJson = Object.assign({}, obj.libraries[key]);
+ if (podJson.spec) {
+ podJson.spec = getVariableSpec(podJson.spec,
installOptions);
+ }
const val = podsjsonFile.getLibrary(key);
if (val) {
events.emit('warn', plugin.id + ' depends on ' +
podJson.name + ', which may conflict with another plugin. ' + podJson.name +
'@' + val.spec + ' is already installed and was not overwritten.');
@@ -406,10 +413,11 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs,
frameworkPods) {
events.emit('warn', '"framework" tag with type "podspec" is deprecated
and will be removed. Please use the "podspec" tag.');
events.emit('verbose', 'Adding pods since the plugin contained
<framework>(s) with type="podspec"');
frameworkPods.forEach(function (obj) {
+ const spec = getVariableSpec(obj.spec, installOptions);
const podJson = {
name: obj.src,
type: obj.type,
- spec: obj.spec
+ spec
};
const val = podsjsonFile.getLibrary(podJson.name);
@@ -459,7 +467,7 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs,
frameworkPods) {
* @return {Promise} Return a promise
*/
-Api.prototype.removePodSpecs = function (plugin, podSpecs, frameworkPods) {
+Api.prototype.removePodSpecs = function (plugin, podSpecs, frameworkPods,
uninstallOptions) {
const self = this;
const project_dir = self.locations.root;
@@ -511,6 +519,9 @@ Api.prototype.removePodSpecs = function (plugin, podSpecs,
frameworkPods) {
// libraries
Object.keys(obj.libraries).forEach(function (key) {
const podJson = Object.assign({}, obj.libraries[key]);
+ if (podJson.spec) {
+ podJson.spec = getVariableSpec(podJson.spec,
uninstallOptions);
+ }
const val = podsjsonFile.getLibrary(key);
if (val) {
podsjsonFile.decrementLibrary(key);
@@ -529,10 +540,11 @@ Api.prototype.removePodSpecs = function (plugin,
podSpecs, frameworkPods) {
events.emit('warn', '"framework" tag with type "podspec" is deprecated
and will be removed. Please use the "podspec" tag.');
events.emit('verbose', 'Adding pods since the plugin contained
<framework>(s) with type=\"podspec\"'); /* eslint no-useless-escape : 0 */
frameworkPods.forEach(function (obj) {
+ const spec = getVariableSpec(obj.spec, uninstallOptions);
const podJson = {
name: obj.src,
type: obj.type,
- spec: obj.spec
+ spec
};
const val = podsjsonFile.getLibrary(podJson.name);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]