primer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +17 -0
- data/README.rdoc +74 -35
- data/example/README.rdoc +33 -23
- data/example/application.rb +2 -2
- data/example/console.rb +133 -0
- data/example/db/blog.sqlite3 +0 -0
- data/example/{models → db}/connection.rb +0 -0
- data/example/environment.rb +17 -4
- data/example/models/comment.rb +5 -0
- data/example/models/post.rb +5 -0
- data/example/script/setup_database.rb +8 -2
- data/example/views/comments.erb +6 -0
- data/example/views/layout.erb +1 -1
- data/example/views/show.erb +5 -1
- data/lib/primer/bus/amqp.rb +7 -5
- data/lib/primer/bus/amqp.rbc +1045 -0
- data/lib/primer/bus/memory.rbc +344 -0
- data/lib/primer/bus.rb +3 -2
- data/lib/primer/bus.rbc +872 -0
- data/lib/primer/cache/memory.rbc +1443 -0
- data/lib/primer/cache/redis.rb +2 -2
- data/lib/primer/cache/redis.rbc +1643 -0
- data/lib/primer/cache.rb +2 -16
- data/lib/primer/cache.rbc +1502 -0
- data/lib/primer/enabler.rbc +414 -0
- data/lib/primer/helpers.rbc +1438 -0
- data/lib/primer/lazyness.rb +63 -0
- data/lib/primer/lazyness.rbc +1442 -0
- data/lib/primer/real_time.rbc +1999 -0
- data/lib/primer/route_set.rb +1 -0
- data/lib/primer/route_set.rbc +1475 -0
- data/lib/primer/watcher/active_record_macros.rb +13 -3
- data/lib/primer/watcher/active_record_macros.rbc +1796 -0
- data/lib/primer/watcher/macros.rb +11 -14
- data/lib/primer/watcher/macros.rbc +1628 -0
- data/lib/primer/watcher.rb +2 -7
- data/lib/primer/watcher.rbc +1416 -0
- data/lib/primer/worker/active_record_agent.rb +30 -33
- data/lib/primer/worker/active_record_agent.rbc +2840 -0
- data/lib/primer/worker/changes_agent.rb +20 -0
- data/lib/primer/worker/changes_agent.rbc +578 -0
- data/lib/primer/worker.rb +20 -3
- data/lib/primer/worker.rbc +1254 -0
- data/lib/primer.rb +10 -2
- data/lib/primer.rbc +944 -0
- data/spec/db/test.sqlite3 +0 -0
- data/spec/models/artist.rb +3 -2
- data/spec/models/artist.rbc +288 -0
- data/spec/models/blog_post.rb +3 -1
- data/spec/models/blog_post.rbc +181 -0
- data/spec/models/calendar.rbc +209 -0
- data/spec/models/concert.rbc +211 -0
- data/spec/models/performance.rbc +177 -0
- data/spec/models/person.rb +1 -0
- data/spec/models/person.rbc +306 -0
- data/spec/models/watchable.rbc +363 -0
- data/spec/primer/bus_spec.rbc +940 -0
- data/spec/primer/cache_spec.rb +3 -3
- data/spec/primer/cache_spec.rbc +8535 -0
- data/spec/primer/helpers/erb_spec.rb +14 -14
- data/spec/primer/helpers/erb_spec.rbc +2485 -0
- data/spec/primer/lazyness_spec.rb +61 -0
- data/spec/primer/lazyness_spec.rbc +1408 -0
- data/spec/primer/watcher/active_record_spec.rb +15 -15
- data/spec/primer/watcher/active_record_spec.rbc +5202 -0
- data/spec/primer/watcher_spec.rbc +2645 -0
- data/spec/schema.rbc +775 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/spec_helper.rbc +1193 -0
- data/spec/templates/page.erb +0 -1
- metadata +77 -70
- data/example/models/blog_post.rb +0 -4
@@ -0,0 +1,344 @@
|
|
1
|
+
!RBIX
|
2
|
+
10310238139619683799
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
28
|
13
|
+
99
|
14
|
+
7
|
15
|
+
0
|
16
|
+
65
|
17
|
+
49
|
18
|
+
1
|
19
|
+
2
|
20
|
+
13
|
21
|
+
99
|
22
|
+
12
|
23
|
+
7
|
24
|
+
2
|
25
|
+
12
|
26
|
+
7
|
27
|
+
3
|
28
|
+
12
|
29
|
+
65
|
30
|
+
12
|
31
|
+
49
|
32
|
+
4
|
33
|
+
4
|
34
|
+
15
|
35
|
+
49
|
36
|
+
2
|
37
|
+
0
|
38
|
+
15
|
39
|
+
2
|
40
|
+
11
|
41
|
+
I
|
42
|
+
6
|
43
|
+
I
|
44
|
+
0
|
45
|
+
I
|
46
|
+
0
|
47
|
+
I
|
48
|
+
0
|
49
|
+
n
|
50
|
+
p
|
51
|
+
5
|
52
|
+
x
|
53
|
+
6
|
54
|
+
Primer
|
55
|
+
x
|
56
|
+
11
|
57
|
+
open_module
|
58
|
+
x
|
59
|
+
15
|
60
|
+
__module_init__
|
61
|
+
M
|
62
|
+
1
|
63
|
+
n
|
64
|
+
n
|
65
|
+
x
|
66
|
+
6
|
67
|
+
Primer
|
68
|
+
i
|
69
|
+
29
|
70
|
+
5
|
71
|
+
66
|
72
|
+
99
|
73
|
+
7
|
74
|
+
0
|
75
|
+
1
|
76
|
+
65
|
77
|
+
49
|
78
|
+
1
|
79
|
+
3
|
80
|
+
13
|
81
|
+
99
|
82
|
+
12
|
83
|
+
7
|
84
|
+
2
|
85
|
+
12
|
86
|
+
7
|
87
|
+
3
|
88
|
+
12
|
89
|
+
65
|
90
|
+
12
|
91
|
+
49
|
92
|
+
4
|
93
|
+
4
|
94
|
+
15
|
95
|
+
49
|
96
|
+
2
|
97
|
+
0
|
98
|
+
11
|
99
|
+
I
|
100
|
+
6
|
101
|
+
I
|
102
|
+
0
|
103
|
+
I
|
104
|
+
0
|
105
|
+
I
|
106
|
+
0
|
107
|
+
n
|
108
|
+
p
|
109
|
+
5
|
110
|
+
x
|
111
|
+
3
|
112
|
+
Bus
|
113
|
+
x
|
114
|
+
10
|
115
|
+
open_class
|
116
|
+
x
|
117
|
+
14
|
118
|
+
__class_init__
|
119
|
+
M
|
120
|
+
1
|
121
|
+
n
|
122
|
+
n
|
123
|
+
x
|
124
|
+
3
|
125
|
+
Bus
|
126
|
+
i
|
127
|
+
31
|
128
|
+
5
|
129
|
+
66
|
130
|
+
99
|
131
|
+
7
|
132
|
+
0
|
133
|
+
45
|
134
|
+
1
|
135
|
+
2
|
136
|
+
65
|
137
|
+
49
|
138
|
+
3
|
139
|
+
3
|
140
|
+
13
|
141
|
+
99
|
142
|
+
12
|
143
|
+
7
|
144
|
+
4
|
145
|
+
12
|
146
|
+
7
|
147
|
+
5
|
148
|
+
12
|
149
|
+
65
|
150
|
+
12
|
151
|
+
49
|
152
|
+
6
|
153
|
+
4
|
154
|
+
15
|
155
|
+
49
|
156
|
+
4
|
157
|
+
0
|
158
|
+
11
|
159
|
+
I
|
160
|
+
6
|
161
|
+
I
|
162
|
+
0
|
163
|
+
I
|
164
|
+
0
|
165
|
+
I
|
166
|
+
0
|
167
|
+
n
|
168
|
+
p
|
169
|
+
7
|
170
|
+
x
|
171
|
+
6
|
172
|
+
Memory
|
173
|
+
x
|
174
|
+
3
|
175
|
+
Bus
|
176
|
+
n
|
177
|
+
x
|
178
|
+
10
|
179
|
+
open_class
|
180
|
+
x
|
181
|
+
14
|
182
|
+
__class_init__
|
183
|
+
M
|
184
|
+
1
|
185
|
+
n
|
186
|
+
n
|
187
|
+
x
|
188
|
+
6
|
189
|
+
Memory
|
190
|
+
i
|
191
|
+
16
|
192
|
+
5
|
193
|
+
66
|
194
|
+
99
|
195
|
+
7
|
196
|
+
0
|
197
|
+
7
|
198
|
+
1
|
199
|
+
65
|
200
|
+
67
|
201
|
+
49
|
202
|
+
2
|
203
|
+
0
|
204
|
+
49
|
205
|
+
3
|
206
|
+
4
|
207
|
+
11
|
208
|
+
I
|
209
|
+
5
|
210
|
+
I
|
211
|
+
0
|
212
|
+
I
|
213
|
+
0
|
214
|
+
I
|
215
|
+
0
|
216
|
+
n
|
217
|
+
p
|
218
|
+
4
|
219
|
+
x
|
220
|
+
7
|
221
|
+
publish
|
222
|
+
M
|
223
|
+
1
|
224
|
+
n
|
225
|
+
n
|
226
|
+
x
|
227
|
+
7
|
228
|
+
publish
|
229
|
+
i
|
230
|
+
10
|
231
|
+
5
|
232
|
+
20
|
233
|
+
0
|
234
|
+
20
|
235
|
+
1
|
236
|
+
47
|
237
|
+
49
|
238
|
+
0
|
239
|
+
2
|
240
|
+
11
|
241
|
+
I
|
242
|
+
5
|
243
|
+
I
|
244
|
+
2
|
245
|
+
I
|
246
|
+
2
|
247
|
+
I
|
248
|
+
2
|
249
|
+
n
|
250
|
+
p
|
251
|
+
1
|
252
|
+
x
|
253
|
+
10
|
254
|
+
distribute
|
255
|
+
p
|
256
|
+
5
|
257
|
+
I
|
258
|
+
-1
|
259
|
+
I
|
260
|
+
5
|
261
|
+
I
|
262
|
+
0
|
263
|
+
I
|
264
|
+
6
|
265
|
+
I
|
266
|
+
a
|
267
|
+
x
|
268
|
+
55
|
269
|
+
/Users/jcoglan/projects/primer/lib/primer/bus/memory.rb
|
270
|
+
p
|
271
|
+
2
|
272
|
+
x
|
273
|
+
5
|
274
|
+
topic
|
275
|
+
x
|
276
|
+
7
|
277
|
+
message
|
278
|
+
x
|
279
|
+
17
|
280
|
+
method_visibility
|
281
|
+
x
|
282
|
+
15
|
283
|
+
add_defn_method
|
284
|
+
p
|
285
|
+
3
|
286
|
+
I
|
287
|
+
2
|
288
|
+
I
|
289
|
+
5
|
290
|
+
I
|
291
|
+
10
|
292
|
+
x
|
293
|
+
55
|
294
|
+
/Users/jcoglan/projects/primer/lib/primer/bus/memory.rb
|
295
|
+
p
|
296
|
+
0
|
297
|
+
x
|
298
|
+
13
|
299
|
+
attach_method
|
300
|
+
p
|
301
|
+
3
|
302
|
+
I
|
303
|
+
2
|
304
|
+
I
|
305
|
+
4
|
306
|
+
I
|
307
|
+
1f
|
308
|
+
x
|
309
|
+
55
|
310
|
+
/Users/jcoglan/projects/primer/lib/primer/bus/memory.rb
|
311
|
+
p
|
312
|
+
0
|
313
|
+
x
|
314
|
+
13
|
315
|
+
attach_method
|
316
|
+
p
|
317
|
+
3
|
318
|
+
I
|
319
|
+
2
|
320
|
+
I
|
321
|
+
2
|
322
|
+
I
|
323
|
+
1d
|
324
|
+
x
|
325
|
+
55
|
326
|
+
/Users/jcoglan/projects/primer/lib/primer/bus/memory.rb
|
327
|
+
p
|
328
|
+
0
|
329
|
+
x
|
330
|
+
13
|
331
|
+
attach_method
|
332
|
+
p
|
333
|
+
3
|
334
|
+
I
|
335
|
+
0
|
336
|
+
I
|
337
|
+
1
|
338
|
+
I
|
339
|
+
1c
|
340
|
+
x
|
341
|
+
55
|
342
|
+
/Users/jcoglan/projects/primer/lib/primer/bus/memory.rb
|
343
|
+
p
|
344
|
+
0
|
data/lib/primer/bus.rb
CHANGED
@@ -9,16 +9,17 @@ module Primer
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def distribute(topic, message)
|
12
|
+
topic = topic.to_s
|
12
13
|
return unless @listeners.has_key?(topic)
|
13
14
|
@listeners[topic].each { |cb| cb.call(message) }
|
14
15
|
end
|
15
16
|
|
16
17
|
def subscribe(topic, &listener)
|
17
|
-
@listeners[topic].add(listener)
|
18
|
+
@listeners[topic.to_s].add(listener)
|
18
19
|
end
|
19
20
|
|
20
21
|
def unsubscribe(topic, &listener)
|
21
|
-
@listeners[topic].delete(listener)
|
22
|
+
@listeners[topic.to_s].delete(listener)
|
22
23
|
end
|
23
24
|
|
24
25
|
def unsubscribe_all
|