lib/onering/plugins/reporter.rb in onering-client-0.0.95 vs lib/onering/plugins/reporter.rb in onering-client-0.0.96
- old
+ new
@@ -28,15 +28,27 @@
attr_reader :facter_path
def setup(config={})
@options = config
@facter_path = DEFAULT_FACTER_PATH
+ @detected_gems = []
@path = [*Onering::Config.get('reporter.plugin_path',[])]
@path += DEFAULT_PLUGIN_PATH
+
+ begin
+ @detected_gems = (Gem::Specification.all.collect{|i|
+ i.name
+ }.select{|i|
+ i =~ /^onering-report-/
+ } - DEFAULT_PLUGIN_GEMNAMES)
+ rescue Exception => e
+ Onering::Logger.warn("Unable to detect plugin gems: #{e.class.name} - #{e.message}", "Onering::Reporter")
+ end
+
# add gem paths to the @path
- ([*Onering::Config.get('reporter.plugin_gems',[])]+DEFAULT_PLUGIN_GEMNAMES).compact.each do |g|
+ ([*Onering::Config.get('reporter.plugin_gems',[])]+@detected_gems+DEFAULT_PLUGIN_GEMNAMES).compact.each do |g|
begin
p = File.join(Util.gem_path(g), 'lib')
@path << File.join(p, 'reporter')
@facter_path << File.join(p, 'facter')
rescue Gem::LoadError => e