From fcd85b8a720b65d02d6920d997dd5f0d71a4691e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 21 Oct 2013 11:18:24 +0200 Subject: [PATCH] allow plugins to be symlinked --- lib/plugin/instance.rb | 3 ++- spec/components/plugin/instance_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index 60b2f1fef78..f88dea29539 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -10,7 +10,8 @@ class Plugin::Instance def self.find_all(parent_path) [].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) metadata = Plugin::Metadata.parse(source) plugins << self.new(metadata, path) diff --git a/spec/components/plugin/instance_spec.rb b/spec/components/plugin/instance_spec.rb index 7f543b99086..5f2a11cc38e 100644 --- a/spec/components/plugin/instance_spec.rb +++ b/spec/components/plugin/instance_spec.rb @@ -7,7 +7,7 @@ describe Plugin::Instance do it "can find plugins correctly" do plugins = Plugin::Instance.find_all("#{Rails.root}/spec/fixtures/plugins") plugins.count.should == 1 - plugin =plugins[0] + plugin = plugins[0] plugin.name.should == "plugin-name" plugin.path.should == "#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb"