Project

General

Profile

Actions

Feature #31538

open

Allow a plugin to be installed in the directory different from the plugin id

Added by Sho HASHIMOTO almost 5 years ago. Updated almost 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Plugin API
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

After #31110, we can't install plugin tarball like "foo-plugin-x.y.z" without rename. I want install plugin only stable version. I don't want use svn trunk/git master. And I want to know plugin version easily with its directory name.

I want change default directory like below if I can.

diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index b3982fcfd..f75f181be 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -96,7 +96,10 @@ module Redmine
       # Set a default name if it was not provided during registration
       p.name(id.to_s.humanize) if p.name.nil?
       # Set a default directory if it was not provided during registration
-      p.directory(File.join(self.directory, id.to_s)) if p.directory.nil?
+      if p.directory.nil?
+        dirname = File.basename(File.dirname(block.source_location[0]))
+        p.directory(File.join(self.directory, dirname))
+      end

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

Related issues

Related to Redmine - Patch #31110: Raise an exception if the plugin directory name differs from the plugin idClosedGo MAEDA

Actions
Actions

Also available in: Atom PDF