Skip to content

Commit

Permalink
Merge pull request #280 from zowe/feature/v2/update-plugin-location-o…
Browse files Browse the repository at this point in the history
…n-startup

Allow component upgrades to relocate own plugins
1000TurquoisePogs authored Oct 2, 2023
2 parents 49cc1a0 + dd59c1b commit fa71348
Showing 2 changed files with 23 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Zlux App Server Changelog

All notable changes to the Zlux App Server package will be documented in this file.

## v2.12.0
- enhancement: new versions of components can change the location of their plugins, as the app-server will now re-inspect the plugin locations on each startup. (#280)


## v2.11.0

44 changes: 19 additions & 25 deletions bin/init/plugins-init.js
Original file line number Diff line number Diff line change
@@ -38,33 +38,27 @@ function deleteFile(path) {
}

function registerPlugin(pluginPath, pluginDefinition) {
const pointerPath = `${pluginPointerDirectory}/${pluginDefinition.identifier}.json`;
if (fs.fileExists(pointerPath)) {
//in case of upgrade
registerApp2App(pluginPath, pluginDefinition.identifier, pluginDefinition.pluginVersion);
return true;
} else {
let location, relativeTo;
if (pluginPath.startsWith(runtimeDirectory)) {
relativeTo = "$ZWE_zowe_runtimeDirectory";
location = pluginPath.substring(runtimeDirectory.length);
if (location.startsWith('/')) {
location = location.substring(1);
}

xplatform.storeFileUTF8(pointerPath, xplatform.AUTO_DETECT, JSON.stringify({
"identifier": pluginDefinition.identifier,
"pluginLocation": location,
"relativeTo": relativeTo
}, null, 2));
} else {
xplatform.storeFileUTF8(pointerPath, xplatform.AUTO_DETECT, JSON.stringify({
"identifier": pluginDefinition.identifier,
"pluginLocation": pluginPath
}, null, 2));
const pointerPath = `${pluginPointerDirectory}/${pluginDefinition.identifier}.json`;
let location, relativeTo;
if (pluginPath.startsWith(runtimeDirectory)) {
relativeTo = "$ZWE_zowe_runtimeDirectory";
location = pluginPath.substring(runtimeDirectory.length);
if (location.startsWith('/')) {
location = location.substring(1);
}
registerApp2App(pluginPath, pluginDefinition.identifier, pluginDefinition.pluginVersion);

xplatform.storeFileUTF8(pointerPath, xplatform.AUTO_DETECT, JSON.stringify({
"identifier": pluginDefinition.identifier,
"pluginLocation": location,
"relativeTo": relativeTo
}, null, 2));
} else {
xplatform.storeFileUTF8(pointerPath, xplatform.AUTO_DETECT, JSON.stringify({
"identifier": pluginDefinition.identifier,
"pluginLocation": pluginPath
}, null, 2));
}
registerApp2App(pluginPath, pluginDefinition.identifier, pluginDefinition.pluginVersion);
}


0 comments on commit fa71348

Please sign in to comment.