clear-code / redmine_full_text_search

Full text search for Redmine
MIT License
61 stars 24 forks source link

Ensure using the path in Redmine for plugin directory #129

Closed otegami closed 5 months ago

otegami commented 5 months ago

related: https://github.com/clear-code/redmine_full_text_search/issues/126

Issue

CI failed because of the following error.

Cause

p.path = PluginLoader.directories.find {|d| d.to_s == p.directory}

ref: https://github.com/redmine/redmine/blob/fb449c77bc76b3bae9b3f0bfe18560b11f00902c/lib/redmine/plugin.rb#L107

The registered plugin path refers to the resolved path using a symbolic link. So the plugin path that Redmine gathers by PluginLoaders mismatches with the registered plugin path like the following. Then the result of the above code is nil.

PluginLoader.directories
=> 
[#<Redmine::PluginPath:0x00007f2b501b8578
  @assets_dir="/home/runner/work/redmine_full_text_search/redmine/plugins/full_text_search/assets",
  @dir="/home/runner/work/redmine_full_text_search/redmine/plugins/full_text_search", # <= This is unresolved path.
  @initializer="/home/runner/work/redmine_full_text_search/redmine/plugins/full_text_search/init.rb">]
> p.directory
=> "/home/runner/work/redmine_full_text_search/redmine_full_text_search" # <= This is resolved path.

Solution

Use the path in Redmine's plugins directory for this plugin's directory just in case you use a symbolic link to set this plugin under Redmine's plugins/.