It would be great to be able to choose which plugins to install and which ones not to install when using the install_plugins.pl script([Koha]/misc/devel/install_plugins.pl). The --include option would take a list of plugins and only install those. The --exclude option would take a list of plugins and install all plugins except those.
Created attachment 156539 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It’s possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include Test1 --include Koha::Plugin::Test2 TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command : "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project : "./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>” 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful
Created attachment 156555 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful
Created attachment 156557 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful
Created attachment 160210 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful
Created attachment 160239 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Created attachment 160240 [details] [review] Bug 34978: (QA follow-up): - Rebased tests patch (62->51) - tidy - spelling ( paramater -> parameter ) Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
What is the use case for this ? Why would you add plugins in the plugins path if you do not want to install them ?
We manage a hundred personnalized koha installations and we don't want to manually install all the plugins. Plus we have multiple in-house plugins, but not all of them go to all clients. It's much simpler for certain plugins to be in the koha git rather than floating in their standalone plugin in github, most of them because anyway they depend on a personnalised codebase. Some depend on the level of support the user has, etc... What was the use case for install_plugins.pl ? Shouldn't people just use the UI ?
> What was the use case for install_plugins.pl ? Shouldn't people just use the UI ? It would be nice to be able to install plugins from the UI (and by "install" I do not mean "upload and install", only "install") but I believe plugins don't even appear in the UI until misc/devel/install_plugins.pl is run. > We manage a hundred personnalized koha installations and we don't want to manually install all the plugins. One option you have is to keep in $KOHA_CONF only the plugins that should be enabled for that Koha installation. You can still have all plugins in the same git repository. That way you also cannot install the wrong plugins by accident (by forgetting --exclude or --include) I'm not against --include and --exclude options, as they could be useful for testing/debugging purposes, but I'm not sure if it's the best solution for your use case.
Created attachment 163800 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Created attachment 163801 [details] [review] Bug 34978: (QA follow-up): - Rebased tests patch (62->51) - tidy - spelling ( paramater -> parameter ) Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
I agree with Julian we should have a way to install things from the UI. Would be happy to help on a follow-up bug!
Created attachment 166560 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 166561 [details] [review] Bug 34978: (QA follow-up) Fix rebase issues - Rebased tests patch (62->51) - tidy - spelling ( paramater -> parameter ) Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 166562 [details] [review] Bug 34978: Add new parameters to POD Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 166576 [details] [review] Bug 34978: (QA follow-up) Simplify code and make it stricter This patch simplifies the code a bit, removing duplicated pieces of code and making it slightly more readable. The main change is that it now just filters the `@plugin_classes` list as required, and leaves the original codebase for dealing with loading the plugins untouched. A BIG change it implements is that it now requires full class names. I don't see the use case for partial names, and I generally think we should be stricter in this area. If there's the need for partial class names, this should be handled with specific parameters, etc. It also makes it explicit that the `include` and `exclude` parameters are mutually exclusive. A minor idiomatic issue is fixed as well. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Hi, I attached a patch making this look what I believe it should. I'm failing it until we have the tests fixed by the authors. Notes: * The patchset introduces 'warn' calls on a package, which are not covered by tests. This should not be the case * We might need to revisit if `warn` plus `return` is the right thing to do here. I'm tempted to suggest it should just be an exception properly handled on the `install_plugins.pl` script. * My follow-up adds an exception for explicitly forbidding both `include` and `exclude` being used simultaneously. This... needs a test as well!
Created attachment 166736 [details] [review] Bug 34978: (follow-up) Add exception when plugin to install is not found and fix unit test
Created attachment 166738 [details] [review] Bug 34978: Add --include and --exclude options to install_plugins.pl I have added the options --include and --exclude to the install_plugins.pl script. When running the script, you can now specify which plugins you want to install (--include) and which ones you do not want to install (--exclude). --include installs only the plugins from the specified classes. --exclude installs all plugins except those from the specified classes. It's possible to specify the package to install a specific plugin. --include and --exclude cannot be used simultaneously. Usage example: ./misc/devel/install_plugins --include <package::pluginClass> --include <anotherPluginClass>" TEST PLAN 1) Apply the patch 2) Add at least three plugins to the plugin directory ([Koha]/plugins/Koha/Plugin/) 3) Empty the "plugin_data" and "plugin_methods" tables (SQL command: "delete from plugin_data; delete from plugin_methods;") 4) In a terminal, execute this command "./misc/devel/install_plugins.pl --include <package::pluginClass> --include <anotherPluginClass>" (Replace <package::pluginClass> and <anotherPluginClass> with the class and package of your plugins) 5) In your Koha intranet, go to "Koha administration > Manage plugins" 6) Verify that only the specified plugins are installed 7) Repeat step 3 8) In a terminal, execute this command from your Koha project"./misc/devel/install_plugins.pl --exclude <package::pluginClass> --exclude <anotherPluginClass>" 9) Verify that all plugins except the specified ones are installed 10) Run the tests from the Plugins.t file ([Koha]/t/db_dependent/Koha/Plugins/Plugins.t) 11) Ensure that all tests are successful Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Created attachment 166739 [details] [review] Bug 34978: (QA follow-up) Fix rebase issues - Rebased tests patch (62->51) - tidy - spelling ( paramater -> parameter ) Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Created attachment 166740 [details] [review] Bug 34978: Add new parameters to POD Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Created attachment 166741 [details] [review] Bug 34978: (QA follow-up) Simplify code and make it stricter This patch simplifies the code a bit, removing duplicated pieces of code and making it slightly more readable. The main change is that it now just filters the `@plugin_classes` list as required, and leaves the original codebase for dealing with loading the plugins untouched. A BIG change it implements is that it now requires full class names. I don't see the use case for partial names, and I generally think we should be stricter in this area. If there's the need for partial class names, this should be handled with specific parameters, etc. It also makes it explicit that the `include` and `exclude` parameters are mutually exclusive. A minor idiomatic issue is fixed as well. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Created attachment 166742 [details] [review] Bug 34978: (follow-up) Add exception when plugin to install is not found and fix unit test Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>