FIX: LOAD_PLUGINS=0 in dev/prod, warn in plugin:pull_compatible_all (#15537)

The `plugin:pull_compatible_all` task is intended to take incompatible plugins and downgrade them to an earlier version. Problem is, when running the rake task in development/production environments, the plugins have already been activated. If an incompatible plugin raises an error in `plugin.rb` then the rake task will be unable to start.

This commit centralises our LOAD_PLUGINS detection, adds support for LOAD_PLUGINS=0 in dev/prod, and adds a warning to `plugin:pull_compatible_all` if it's run with plugins enabled.
This commit is contained in:
David Taylor
2022-01-11 12:30:22 +00:00
committed by GitHub
parent dd3e766efd
commit b3e52f99e6
4 changed files with 23 additions and 7 deletions

View File

@ -109,6 +109,13 @@ end
desc 'pull compatible plugin versions for all plugins'
task 'plugin:pull_compatible_all' do |t|
if GlobalSetting.load_plugins?
STDERR.puts <<~TEXT
WARNING: Plugins were activated before running `rake plugin:pull_compatible_all`
You should prefix this command with LOAD_PLUGINS=0
TEXT
end
# Loop through each directory
plugins = Dir.glob(File.expand_path('plugins/*')).select { |f| File.directory? f }
# run plugin:pull_compatible