Feature #27705 » support_gem_plugin.patch
| lib/redmine/plugin.rb | ||
|---|---|---|
| 143 | 143 |
end |
| 144 | 144 | |
| 145 | 145 |
def self.load |
| 146 |
# load plugins from bundle installed gems. |
|
| 147 |
Gem.loaded_specs.each do |gem_name, gem_spec| |
|
| 148 |
initializer = File.join(gem_spec.full_gem_path, 'init.rb') |
|
| 149 |
is_redmine_plugin = true # TODO: detect redmine plugin |
|
| 150 |
if File.file?(initializer) && is_redmine_plugin |
|
| 151 |
# TODO: Set plugin.directory to gem root. |
|
| 152 |
require initializer |
|
| 153 | ||
| 154 |
# Make pointer to reduce confusing for redmine maintainer |
|
| 155 |
path = File.join(Redmine::Plugin.directory, gem_name) |
|
| 156 |
if !File.exists?(path) |
|
| 157 |
File.open(path, 'w') do |f| |
|
| 158 |
f.write(<<EOS) |
|
| 159 |
This plugin was installed as gem wrote to Gemfile* instead of putting Redmine's plugin directory. |
|
| 160 |
See #{gem_name} gem installed directory.
|
|
| 161 |
EOS |
|
| 162 |
end |
|
| 163 |
end |
|
| 164 |
end |
|
| 165 |
end |
|
| 166 | ||
| 167 |
# Keep current plugin loading method. |
|
| 146 | 168 |
Dir.glob(File.join(self.directory, '*')).sort.each do |directory| |
| 147 | 169 |
if File.directory?(directory) |
| 148 | 170 |
lib = File.join(directory, "lib") |