DEV: Fixup plugin initialization guard (#24628)
In development, I sometimes get `nil` `location.absolute_path` values. It looks like this is sometimes expected (https://bugs.ruby-lang.org/issues/10561) so we should fallback to `.path` and add a nil check.
This commit is contained in:
parent
1881ae50be
commit
265a8cd2b2
|
@ -13,8 +13,10 @@ module Plugin
|
||||||
.backtrace_locations
|
.backtrace_locations
|
||||||
.lazy
|
.lazy
|
||||||
.map do |location|
|
.map do |location|
|
||||||
|
resolved_path = location.absolute_path || location.path
|
||||||
|
next if resolved_path.nil?
|
||||||
Pathname
|
Pathname
|
||||||
.new(location.absolute_path)
|
.new(resolved_path)
|
||||||
.ascend
|
.ascend
|
||||||
.lazy
|
.lazy
|
||||||
.find { |path| path.parent == plugins_directory }
|
.find { |path| path.parent == plugins_directory }
|
||||||
|
@ -42,7 +44,7 @@ module Plugin
|
||||||
|
|
||||||
** INCOMPATIBLE PLUGIN **
|
** INCOMPATIBLE PLUGIN **
|
||||||
|
|
||||||
You are unable to build Discourse due to errors in the plugin at
|
You are unable to start Discourse due to errors in the plugin at
|
||||||
#{plugin_path}
|
#{plugin_path}
|
||||||
|
|
||||||
Please try removing this plugin and rebuilding again!
|
Please try removing this plugin and rebuilding again!
|
||||||
|
@ -51,7 +53,7 @@ module Plugin
|
||||||
STDERR.puts <<~TEXT
|
STDERR.puts <<~TEXT
|
||||||
** PLUGIN FAILURE **
|
** PLUGIN FAILURE **
|
||||||
|
|
||||||
You are unable to build Discourse due to this error during plugin
|
You are unable to start Discourse due to this error during plugin
|
||||||
initialization:
|
initialization:
|
||||||
|
|
||||||
#{error}
|
#{error}
|
||||||
|
|
Loading…
Reference in New Issue