Skip to content

Commit

Permalink
Revert "Fix: replace of podspec variables in podfile (apache#1126)"
Browse files Browse the repository at this point in the history
This reverts commit 70d128a.
  • Loading branch information
deanylev committed Apr 24, 2024
1 parent f4b4b86 commit 127162e
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions lib/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ 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.
Expand Down Expand Up @@ -395,8 +382,10 @@ class Api {
// libraries
if (obj.libraries) {
Object.keys(obj.libraries).forEach(key => {
let podJson = Object.assign({}, obj.libraries[key]);
podJson = replacePodSpecVariables(podJson, installOptions);
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.`);
Expand Down Expand Up @@ -516,8 +505,10 @@ class Api {
});
// libraries
Object.keys(obj.libraries).forEach(key => {
let podJson = Object.assign({}, obj.libraries[key]);
podJson = replacePodSpecVariables(podJson, uninstallOptions);
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);
Expand Down

0 comments on commit 127162e

Please sign in to comment.