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 ...@@ -41,7 +41,7 @@ EventMachine.run do
logger.debug("Starting up") logger.debug("Starting up")
r.psubscribe("*") r.psubscribe("*")
r.on(:pmessage) do |pattern, event, message| 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 noah.broker("#{event}|#{message}") unless noah.watchers == 0
#master_channel.push "#{event}|#{message}" #master_channel.push "#{event}|#{message}"
end end
......
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
require 'rubygems' require 'rubygems'
require 'logger'
require 'noah' require 'noah'
require 'noah/agents/http_agent' require 'noah/agents/http_agent'
require 'noah/agents/dummy_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 module Noah
class Agent class Agent
...@@ -48,5 +57,19 @@ module Noah ...@@ -48,5 +57,19 @@ module Noah
iter.next iter.next
end end
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
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