redmine-git-hosting / redmine_git_hosting

A Redmine plugin which makes configuring your own Git hosting easy ;)
http://redmine-git-hosting.io
MIT License
274 stars 117 forks source link

Compatible with Rails 6: zeitwerk and search path #807

Closed prahal closed 2 years ago

prahal commented 2 years ago

This is to cope with rails autoloading : zeitwerk. I was unable to keep hrack subfolders as is per zeitweirk ended up trying to load Hrack::Lib::Hrack::Lib for the plugin config/routes.rb call to mount Hrack::Bundle.new({}), at: 'githooks/post-receive/:type/:projectid', via: [:post] . Probably a bug in zeitwerk when the a folder has its own name in one of its subfolder.

/var/log/redmine/default/unicorn.stdout.log
An error occurred while loading the routes definition of redmine_git_hosting plugin (/usr/share/redmine/plugins/redmine_git_hosting/config/routes.rb): uninitialized constant Hrack::Lib::Hrack::Lib
Did you mean?  Zlib.

If I rename one of the subfolder and the caller Hrack by Hracp it works. So my above deduction.

Otherwise I mostly synchronize the module hierarchy to the folder hierarchy per zeitwerk requirements. I keep the code out of the module if it was not already enclosed by a module.

I also add plugin lib to the LOAD_PATH.

PowerKiKi commented 2 years ago

Thank you for your work so far. It has been superseded by #815