primer 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/History.txt +17 -0
  2. data/README.rdoc +74 -35
  3. data/example/README.rdoc +33 -23
  4. data/example/application.rb +2 -2
  5. data/example/console.rb +133 -0
  6. data/example/db/blog.sqlite3 +0 -0
  7. data/example/{models → db}/connection.rb +0 -0
  8. data/example/environment.rb +17 -4
  9. data/example/models/comment.rb +5 -0
  10. data/example/models/post.rb +5 -0
  11. data/example/script/setup_database.rb +8 -2
  12. data/example/views/comments.erb +6 -0
  13. data/example/views/layout.erb +1 -1
  14. data/example/views/show.erb +5 -1
  15. data/lib/primer/bus/amqp.rb +7 -5
  16. data/lib/primer/bus/amqp.rbc +1045 -0
  17. data/lib/primer/bus/memory.rbc +344 -0
  18. data/lib/primer/bus.rb +3 -2
  19. data/lib/primer/bus.rbc +872 -0
  20. data/lib/primer/cache/memory.rbc +1443 -0
  21. data/lib/primer/cache/redis.rb +2 -2
  22. data/lib/primer/cache/redis.rbc +1643 -0
  23. data/lib/primer/cache.rb +2 -16
  24. data/lib/primer/cache.rbc +1502 -0
  25. data/lib/primer/enabler.rbc +414 -0
  26. data/lib/primer/helpers.rbc +1438 -0
  27. data/lib/primer/lazyness.rb +63 -0
  28. data/lib/primer/lazyness.rbc +1442 -0
  29. data/lib/primer/real_time.rbc +1999 -0
  30. data/lib/primer/route_set.rb +1 -0
  31. data/lib/primer/route_set.rbc +1475 -0
  32. data/lib/primer/watcher/active_record_macros.rb +13 -3
  33. data/lib/primer/watcher/active_record_macros.rbc +1796 -0
  34. data/lib/primer/watcher/macros.rb +11 -14
  35. data/lib/primer/watcher/macros.rbc +1628 -0
  36. data/lib/primer/watcher.rb +2 -7
  37. data/lib/primer/watcher.rbc +1416 -0
  38. data/lib/primer/worker/active_record_agent.rb +30 -33
  39. data/lib/primer/worker/active_record_agent.rbc +2840 -0
  40. data/lib/primer/worker/changes_agent.rb +20 -0
  41. data/lib/primer/worker/changes_agent.rbc +578 -0
  42. data/lib/primer/worker.rb +20 -3
  43. data/lib/primer/worker.rbc +1254 -0
  44. data/lib/primer.rb +10 -2
  45. data/lib/primer.rbc +944 -0
  46. data/spec/db/test.sqlite3 +0 -0
  47. data/spec/models/artist.rb +3 -2
  48. data/spec/models/artist.rbc +288 -0
  49. data/spec/models/blog_post.rb +3 -1
  50. data/spec/models/blog_post.rbc +181 -0
  51. data/spec/models/calendar.rbc +209 -0
  52. data/spec/models/concert.rbc +211 -0
  53. data/spec/models/performance.rbc +177 -0
  54. data/spec/models/person.rb +1 -0
  55. data/spec/models/person.rbc +306 -0
  56. data/spec/models/watchable.rbc +363 -0
  57. data/spec/primer/bus_spec.rbc +940 -0
  58. data/spec/primer/cache_spec.rb +3 -3
  59. data/spec/primer/cache_spec.rbc +8535 -0
  60. data/spec/primer/helpers/erb_spec.rb +14 -14
  61. data/spec/primer/helpers/erb_spec.rbc +2485 -0
  62. data/spec/primer/lazyness_spec.rb +61 -0
  63. data/spec/primer/lazyness_spec.rbc +1408 -0
  64. data/spec/primer/watcher/active_record_spec.rb +15 -15
  65. data/spec/primer/watcher/active_record_spec.rbc +5202 -0
  66. data/spec/primer/watcher_spec.rbc +2645 -0
  67. data/spec/schema.rbc +775 -0
  68. data/spec/spec_helper.rb +3 -0
  69. data/spec/spec_helper.rbc +1193 -0
  70. data/spec/templates/page.erb +0 -1
  71. metadata +77 -70
  72. data/example/models/blog_post.rb +0 -4
Binary file
@@ -1,10 +1,11 @@
1
1
  class Artist < ActiveRecord::Base
2
+ include Primer::Watcher
3
+ include Primer::Lazyness
4
+
2
5
  has_many :performances
3
6
  has_many :concerts, :through => :performances
4
7
 
5
8
  belongs_to :calendar
6
9
  has_many :upcoming_gigs, :through => :calendar, :source => :gigs
7
-
8
- include Primer::Watcher
9
10
  end
10
11
 
@@ -0,0 +1,288 @@
1
+ !RBIX
2
+ 10310238139619683799
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 33
13
+ 99
14
+ 7
15
+ 0
16
+ 45
17
+ 1
18
+ 2
19
+ 43
20
+ 3
21
+ 65
22
+ 49
23
+ 4
24
+ 3
25
+ 13
26
+ 99
27
+ 12
28
+ 7
29
+ 5
30
+ 12
31
+ 7
32
+ 6
33
+ 12
34
+ 65
35
+ 12
36
+ 49
37
+ 7
38
+ 4
39
+ 15
40
+ 49
41
+ 5
42
+ 0
43
+ 15
44
+ 2
45
+ 11
46
+ I
47
+ 6
48
+ I
49
+ 0
50
+ I
51
+ 0
52
+ I
53
+ 0
54
+ n
55
+ p
56
+ 8
57
+ x
58
+ 6
59
+ Artist
60
+ x
61
+ 12
62
+ ActiveRecord
63
+ n
64
+ x
65
+ 4
66
+ Base
67
+ x
68
+ 10
69
+ open_class
70
+ x
71
+ 14
72
+ __class_init__
73
+ M
74
+ 1
75
+ n
76
+ n
77
+ x
78
+ 6
79
+ Artist
80
+ i
81
+ 97
82
+ 5
83
+ 66
84
+ 5
85
+ 7
86
+ 0
87
+ 47
88
+ 49
89
+ 1
90
+ 1
91
+ 15
92
+ 5
93
+ 7
94
+ 2
95
+ 44
96
+ 43
97
+ 3
98
+ 79
99
+ 49
100
+ 4
101
+ 1
102
+ 13
103
+ 7
104
+ 5
105
+ 7
106
+ 0
107
+ 49
108
+ 6
109
+ 2
110
+ 15
111
+ 47
112
+ 49
113
+ 1
114
+ 2
115
+ 15
116
+ 5
117
+ 7
118
+ 7
119
+ 47
120
+ 49
121
+ 8
122
+ 1
123
+ 15
124
+ 5
125
+ 7
126
+ 9
127
+ 44
128
+ 43
129
+ 3
130
+ 80
131
+ 49
132
+ 4
133
+ 1
134
+ 13
135
+ 7
136
+ 5
137
+ 7
138
+ 7
139
+ 49
140
+ 6
141
+ 2
142
+ 15
143
+ 13
144
+ 7
145
+ 10
146
+ 7
147
+ 11
148
+ 49
149
+ 6
150
+ 2
151
+ 15
152
+ 47
153
+ 49
154
+ 1
155
+ 2
156
+ 15
157
+ 5
158
+ 45
159
+ 12
160
+ 13
161
+ 43
162
+ 14
163
+ 47
164
+ 49
165
+ 15
166
+ 1
167
+ 15
168
+ 5
169
+ 45
170
+ 12
171
+ 16
172
+ 43
173
+ 17
174
+ 47
175
+ 49
176
+ 15
177
+ 1
178
+ 11
179
+ I
180
+ 6
181
+ I
182
+ 0
183
+ I
184
+ 0
185
+ I
186
+ 0
187
+ n
188
+ p
189
+ 18
190
+ x
191
+ 12
192
+ performances
193
+ x
194
+ 8
195
+ has_many
196
+ x
197
+ 8
198
+ concerts
199
+ x
200
+ 4
201
+ Hash
202
+ x
203
+ 16
204
+ new_from_literal
205
+ x
206
+ 7
207
+ through
208
+ x
209
+ 3
210
+ []=
211
+ x
212
+ 8
213
+ calendar
214
+ x
215
+ 10
216
+ belongs_to
217
+ x
218
+ 13
219
+ upcoming_gigs
220
+ x
221
+ 6
222
+ source
223
+ x
224
+ 4
225
+ gigs
226
+ x
227
+ 6
228
+ Primer
229
+ n
230
+ x
231
+ 7
232
+ Watcher
233
+ x
234
+ 7
235
+ include
236
+ n
237
+ x
238
+ 8
239
+ Lazyness
240
+ p
241
+ 13
242
+ I
243
+ 2
244
+ I
245
+ 2
246
+ I
247
+ a
248
+ I
249
+ 3
250
+ I
251
+ 22
252
+ I
253
+ 5
254
+ I
255
+ 2a
256
+ I
257
+ 6
258
+ I
259
+ 4b
260
+ I
261
+ 8
262
+ I
263
+ 56
264
+ I
265
+ 9
266
+ I
267
+ 61
268
+ x
269
+ 52
270
+ /Users/jcoglan/projects/primer/spec/models/artist.rb
271
+ p
272
+ 0
273
+ x
274
+ 13
275
+ attach_method
276
+ p
277
+ 3
278
+ I
279
+ 0
280
+ I
281
+ 1
282
+ I
283
+ 21
284
+ x
285
+ 52
286
+ /Users/jcoglan/projects/primer/spec/models/artist.rb
287
+ p
288
+ 0
@@ -1,5 +1,7 @@
1
1
  class BlogPost < ActiveRecord::Base
2
- belongs_to :person
3
2
  include Primer::Watcher
3
+ include Primer::Lazyness
4
+
5
+ belongs_to :person
4
6
  end
5
7
 
@@ -0,0 +1,181 @@
1
+ !RBIX
2
+ 10310238139619683799
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 33
13
+ 99
14
+ 7
15
+ 0
16
+ 45
17
+ 1
18
+ 2
19
+ 43
20
+ 3
21
+ 65
22
+ 49
23
+ 4
24
+ 3
25
+ 13
26
+ 99
27
+ 12
28
+ 7
29
+ 5
30
+ 12
31
+ 7
32
+ 6
33
+ 12
34
+ 65
35
+ 12
36
+ 49
37
+ 7
38
+ 4
39
+ 15
40
+ 49
41
+ 5
42
+ 0
43
+ 15
44
+ 2
45
+ 11
46
+ I
47
+ 6
48
+ I
49
+ 0
50
+ I
51
+ 0
52
+ I
53
+ 0
54
+ n
55
+ p
56
+ 8
57
+ x
58
+ 8
59
+ BlogPost
60
+ x
61
+ 12
62
+ ActiveRecord
63
+ n
64
+ x
65
+ 4
66
+ Base
67
+ x
68
+ 10
69
+ open_class
70
+ x
71
+ 14
72
+ __class_init__
73
+ M
74
+ 1
75
+ n
76
+ n
77
+ x
78
+ 8
79
+ BlogPost
80
+ i
81
+ 32
82
+ 5
83
+ 66
84
+ 5
85
+ 7
86
+ 0
87
+ 47
88
+ 49
89
+ 1
90
+ 1
91
+ 15
92
+ 5
93
+ 45
94
+ 2
95
+ 3
96
+ 43
97
+ 4
98
+ 47
99
+ 49
100
+ 5
101
+ 1
102
+ 15
103
+ 5
104
+ 45
105
+ 2
106
+ 6
107
+ 43
108
+ 7
109
+ 47
110
+ 49
111
+ 5
112
+ 1
113
+ 11
114
+ I
115
+ 2
116
+ I
117
+ 0
118
+ I
119
+ 0
120
+ I
121
+ 0
122
+ n
123
+ p
124
+ 8
125
+ x
126
+ 6
127
+ person
128
+ x
129
+ 10
130
+ belongs_to
131
+ x
132
+ 6
133
+ Primer
134
+ n
135
+ x
136
+ 7
137
+ Watcher
138
+ x
139
+ 7
140
+ include
141
+ n
142
+ x
143
+ 8
144
+ Lazyness
145
+ p
146
+ 7
147
+ I
148
+ 2
149
+ I
150
+ 2
151
+ I
152
+ a
153
+ I
154
+ 3
155
+ I
156
+ 15
157
+ I
158
+ 4
159
+ I
160
+ 20
161
+ x
162
+ 55
163
+ /Users/jcoglan/projects/primer/spec/models/blog_post.rb
164
+ p
165
+ 0
166
+ x
167
+ 13
168
+ attach_method
169
+ p
170
+ 3
171
+ I
172
+ 0
173
+ I
174
+ 1
175
+ I
176
+ 21
177
+ x
178
+ 55
179
+ /Users/jcoglan/projects/primer/spec/models/blog_post.rb
180
+ p
181
+ 0
@@ -0,0 +1,209 @@
1
+ !RBIX
2
+ 10310238139619683799
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 33
13
+ 99
14
+ 7
15
+ 0
16
+ 45
17
+ 1
18
+ 2
19
+ 43
20
+ 3
21
+ 65
22
+ 49
23
+ 4
24
+ 3
25
+ 13
26
+ 99
27
+ 12
28
+ 7
29
+ 5
30
+ 12
31
+ 7
32
+ 6
33
+ 12
34
+ 65
35
+ 12
36
+ 49
37
+ 7
38
+ 4
39
+ 15
40
+ 49
41
+ 5
42
+ 0
43
+ 15
44
+ 2
45
+ 11
46
+ I
47
+ 6
48
+ I
49
+ 0
50
+ I
51
+ 0
52
+ I
53
+ 0
54
+ n
55
+ p
56
+ 8
57
+ x
58
+ 8
59
+ Calendar
60
+ x
61
+ 12
62
+ ActiveRecord
63
+ n
64
+ x
65
+ 4
66
+ Base
67
+ x
68
+ 10
69
+ open_class
70
+ x
71
+ 14
72
+ __class_init__
73
+ M
74
+ 1
75
+ n
76
+ n
77
+ x
78
+ 8
79
+ Calendar
80
+ i
81
+ 46
82
+ 5
83
+ 66
84
+ 5
85
+ 7
86
+ 0
87
+ 47
88
+ 49
89
+ 1
90
+ 1
91
+ 15
92
+ 5
93
+ 7
94
+ 2
95
+ 44
96
+ 43
97
+ 3
98
+ 79
99
+ 49
100
+ 4
101
+ 1
102
+ 13
103
+ 7
104
+ 5
105
+ 7
106
+ 6
107
+ 64
108
+ 49
109
+ 7
110
+ 2
111
+ 15
112
+ 47
113
+ 49
114
+ 1
115
+ 2
116
+ 15
117
+ 5
118
+ 45
119
+ 8
120
+ 9
121
+ 43
122
+ 10
123
+ 47
124
+ 49
125
+ 11
126
+ 1
127
+ 11
128
+ I
129
+ 6
130
+ I
131
+ 0
132
+ I
133
+ 0
134
+ I
135
+ 0
136
+ n
137
+ p
138
+ 12
139
+ x
140
+ 7
141
+ artists
142
+ x
143
+ 8
144
+ has_many
145
+ x
146
+ 4
147
+ gigs
148
+ x
149
+ 4
150
+ Hash
151
+ x
152
+ 16
153
+ new_from_literal
154
+ x
155
+ 10
156
+ class_name
157
+ s
158
+ 7
159
+ Concert
160
+ x
161
+ 3
162
+ []=
163
+ x
164
+ 6
165
+ Primer
166
+ n
167
+ x
168
+ 7
169
+ Watcher
170
+ x
171
+ 7
172
+ include
173
+ p
174
+ 7
175
+ I
176
+ 2
177
+ I
178
+ 2
179
+ I
180
+ a
181
+ I
182
+ 3
183
+ I
184
+ 23
185
+ I
186
+ 5
187
+ I
188
+ 2e
189
+ x
190
+ 54
191
+ /Users/jcoglan/projects/primer/spec/models/calendar.rb
192
+ p
193
+ 0
194
+ x
195
+ 13
196
+ attach_method
197
+ p
198
+ 3
199
+ I
200
+ 0
201
+ I
202
+ 1
203
+ I
204
+ 21
205
+ x
206
+ 54
207
+ /Users/jcoglan/projects/primer/spec/models/calendar.rb
208
+ p
209
+ 0