Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow component upgrades to relocate own plugins #280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Expand Down
44 changes: 19 additions & 25 deletions bin/init/plugins-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down