noah 0.2-jruby → 0.2.1-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/bin/noah-watcher.rb CHANGED
@@ -14,7 +14,8 @@ begin
14
14
  require 'noah'
15
15
  require 'noah/agent'
16
16
  require 'json'
17
- rescue LoadError
17
+ rescue LoadError => e
18
+ puts e.message
18
19
  puts HELP
19
20
  exit
20
21
  end
data/config.ru CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require File.join('.', 'lib','noah')
3
3
  ## Uncomment the following to hardcode a redis url
4
- ENV['REDIS_URL'] = "redis://localhost:6379/1"
4
+ ENV['REDIS_URL'] = "redis://localhost:6379/0"
5
5
  noah = Noah::App.new
6
6
  run noah
data/lib/noah/agent.rb CHANGED
@@ -9,9 +9,6 @@ module Noah
9
9
  class Agent
10
10
  include EM::Deferrable
11
11
 
12
- Noah::Agents::HttpAgent.register
13
- Noah::Agents::DummyAgent.register
14
-
15
12
  @@watchers = Noah::Watcher.watch_list
16
13
  @@agents = Noah::Watchers.agents
17
14
 
@@ -0,0 +1,17 @@
1
+ require 'logger'
2
+ require 'logger'
3
+
4
+ module Noah::Agents
5
+ module Base
6
+ class << self
7
+ include EM::Deferrable
8
+
9
+ PREFIX = "base"
10
+ NAME = "base-agent"
11
+ end
12
+
13
+ def self.included(base)
14
+ Noah::Watchers.register_agent(base)
15
+ end
16
+ end
17
+ end
@@ -1,14 +1,12 @@
1
+ require File.join(File.dirname(__FILE__), 'base_agent')
2
+
1
3
  module Noah::Agents
2
4
  class DummyAgent
3
- include EM::Deferrable
5
+ include Noah::Agents::Base
4
6
 
5
7
  PREFIX = "dummy"
6
8
  NAME = "dummy"
7
9
 
8
- def self.register
9
- Noah::Watchers.register_agent(self)
10
- end
11
-
12
10
  def self.notify(event, message, watch_list)
13
11
  logger = LOGGER
14
12
  logger.info("#{NAME}: Worker initiated")
@@ -1,16 +1,12 @@
1
- require 'logger'
1
+ require File.join(File.dirname(__FILE__), 'base_agent')
2
2
 
3
3
  module Noah::Agents
4
4
  class HttpAgent
5
- include EM::Deferrable
5
+ include Noah::Agents::Base
6
6
 
7
7
  PREFIX = "http"
8
8
  NAME = "http"
9
9
 
10
- def self.register
11
- Noah::Watchers.register_agent(self)
12
- end
13
-
14
10
  def self.notify(event, message, watch_list)
15
11
  logger = LOGGER
16
12
  logger.info("#{NAME}: Worker initiated")
@@ -28,8 +24,8 @@ module Noah::Agents
28
24
  http.errback {
29
25
  logger.error("#{NAME}: Something went wrong with #{ep}")
30
26
  }
31
- iter.next
32
27
  end
28
+ iter.next
33
29
  end
34
30
  end
35
31
 
data/lib/noah/models.rb CHANGED
@@ -42,7 +42,8 @@ module Noah
42
42
 
43
43
  protected
44
44
  def patternize_me
45
- "//noah/#{self.class_to_lower}/#{name}"
45
+ name.match(/^\//) ? n = name.gsub(/^\//, '') : n = name
46
+ "//noah/#{self.class_to_lower}/#{n}"
46
47
  end
47
48
 
48
49
  def stash_name
data/lib/noah/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Noah
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,11 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noah
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- version: "0.2"
4
+ prerelease:
5
+ version: 0.2.1
9
6
  platform: jruby
10
7
  authors:
11
8
  - John E. Vincent
@@ -13,22 +10,17 @@ autorequire:
13
10
  bindir: bin
14
11
  cert_chain: []
15
12
 
16
- date: 2011-03-15 00:00:00 -04:00
13
+ date: 2011-03-16 00:00:00 -04:00
17
14
  default_executable:
18
15
  dependencies:
19
16
  - !ruby/object:Gem::Dependency
20
17
  name: eventmachine
21
18
  prerelease: false
22
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
23
21
  requirements:
24
22
  - - "="
25
23
  - !ruby/object:Gem::Version
26
- segments:
27
- - 1
28
- - 0
29
- - 0
30
- - beta
31
- - 3
32
24
  version: 1.0.0.beta.3
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -36,15 +28,10 @@ dependencies:
36
28
  name: em-http-request
37
29
  prerelease: false
38
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
39
32
  requirements:
40
33
  - - "="
41
34
  - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 0
45
- - 0
46
- - beta
47
- - 3
48
35
  version: 1.0.0.beta.3
49
36
  type: :runtime
50
37
  version_requirements: *id002
@@ -52,13 +39,10 @@ dependencies:
52
39
  name: redis
53
40
  prerelease: false
54
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
55
43
  requirements:
56
44
  - - "="
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 2
60
- - 1
61
- - 1
62
46
  version: 2.1.1
63
47
  type: :runtime
64
48
  version_requirements: *id003
@@ -66,13 +50,10 @@ dependencies:
66
50
  name: nest
67
51
  prerelease: false
68
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
69
54
  requirements:
70
55
  - - "="
71
56
  - !ruby/object:Gem::Version
72
- segments:
73
- - 1
74
- - 1
75
- - 0
76
57
  version: 1.1.0
77
58
  type: :runtime
78
59
  version_requirements: *id004
@@ -80,13 +61,10 @@ dependencies:
80
61
  name: rack
81
62
  prerelease: false
82
63
  requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
83
65
  requirements:
84
66
  - - "="
85
67
  - !ruby/object:Gem::Version
86
- segments:
87
- - 1
88
- - 2
89
- - 1
90
68
  version: 1.2.1
91
69
  type: :runtime
92
70
  version_requirements: *id005
@@ -94,13 +72,10 @@ dependencies:
94
72
  name: tilt
95
73
  prerelease: false
96
74
  requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
97
76
  requirements:
98
77
  - - "="
99
78
  - !ruby/object:Gem::Version
100
- segments:
101
- - 1
102
- - 2
103
- - 2
104
79
  version: 1.2.2
105
80
  type: :runtime
106
81
  version_requirements: *id006
@@ -108,13 +83,10 @@ dependencies:
108
83
  name: sinatra
109
84
  prerelease: false
110
85
  requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
111
87
  requirements:
112
88
  - - "="
113
89
  - !ruby/object:Gem::Version
114
- segments:
115
- - 1
116
- - 1
117
- - 2
118
90
  version: 1.1.2
119
91
  type: :runtime
120
92
  version_requirements: *id007
@@ -122,13 +94,10 @@ dependencies:
122
94
  name: ohm
123
95
  prerelease: false
124
96
  requirement: &id008 !ruby/object:Gem::Requirement
97
+ none: false
125
98
  requirements:
126
99
  - - "="
127
100
  - !ruby/object:Gem::Version
128
- segments:
129
- - 0
130
- - 1
131
- - 3
132
101
  version: 0.1.3
133
102
  type: :runtime
134
103
  version_requirements: *id008
@@ -136,13 +105,10 @@ dependencies:
136
105
  name: ohm-contrib
137
106
  prerelease: false
138
107
  requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
139
109
  requirements:
140
110
  - - "="
141
111
  - !ruby/object:Gem::Version
142
- segments:
143
- - 0
144
- - 1
145
- - 1
146
112
  version: 0.1.1
147
113
  type: :runtime
148
114
  version_requirements: *id009
@@ -150,13 +116,10 @@ dependencies:
150
116
  name: haml
151
117
  prerelease: false
152
118
  requirement: &id010 !ruby/object:Gem::Requirement
119
+ none: false
153
120
  requirements:
154
121
  - - "="
155
122
  - !ruby/object:Gem::Version
156
- segments:
157
- - 3
158
- - 0
159
- - 25
160
123
  version: 3.0.25
161
124
  type: :runtime
162
125
  version_requirements: *id010
@@ -164,13 +127,10 @@ dependencies:
164
127
  name: vegas
165
128
  prerelease: false
166
129
  requirement: &id011 !ruby/object:Gem::Requirement
130
+ none: false
167
131
  requirements:
168
132
  - - "="
169
133
  - !ruby/object:Gem::Version
170
- segments:
171
- - 0
172
- - 1
173
- - 8
174
134
  version: 0.1.8
175
135
  type: :runtime
176
136
  version_requirements: *id011
@@ -178,11 +138,10 @@ dependencies:
178
138
  name: jruby-openssl
179
139
  prerelease: false
180
140
  requirement: &id012 !ruby/object:Gem::Requirement
141
+ none: false
181
142
  requirements:
182
143
  - - ">="
183
144
  - !ruby/object:Gem::Version
184
- segments:
185
- - 0
186
145
  version: "0"
187
146
  type: :runtime
188
147
  version_requirements: *id012
@@ -190,11 +149,10 @@ dependencies:
190
149
  name: json
191
150
  prerelease: false
192
151
  requirement: &id013 !ruby/object:Gem::Requirement
152
+ none: false
193
153
  requirements:
194
154
  - - ">="
195
155
  - !ruby/object:Gem::Version
196
- segments:
197
- - 0
198
156
  version: "0"
199
157
  type: :runtime
200
158
  version_requirements: *id013
@@ -202,13 +160,10 @@ dependencies:
202
160
  name: warbler
203
161
  prerelease: false
204
162
  requirement: &id014 !ruby/object:Gem::Requirement
163
+ none: false
205
164
  requirements:
206
165
  - - "="
207
166
  - !ruby/object:Gem::Version
208
- segments:
209
- - 1
210
- - 2
211
- - 1
212
167
  version: 1.2.1
213
168
  type: :development
214
169
  version_requirements: *id014
@@ -216,13 +171,10 @@ dependencies:
216
171
  name: diff-lcs
217
172
  prerelease: false
218
173
  requirement: &id015 !ruby/object:Gem::Requirement
174
+ none: false
219
175
  requirements:
220
176
  - - "="
221
177
  - !ruby/object:Gem::Version
222
- segments:
223
- - 1
224
- - 1
225
- - 2
226
178
  version: 1.1.2
227
179
  type: :development
228
180
  version_requirements: *id015
@@ -230,13 +182,10 @@ dependencies:
230
182
  name: sinatra-reloader
231
183
  prerelease: false
232
184
  requirement: &id016 !ruby/object:Gem::Requirement
185
+ none: false
233
186
  requirements:
234
187
  - - "="
235
188
  - !ruby/object:Gem::Version
236
- segments:
237
- - 0
238
- - 5
239
- - 0
240
189
  version: 0.5.0
241
190
  type: :development
242
191
  version_requirements: *id016
@@ -244,12 +193,10 @@ dependencies:
244
193
  name: rspec
245
194
  prerelease: false
246
195
  requirement: &id017 !ruby/object:Gem::Requirement
196
+ none: false
247
197
  requirements:
248
198
  - - ~>
249
199
  - !ruby/object:Gem::Version
250
- segments:
251
- - 2
252
- - 5
253
200
  version: "2.5"
254
201
  type: :development
255
202
  version_requirements: *id017
@@ -257,13 +204,10 @@ dependencies:
257
204
  name: rcov
258
205
  prerelease: false
259
206
  requirement: &id018 !ruby/object:Gem::Requirement
207
+ none: false
260
208
  requirements:
261
209
  - - "="
262
210
  - !ruby/object:Gem::Version
263
- segments:
264
- - 0
265
- - 9
266
- - 9
267
211
  version: 0.9.9
268
212
  type: :development
269
213
  version_requirements: *id018
@@ -271,13 +215,10 @@ dependencies:
271
215
  name: rack-test
272
216
  prerelease: false
273
217
  requirement: &id019 !ruby/object:Gem::Requirement
218
+ none: false
274
219
  requirements:
275
220
  - - "="
276
221
  - !ruby/object:Gem::Version
277
- segments:
278
- - 0
279
- - 5
280
- - 7
281
222
  version: 0.5.7
282
223
  type: :development
283
224
  version_requirements: *id019
@@ -323,6 +264,7 @@ files:
323
264
  - examples/websocket.rb
324
265
  - lib/noah.rb
325
266
  - lib/noah/agent.rb
267
+ - lib/noah/agents/base_agent.rb
326
268
  - lib/noah/agents/dummy_agent.rb
327
269
  - lib/noah/agents/http_agent.rb
328
270
  - lib/noah/app.rb
@@ -377,23 +319,21 @@ rdoc_options: []
377
319
  require_paths:
378
320
  - lib
379
321
  required_ruby_version: !ruby/object:Gem::Requirement
322
+ none: false
380
323
  requirements:
381
324
  - - ">="
382
325
  - !ruby/object:Gem::Version
383
- segments:
384
- - 0
385
326
  version: "0"
386
327
  required_rubygems_version: !ruby/object:Gem::Requirement
328
+ none: false
387
329
  requirements:
388
330
  - - ">="
389
331
  - !ruby/object:Gem::Version
390
- segments:
391
- - 0
392
332
  version: "0"
393
333
  requirements: []
394
334
 
395
335
  rubyforge_project: noah
396
- rubygems_version: 1.3.6
336
+ rubygems_version: 1.5.1
397
337
  signing_key:
398
338
  specification_version: 3
399
339
  summary: Application registry based on Apache Zookeeper