From b4cabf59e7209264db9ca4ba14dff108590ac829 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 19 Sep 2023 15:38:16 -0400 Subject: [PATCH 1/4] Keep plugin location up to date by rewriting the json every startup Signed-off-by: 1000TurquoisePogs --- bin/init/plugins-init.js | 42 +++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/bin/init/plugins-init.js b/bin/init/plugins-init.js index 15e5e58..1dd9d06 100644 --- a/bin/init/plugins-init.js +++ b/bin/init/plugins-init.js @@ -39,32 +39,26 @@ 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)); + 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); } From 3aead2238bf6ba4a3e47830e29d94dad62791757 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 19 Sep 2023 15:53:35 -0400 Subject: [PATCH 2/4] Update plugins-init.js Signed-off-by: 1000TurquoisePogs --- bin/init/plugins-init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/init/plugins-init.js b/bin/init/plugins-init.js index 1dd9d06..7c0fb6f 100644 --- a/bin/init/plugins-init.js +++ b/bin/init/plugins-init.js @@ -46,7 +46,7 @@ function registerPlugin(pluginPath, pluginDefinition) { if (location.startsWith('/')) { location = location.substring(1); } - + xplatform.storeFileUTF8(pointerPath, xplatform.AUTO_DETECT, JSON.stringify({ "identifier": pluginDefinition.identifier, "pluginLocation": location, From a417b7f878dd1b0aaa31a6ad798330c88226ff7c Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 26 Sep 2023 09:33:24 -0400 Subject: [PATCH 3/4] Update plugins-init.js Signed-off-by: 1000TurquoisePogs --- bin/init/plugins-init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/init/plugins-init.js b/bin/init/plugins-init.js index 7c0fb6f..d99e7de 100644 --- a/bin/init/plugins-init.js +++ b/bin/init/plugins-init.js @@ -38,7 +38,7 @@ function deleteFile(path) { } function registerPlugin(pluginPath, pluginDefinition) { - const pointerPath = `${pluginPointerDirectory}/${pluginDefinition.identifier}.json`; + const pointerPath = `${pluginPointerDirectory}/${pluginDefinition.identifier}.json`; let location, relativeTo; if (pluginPath.startsWith(runtimeDirectory)) { relativeTo = "$ZWE_zowe_runtimeDirectory"; From dd59c1b603cefdfab2865185f6d8b293f253d35f Mon Sep 17 00:00:00 2001 From: Zowe Robot Date: Tue, 26 Sep 2023 13:33:42 +0000 Subject: [PATCH 4/4] Update changelog with PR #280 description Signed-off-by: Zowe Robot --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec16a5..face090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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