biow0lf / redmine_landing_page

Landing Page plugin for redmine
http://www.redmine.org/plugins/landing_page
33 stars 25 forks source link

Support for Redmine 5.x #18

Open andreav opened 2 years ago

andreav commented 2 years ago

Hello, anyone knows how to upgrade this plugin to redmine 5.x?

I tried just now but getting this error (I think it is due to this: "Migrate to Rails 6.1 with Zeitwerk autoloading")

 /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require': cannot load such file -- redmine_landing_page/hooks/view_projects_form_hook (LoadError)
      from /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
      from /usr/src/redmine/plugins/redmine_landing_page/init.rb:29:in `<top (required)>'
      from /usr/src/redmine/lib/redmine/plugin_loader.rb:31:in `load'
      from /usr/src/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer'
      from /usr/src/redmine/lib/redmine/plugin_loader.rb:108:in `each'
      from /usr/src/redmine/lib/redmine/plugin_loader.rb:108:in `block in load'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:427:in `instance_exec'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:427:in `block in make_lambda'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:604:in `block (2 levels) in default_terminator'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:603:in `catch'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:603:in `block in default_terminator'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:199:in `block in halting'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `block in invoke_before'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `each'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `invoke_before'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:105:in `run_callbacks'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/reloader.rb:88:in `prepare!'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/application/finisher.rb:124:in `block in <module:Finisher>'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/initializable.rb:32:in `instance_exec'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/initializable.rb:32:in `run'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/initializable.rb:61:in `block in run_initializers'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
      from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/initializable.rb:60:in `run_initializers'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/application.rb:391:in `initialize!'
      from /usr/src/redmine/config/environment.rb:16:in `<top (required)>'
      from /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      from /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      from /usr/local/bundle/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:332:in `block in require'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:299:in `load_dependency'
      from /usr/local/bundle/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:332:in `require'
      from config.ru:3:in `block in <main>'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in start'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling'
      from /usr/local/bundle/gems/rack-2.2.3/lib/rack/server.rb:311:in `start'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/commands/server/server_command.rb:39:in `start'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/commands/server/server_command.rb:144:in `block in perform'
      from <internal:kernel>:90:in `tap'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/commands/server/server_command.rb:135:in `perform'
      from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
      from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
      from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/command/base.rb:69:in `perform'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/command.rb:48:in `invoke'
      from /usr/local/bundle/gems/railties-6.1.4.7/lib/rails/commands.rb:18:in `<top (required)>'
      from bin/rails:4:in `require'
      from bin/rails:4:in `<main>'
andreav commented 2 years ago

Hello, as stated here it seems there is no more need for ActiveSupport::Reloader.to_prepare after Rails 6 and Zeitwerk.

Indeed I just removed to_prepare and plugin started working again. As a bonus, thanks to Zeitwerk it looks like "requires" are no more useful. I tried removing them too, and this plugin seems to work normally.

I'm using this fix on Redmine 5.0 and it seems work.