This reverts commit e62a85cf6f, reversing
changes made to 2660c2e21d.
This commit is contained in:
Jeff Atwood
2020-05-22 20:25:56 -07:00
parent e62a85cf6f
commit 20780a1eee
236 changed files with 717 additions and 1033 deletions
+21 -32
View File
@@ -6,44 +6,33 @@ def plugin_initialization_guard(&block)
rescue => error
plugins_directory = Rails.root + 'plugins'
if error.backtrace && error.backtrace_locations
plugin_path = error.backtrace_locations.lazy.map do |location|
Pathname.new(location.absolute_path)
.ascend
.lazy
.find { |path| path.parent == plugins_directory }
end.next
plugin_path = error.backtrace_locations.lazy.map do |location|
Pathname.new(location.absolute_path)
.ascend
.lazy
.find { |path| path.parent == plugins_directory }
end.next
raise unless plugin_path
raise unless plugin_path
stack_trace = error.backtrace.each_with_index.inject([]) do |messages, (line, index)|
if index == 0
messages << "#{line}: #{error} (#{error.class})"
else
messages << "\t#{index}: from #{line}"
end
end.reverse.join("\n")
stack_trace = error.backtrace.each_with_index.inject([]) do |messages, (line, index)|
if index == 0
messages << "#{line}: #{error} (#{error.class})"
else
messages << "\t#{index}: from #{line}"
end
end.reverse.join("\n")
STDERR.puts <<~MESSAGE
#{stack_trace}
STDERR.puts <<~MESSAGE
#{stack_trace}
** INCOMPATIBLE PLUGIN **
** INCOMPATIBLE PLUGIN **
You are unable to build Discourse due to errors in the plugin at
#{plugin_path}
You are unable to build Discourse due to errors in the plugin at
#{plugin_path}
Please try removing this plugin and rebuilding again!
MESSAGE
else
STDERR.puts <<~MESSAGE
** PLUGIN FAILURE **
You are unable to build Discourse due to this error during plugin
initialization:
#{error}
MESSAGE
end
Please try removing this plugin and rebuilding again!
MESSAGE
exit 1
end
end