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
7a37ea46
Commit
7a37ea46
authored
Mar 06, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working webhook-only agent. See
http://goo.gl/mGoSP
parent
59d284c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
noah-watcher.rb
bin/noah-watcher.rb
+12
-1
noah.rb
lib/noah.rb
+0
-1
No files found.
bin/noah-watcher.rb
View file @
7a37ea46
...
@@ -4,6 +4,8 @@ require 'rubygems'
...
@@ -4,6 +4,8 @@ require 'rubygems'
require
'logger'
require
'logger'
require
'optparse'
require
'optparse'
require
'em-hiredis'
require
'em-hiredis'
require
'eventmachine'
require
'em-http-request'
require
'thin'
require
'thin'
require
'noah'
require
'noah'
require
'json'
require
'json'
...
@@ -29,6 +31,15 @@ class EventMachine::NoahAgent
...
@@ -29,6 +31,15 @@ class EventMachine::NoahAgent
EM
::
Iterator
.
new
(
matches
).
each
do
|
watch
,
iter
|
EM
::
Iterator
.
new
(
matches
).
each
do
|
watch
,
iter
|
p
,
ep
=
Base64
.
decode64
(
watch
).
split
(
"|"
)
p
,
ep
=
Base64
.
decode64
(
watch
).
split
(
"|"
)
logger
.
info
(
"Sending message to:
#{
ep
}
for pattern:
#{
p
}
"
)
logger
.
info
(
"Sending message to:
#{
ep
}
for pattern:
#{
p
}
"
)
http
=
EM
::
HttpRequest
.
new
(
ep
,
:connection_timeout
=>
2
,
:inactivity_timeout
=>
4
).
post
:body
=>
message
http
.
callback
{
LOGGER
.
debug
(
"Message posted to
#{
ep
}
successfully"
)
#iter.next
}
http
.
errback
{
LOGGER
.
debug
(
"Something went wrong"
)
#iter.net
}
iter
.
next
iter
.
next
end
end
}
}
...
@@ -71,7 +82,7 @@ EventMachine.run do
...
@@ -71,7 +82,7 @@ EventMachine.run do
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\/watcher\/.*/
master_channel
.
push
"
#{
event
}
|
#{
message
}
"
master_channel
.
push
"
#{
event
}
|
#{
message
}
"
logger
.
debug
(
"
Publishing
[
#{
event
}
]"
)
logger
.
debug
(
"
Saw
[
#{
event
}
]"
)
end
end
sub
=
master_channel
.
subscribe
{
|
msg
|
sub
=
master_channel
.
subscribe
{
|
msg
|
...
...
lib/noah.rb
View file @
7a37ea46
...
@@ -9,7 +9,6 @@ end
...
@@ -9,7 +9,6 @@ end
require
'haml'
require
'haml'
require
'yaml'
require
'yaml'
require
'sinatra/base'
require
'sinatra/base'
require
'sinatra/namespace'
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'noah'
,
'validations'
)
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'noah'
,
'validations'
)
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'noah'
,
'models'
)
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'noah'
,
'models'
)
...
...
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