Quantcast
Viewing latest article 41
Browse Latest Browse All 57

Feature #31538 (New): Allow a plugin to be installed in the directory different from the plugin id

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}." 

Viewing latest article 41
Browse Latest Browse All 57

Trending Articles