paginagmbh / redmine_lightbox2

Lightbox for image attachments in Redmine
MIT License
126 stars 97 forks source link

Add Redmine 4 / Rails 5.2 support #51

Closed netdiver closed 5 years ago

netdiver commented 6 years ago

As for subject, cannot install plugin with Rails 5.1. Some google search lead to the conclusion that to_prepare is deprecated in Rails 5.1 (default for Debian 9).

/opt/redmine$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production
rake aborted!
NoMethodError: undefined method `to_prepare' for ActionDispatch::Callbacks:Class
Did you mean?  to_param
/opt/redmine/plugins/redmine_lightbox2/init.rb:22:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/opt/redmine/lib/redmine/plugin.rb:155:in `block in load'
/opt/redmine/lib/redmine/plugin.rb:146:in `each'
/opt/redmine/lib/redmine/plugin.rb:146:in `load'
/opt/redmine/config/initializers/30-redmine.rb:21:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/opt/redmine/config/environment.rb:14:in `<top (required)>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)
tofi86 commented 6 years ago

Hi,

Rails 5.1 isn't supported by Redmine (yet): http://www.redmine.org/projects/redmine/wiki/RedmineInstall

Only the current development version of Redmine 4.0 will support Rails 5.1, but I won't fix the plugin until a stable version 4.0 is released.

tofi86 commented 6 years ago

If you use Redmine 3.4, please install Rails 4.2

netdiver commented 6 years ago

You are right, I installed redmine from code repo, so it should be 4.0. Sorry for the mistake.

netdiver commented 6 years ago

I reviewed what I've done, and I installed Redmine v3.4-devel from hg repo, but I'm running it in Rails 5.1 in Debian 9.

tofi86 commented 6 years ago

Rails 5.1 is currently not supported by Redmine 3.4. See link above for details.

netdiver commented 6 years ago

I was just analyzing the situation and it turned out that Rails is not installed with debian package, but it was the "bundle install" command that installed Rails 5.1.4. In the redmine-trunk repository with version labeled 3.4.4.devel the developers changed Rails version to 5.1.4, as for the Gemfile: https://bitbucket.org/redmine/redmine-trunk/src/677760efe791/Gemfile?at=default&fileviewer=file-view-default

netdiver commented 6 years ago

My fault: the redmine-trunk is the devel - unstable version. Sorry for the misleading infos I published.

Romancho commented 6 years ago

In branch master (Redmine v.3.4) Gemfile contain gem "rails", "5.2.1" https://github.com/redmine/redmine/blob/master/Gemfile What did you mean when you sad "Rails 5.1 isn't supported by Redmine "?

tofi86 commented 6 years ago

@Romancho the master branch of Redmine (or trunk in Redmine SVN) does NOT contain Redmine v3.4 but the current unstable/unreleased version 4.0

The Branch 3.4-stable does not support Rails 5!

bodun commented 5 years ago

@tofi86 Hi! Thanks for you work! Now redmine 4 relized with Rails 5 support. Is there any plans to upgrade your plugin?

tofi86 commented 5 years ago

Hi plan to support Redmine 4, but won't have time until after the christmas holidays.

If anyone can help and sends a pull request to add support for Rails 5 earlier than end of 2018, I'm happy to merge that!

vdtest commented 5 years ago

btw redmine uses Rails 5.2.2 (not 5.1) on official stable 4.0.0

can't help, but waiting. thank you.

tofi86 commented 5 years ago

I added support for Redmine 4.0 on the master branch. I tested with latest code from Redmine branch "4.0-stable".

Can anyone confirm that the current master works as expected in 4.0?


FYI: The code for Redmine 3.4 moved to the branch redmine-3.4.

bodun commented 5 years ago

Hi!

I install this plugin on my Redmine 4.0.0.stable - no problem with installation. Next I test it on images attached to the task - works as expected. So I can confirm that it works just fine, thank you very much!

AdamN1 commented 5 years ago

Confirm works fine, thank you very much

vdtest commented 5 years ago

It's working now. Tested on png and pdf. Thank you! (redmine 4.0, rails 5.2.2, ruby 2.5.1p57)

tofi86 commented 5 years ago

Awesome! Glad to hear it works. Thanks for testing guys! 👏

Going to release this soon.

tofi86 commented 5 years ago

v0.5.0 was just released. Have fun!