Project

General

Profile

Actions

Patch #31110

closed

Raise an exception if the plugin directory name differs from the plugin id

Patch #31110: Raise an exception if the plugin directory name differs from the plugin id

Added by Mizuki ISHIKAWA over 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugin API
Target version:

Description

If the plugin directory name and the plugin id are not the same, the plugin will not work because the required files will not be read.


Example:

If you change the directory name of redmine_vividtone_my_page_blocks plugin to redmine-vividtone-my-page-blocks, the following log will be output and it will not work well.

Partial "my/blocks/new_issues" missing for block "new_issues" found in admin (id=1) preferences
Partial "my/blocks/neglected_issues" missing for block "neglected_issues" found in admin (id=1) preferences
Partial "my/blocks/doing_issues" missing for block "doing_issues" found in admin (id=1) preferences

The problem is hard to solve because you can not notice that the wrong directory name is the cause of the problem.


I think I should raise an exception if there is no directory with the same name as the plugin id.
I attached a patch for that.


Files


Related issues 1 (1 open — 0 closed)

Related to Redmine - Feature #31538: Allow a plugin to be installed in the directory different from the plugin idNewActions

Updated by Go MAEDA over 7 years ago Actions #2

  • Target version set to Candidate for next major release

Thank you for posting the patch. I think it would be even better if the exception has a more informative message like the following. With this message, an admin easily understands that he should rename the directory.

Plugin not found. The plugin #{p.id} should be installed in #{p.directory}.

Updated by Go MAEDA over 7 years ago Actions #3

  • Target version changed from Candidate for next major release to 4.1.0

Updated by Mizuki ISHIKAWA over 7 years ago Actions #4

I corrected the error message to include the directory name.

Updated by Akiko Takano over 7 years ago Actions #5

+1 Nice work, quite helpful!

Updated by Go MAEDA over 7 years ago Actions #6

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patches. Thank you for your contribution.

Updated by Go MAEDA over 7 years ago Actions #7

  • Related to Feature #31538: Allow a plugin to be installed in the directory different from the plugin id added

Updated by luigifab ! over 4 years ago Actions #8

Since the following piece of code was added:

      unless File.directory?(p.directory)
        raise PluginNotFound, "Plugin not found. The directory for plugin #{p.id} should be #{p.directory}." 
      end

This prevent Redmine plugins packed into Gem (example https://rubygems.org/gems/redmine_apijs for Redmine < 5) to work with Redmine 4.1+. It was working with Redmine 3.x and 4.0.

By removing it, this work with Redmine 4.1 / 4.2 / 5.0.

Updated by Mizuki ISHIKAWA over 4 years ago Actions #9

luigifab ! wrote:

Since the following piece of code was added:

[...]

This prevent Redmine plugins packed into Gem (example https://rubygems.org/gems/redmine_apijs for Redmine < 5) to work with Redmine 4.1+. It was working with Redmine 3.x and 4.0.

By removing it, this work with Redmine 4.1 / 4.2 / 5.0.

Thanks for sharing the issue.
The exception occurred because the plugin directory is located in /usr/local/bundle/gems/redmine_apijs-6.9.0 when using the redmine_apijs plugin as you mentioned.

Updated by Go MAEDA over 4 years ago Actions #10

luigifab ! wrote:

Since the following piece of code was added:

[...]

This prevent Redmine plugins packed into Gem (example https://rubygems.org/gems/redmine_apijs for Redmine < 5) to work with Redmine 4.1+. It was working with Redmine 3.x and 4.0.

By removing it, this work with Redmine 4.1 / 4.2 / 5.0.

Since this issue is closed and the change has already been delivered, please open a new issue.

Actions

Also available in: PDF Atom