mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
allow plugins to be symlinked
This commit is contained in:
parent
9c820443fa
commit
fcd85b8a72
2 changed files with 3 additions and 2 deletions
|
@ -10,7 +10,8 @@ class Plugin::Instance
|
||||||
|
|
||||||
def self.find_all(parent_path)
|
def self.find_all(parent_path)
|
||||||
[].tap { |plugins|
|
[].tap { |plugins|
|
||||||
Dir["#{parent_path}/**/plugin.rb"].each do |path|
|
# also follows symlinks - http://stackoverflow.com/q/357754
|
||||||
|
Dir["#{parent_path}/**/*/**/plugin.rb"].each do |path|
|
||||||
source = File.read(path)
|
source = File.read(path)
|
||||||
metadata = Plugin::Metadata.parse(source)
|
metadata = Plugin::Metadata.parse(source)
|
||||||
plugins << self.new(metadata, path)
|
plugins << self.new(metadata, path)
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe Plugin::Instance do
|
||||||
it "can find plugins correctly" do
|
it "can find plugins correctly" do
|
||||||
plugins = Plugin::Instance.find_all("#{Rails.root}/spec/fixtures/plugins")
|
plugins = Plugin::Instance.find_all("#{Rails.root}/spec/fixtures/plugins")
|
||||||
plugins.count.should == 1
|
plugins.count.should == 1
|
||||||
plugin =plugins[0]
|
plugin = plugins[0]
|
||||||
|
|
||||||
plugin.name.should == "plugin-name"
|
plugin.name.should == "plugin-name"
|
||||||
plugin.path.should == "#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb"
|
plugin.path.should == "#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue