redmine_plugin_kit 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/redmine_plugin_kit/loader.rb +24 -1
- data/lib/redmine_plugin_kit/plugin_base.rb +13 -0
- data/lib/redmine_plugin_kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94857a34d940b2fccba2f613e3299cef59acc88c20c3279671831fd923c3e28e
|
|
4
|
+
data.tar.gz: 4d6e9c22ea18b5050b9084fe60b577a4cb3da032801a13a0b16f6ec99664a443
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90fe0d769fa01295f8dea757cff3aa5f9dc48005c8ee4ea356b6cdece1da7e0330f11020359cee3f9cb53c587eaa95281c7b7d1493d4a95be8cad1e7dbe26ad9
|
|
7
|
+
data.tar.gz: f3d7a85ab307ffe4425229878f41581e03a04a833e34f626e8336ae52005e6f2a04be166517d6fcdb6b32489ceda1d08ba2d58ebef77f3265547c71a9ebf605f
|
|
@@ -89,11 +89,34 @@ module RedminePluginKit
|
|
|
89
89
|
|
|
90
90
|
files.reverse! if reverse
|
|
91
91
|
files.each do |f|
|
|
92
|
-
|
|
92
|
+
if Rails.version > '6.0' && ignore_autoload
|
|
93
|
+
Rails.autoloaders.main.ignore << f
|
|
94
|
+
# Such a file registers itself in a registry that lives on a module
|
|
95
|
+
# Zeitwerk rebuilds on every reload (Redmine::FieldFormat). The
|
|
96
|
+
# registration is lost with the old module, and require would be a
|
|
97
|
+
# no-op the second time round - the custom field then falls back to a
|
|
98
|
+
# plain text field showing the raw id. Reloading the file restores it.
|
|
99
|
+
#
|
|
100
|
+
# NOTE: the require below stays as it is, so booting behaves exactly as
|
|
101
|
+
# before and does not depend on when to_prepare runs. Loading the file
|
|
102
|
+
# again in the first prepare run is harmless: these files only define a
|
|
103
|
+
# class and register it under a fixed name.
|
|
104
|
+
reload_on_prepare f
|
|
105
|
+
end
|
|
106
|
+
|
|
93
107
|
require f
|
|
94
108
|
end
|
|
95
109
|
end
|
|
96
110
|
|
|
111
|
+
# Load the file again after every code reload.
|
|
112
|
+
#
|
|
113
|
+
# The block keeps the order of the surrounding loop, which matters because
|
|
114
|
+
# formats may inherit from each other (CompanyFormat < ContactFormat) - a
|
|
115
|
+
# subclass loaded before its parent raises NameError.
|
|
116
|
+
def reload_on_prepare(file)
|
|
117
|
+
ActiveSupport::Reloader.to_prepare { load file }
|
|
118
|
+
end
|
|
119
|
+
|
|
97
120
|
def incompatible?(plugins = [])
|
|
98
121
|
plugins.each do |plugin|
|
|
99
122
|
raise "\n\033[31m#{plugin_id} plugin cannot be used with #{plugin} plugin.\033[0m" if Redmine::Plugin.installed? plugin
|
|
@@ -38,6 +38,19 @@ module RedminePluginKit
|
|
|
38
38
|
|
|
39
39
|
private
|
|
40
40
|
|
|
41
|
+
# Enforce a plugin's REQUIRED_ALPHANODES_PLUGINS (an array of plugin ids it
|
|
42
|
+
# hard-depends on). Called from setup! which runs via the
|
|
43
|
+
# after_plugins_loaded hook, i.e. AFTER every plugin is registered - so the
|
|
44
|
+
# alphabetical plugin load order is irrelevant here.
|
|
45
|
+
#
|
|
46
|
+
# This is why AlphaNodes plugins declare dependencies on other redmine_*
|
|
47
|
+
# plugins via REQUIRED_ALPHANODES_PLUGINS instead of requires_redmine_plugin:
|
|
48
|
+
# requires_redmine_plugin runs while init.rb is loaded (during alphabetical
|
|
49
|
+
# registration) and therefore only works for dependencies that load earlier,
|
|
50
|
+
# such as additionals / additional_tags. A dependency that loads later (e.g.
|
|
51
|
+
# redmine_automation depending on redmine_reporting) would raise
|
|
52
|
+
# PluginNotFound even though it is installed. To see a plugin's hard
|
|
53
|
+
# AlphaNodes dependencies, look at its REQUIRED_ALPHANODES_PLUGINS constant.
|
|
41
54
|
# rubocop: disable Style/RaiseArgs
|
|
42
55
|
def setup_required_plugins
|
|
43
56
|
return unless defined? self::REQUIRED_ALPHANODES_PLUGINS
|