Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
c4854db1
Commit
c4854db1
authored
Mar 25, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding basic support for external gem plugins
parent
40c4c205
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
noah-watcher.rb
bin/noah-watcher.rb
+1
-1
agent.rb
lib/noah/agent.rb
+25
-2
No files found.
bin/noah-watcher.rb
View file @
c4854db1
...
...
@@ -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\/watcher
s
\/.*/
noah
.
broker
(
"
#{
event
}
|
#{
message
}
"
)
unless
noah
.
watchers
==
0
#master_channel.push "#{event}|#{message}"
end
...
...
lib/noah/agent.rb
View file @
c4854db1
$:
.
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment