Try to run plugin setup without db check

This commit is contained in:
Alexander Meindl 2020-03-26 13:41:06 +01:00
parent 8d8d886c53
commit 25a4e89098

32
init.rb
View File

@ -40,23 +40,17 @@ Redmine::Plugin.register :additionals do
RedCloth3::ALLOWED_TAGS << 'div'
end
begin
if ActiveRecord::Base.connection.table_exists?(Setting.table_name)
Rails.configuration.to_prepare do
Additionals.setup
end
Rails.application.config.after_initialize do
FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab),
far: AdditionalsFontAwesome.load_icons(:far),
fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze
end
Rails.application.paths['app/overrides'] ||= []
Dir.glob(Rails.root.join('plugins/*/app/overrides')).each do |dir|
Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir)
end
end
rescue ActiveRecord::NoDatabaseError
Rails.logger.warn 'database not created yet'
Rails.configuration.to_prepare do
Additionals.setup
end
Rails.application.config.after_initialize do
FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab),
far: AdditionalsFontAwesome.load_icons(:far),
fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze
end
Rails.application.paths['app/overrides'] ||= []
Dir.glob(Rails.root.join('plugins/*/app/overrides')).each do |dir|
Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir)
end