Commit c4854db1 authored by John E. Vincent's avatar John E. Vincent

Adding basic support for external gem plugins

parent 40c4c205
......@@ -41,7 +41,7 @@ EventMachine.run do
logger.debug("Starting up")
r.psubscribe("*")
r.on(:pmessage) do |pattern, event, message|
noah.reread_watchers if event =~ /^\/\/noah\/watcher\/.*/
noah.reread_watchers if event =~ /^\/\/noah\/watchers\/.*/
noah.broker("#{event}|#{message}") unless noah.watchers == 0
#master_channel.push "#{event}|#{message}"
end
......
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
require 'rubygems'
require 'logger'
require 'noah'
require 'noah/agents/http_agent'
require 'noah/agents/dummy_agent'
begin
candidates = []
Gem.source_index.find_all {|g| candidates << g[1].name if g[1].name =~ /^noah-agents-.*/}
candidates.each do |c|
require c
end
rescue LoadError
puts "Unable to load #{c}"
end
module Noah
class Agent
......@@ -11,7 +20,7 @@ module Noah
@@watchers = Noah::Watcher.watch_list
@@agents = Noah::Watchers.agents
def initialize
@logger = Noah::Log.logger
@logger.progname = self.class.name
......@@ -48,5 +57,19 @@ module Noah
iter.next
end
end
private
def find_and_register_agents
candidates = []
Gem.source_index.find_all {|g| candidates << g[1].name if g[1].name =~ /^noah-agent-.*/}
candidates.each do |c|
begin
require c
rescue LoadError
Noah::Log.logger.warn("Unable to load #{c}")
end
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment