This is an automated email from the ASF dual-hosted git repository.
dpogue 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 70d128a1 Fix: replace of podspec variables in podfile (#1126)
70d128a1 is described below
commit 70d128a1cf4f01f24ee3a14f05d38987e6ef42dd
Author: Filipe Pereira <[email protected]>
AuthorDate: Thu Jun 8 18:28:04 2023 +0100
Fix: replace of podspec variables in podfile (#1126)
Co-authored-by: Filipe Pereira <[email protected]>
---
lib/Api.js | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/Api.js b/lib/Api.js
index a7fced47..95f8dec3 100644
--- a/lib/Api.js
+++ b/lib/Api.js
@@ -51,6 +51,19 @@ function getVariableSpec (spec, options) {
return spec.includes('$') ? options.cli_variables[spec.replace('$', '')] :
spec;
}
+// Replaces all pod specs available
+function replacePodSpecVariables (pod, options) {
+ const podSpecs = ['spec', 'tag', 'git', 'commit', 'branch'];
+
+ podSpecs.filter(e => pod[e])
+ .forEach(obj => {
+ const value = pod[obj];
+ pod[obj] = getVariableSpec(value, options);
+ });
+
+ return pod;
+}
+
class Api {
/**
* Creates a new PlatformApi instance.
@@ -379,10 +392,8 @@ class Api {
// libraries
if (obj.libraries) {
Object.keys(obj.libraries).forEach(key => {
- const podJson = Object.assign({}, obj.libraries[key]);
- if (podJson.spec) {
- podJson.spec = getVariableSpec(podJson.spec,
installOptions);
- }
+ let podJson = Object.assign({}, obj.libraries[key]);
+ podJson = replacePodSpecVariables(podJson,
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.`);
@@ -472,10 +483,8 @@ class Api {
});
// libraries
Object.keys(obj.libraries).forEach(key => {
- const podJson = Object.assign({}, obj.libraries[key]);
- if (podJson.spec) {
- podJson.spec = getVariableSpec(podJson.spec,
uninstallOptions);
- }
+ let podJson = Object.assign({}, obj.libraries[key]);
+ podJson = replacePodSpecVariables(podJson,
uninstallOptions);
const val = podsjsonFile.getLibrary(key);
if (val) {
podsjsonFile.decrementLibrary(key);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]