og 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/CHANGELOG +485 -0
  2. data/README +35 -12
  3. data/Rakefile +4 -7
  4. data/benchmark/bench.rb +1 -1
  5. data/doc/AUTHORS +3 -3
  6. data/doc/RELEASES +153 -2
  7. data/doc/config.txt +0 -7
  8. data/doc/tutorial.txt +7 -0
  9. data/examples/README +5 -0
  10. data/examples/mysql_to_psql.rb +25 -50
  11. data/examples/run.rb +62 -77
  12. data/install.rb +1 -1
  13. data/lib/og.rb +45 -106
  14. data/lib/og/collection.rb +156 -0
  15. data/lib/og/entity.rb +131 -0
  16. data/lib/og/errors.rb +10 -15
  17. data/lib/og/manager.rb +115 -0
  18. data/lib/og/{mixins → mixin}/hierarchical.rb +43 -37
  19. data/lib/og/{mixins → mixin}/orderable.rb +35 -35
  20. data/lib/og/{mixins → mixin}/timestamped.rb +0 -6
  21. data/lib/og/{mixins → mixin}/tree.rb +0 -4
  22. data/lib/og/relation.rb +178 -0
  23. data/lib/og/relation/belongs_to.rb +14 -0
  24. data/lib/og/relation/has_many.rb +62 -0
  25. data/lib/og/relation/has_one.rb +17 -0
  26. data/lib/og/relation/joins_many.rb +69 -0
  27. data/lib/og/relation/many_to_many.rb +17 -0
  28. data/lib/og/relation/refers_to.rb +31 -0
  29. data/lib/og/store.rb +223 -0
  30. data/lib/og/store/filesys.rb +113 -0
  31. data/lib/og/store/madeleine.rb +4 -0
  32. data/lib/og/store/memory.rb +291 -0
  33. data/lib/og/store/mysql.rb +283 -0
  34. data/lib/og/store/psql.rb +238 -0
  35. data/lib/og/store/sql.rb +599 -0
  36. data/lib/og/store/sqlite.rb +190 -0
  37. data/lib/og/store/sqlserver.rb +262 -0
  38. data/lib/og/types.rb +19 -0
  39. data/lib/og/validation.rb +0 -4
  40. data/test/og/{mixins → mixin}/tc_hierarchical.rb +21 -23
  41. data/test/og/{mixins → mixin}/tc_orderable.rb +15 -14
  42. data/test/og/mixin/tc_timestamped.rb +38 -0
  43. data/test/og/store/tc_filesys.rb +71 -0
  44. data/test/og/tc_relation.rb +36 -0
  45. data/test/og/tc_store.rb +290 -0
  46. data/test/og/tc_types.rb +21 -0
  47. metadata +54 -40
  48. data/examples/mock_example.rb +0 -50
  49. data/lib/og/adapters/base.rb +0 -706
  50. data/lib/og/adapters/filesys.rb +0 -117
  51. data/lib/og/adapters/mysql.rb +0 -350
  52. data/lib/og/adapters/oracle.rb +0 -368
  53. data/lib/og/adapters/psql.rb +0 -272
  54. data/lib/og/adapters/sqlite.rb +0 -265
  55. data/lib/og/adapters/sqlserver.rb +0 -356
  56. data/lib/og/database.rb +0 -290
  57. data/lib/og/enchant.rb +0 -149
  58. data/lib/og/meta.rb +0 -407
  59. data/lib/og/testing/mock.rb +0 -165
  60. data/lib/og/typemacros.rb +0 -24
  61. data/test/og/adapters/tc_filesys.rb +0 -83
  62. data/test/og/adapters/tc_sqlite.rb +0 -86
  63. data/test/og/adapters/tc_sqlserver.rb +0 -96
  64. data/test/og/tc_automanage.rb +0 -46
  65. data/test/og/tc_lifecycle.rb +0 -105
  66. data/test/og/tc_many_to_many.rb +0 -61
  67. data/test/og/tc_meta.rb +0 -55
  68. data/test/og/tc_validation.rb +0 -89
  69. data/test/tc_og.rb +0 -364
data/CHANGELOG CHANGED
@@ -1,5 +1,490 @@
1
+ 16-05-2005 George Moschovitis <gm@navel.gr>
2
+
3
+ * doc/RELEASES: updated.
4
+
5
+ * README: updated.
6
+
7
+ 15-05-2005 George Moschovitis <gm@navel.gr>
8
+
9
+ * lib/og/store/sql.rb (#enchant): check for create_schema.
10
+
11
+ * lib/og.rb: updated RDoc.
12
+
13
+ * doc/RELEASES: updated.
14
+
15
+ 15-05-2005 George Moschovitis <gm@navel.gr>
16
+
17
+ * examples/run.rb: after some changes it runs.
18
+
19
+ * lib/og/store.rb (#delete): improved obj_or_pk detection.
20
+
21
+ 14-05-2005 George Moschovitis <gm@navel.gr>
22
+
23
+ * doc/tutorial.txt: added warning.
24
+
25
+ * doc/RELEASES: updated.
26
+
27
+ * lib/og/store/*: improved error messages.
28
+
29
+ * lib/og/store/sqlite.rb (#create_table): create join table,
30
+ rescue Object to catch the exception.
31
+
32
+ * lib/og/store/mysql.rb (#create_table): create join table.
33
+
34
+ * lib/og/store/psql.rb (#create_table): create join table.
35
+
36
+ * lib/og/relation/many_to_many.rb: alias to joins_many.
37
+
38
+ * test/og/tc_store.rb: updated with join tests.
39
+
40
+ * lib/og/manager.rb (#manage): add the ogmanager attribute here,
41
+ relation enchant after store enchant.
42
+ (#manage_classes): multipass enchanting to be more flexible.
43
+
44
+ * lib/og/relation/joins_many: introduced,
45
+ implemented,
46
+ yeah it passes the test!
47
+
48
+ * lib/og/relation.rb (#joins_many): introduced,
49
+
50
+ 13-05-2005 George Moschovitis <gm@navel.gr>
51
+
52
+ * lib/og/mixin/hierarchical.rb: converted to new code.
53
+
54
+ * test/og/mixin/hierarchical.rb: converted to new code,
55
+ mostly works.
56
+
57
+ * doc/RELEASES: updated.
58
+
59
+ 12-05-2005 George Moschovitis <gm@navel.gr>
60
+
61
+ * lib/og/store/sqlserver.rb (#initialize): small fix.
62
+
63
+ * test/og/tc_store.rb: refactored to run all tests.
64
+
65
+ 11-05-2005 George Moschovitis <gm@navel.gr>
66
+
67
+ * lib/og/store/memory.rb (MemoryUtils): added to stay compatible
68
+ with the other backends.
69
+
70
+ * lib/og/store/sql.rb (#reload): close the resultset.
71
+
72
+ * lib/og/entity.rb (#delete): fix.
73
+
74
+ * lib/og/store/sqlite.rb: passes tests,
75
+ added transaction_nesting support.
76
+
77
+ * lib/og/store/sqlserver.rb: introduced,
78
+ reimplemented the minimum set of features needed for a project of mine.
79
+
80
+ * lib/og/store/mysql.rb (#create_table): fixed,
81
+ no transactions (nop).
82
+
83
+ * lib/og/store.rb (#delete): made more flexible,
84
+ added transaction_nesting support.
85
+
86
+ * examples/run.rb: changes to make this pass.
87
+
88
+ * lib/og/relation.rb (#resolve_target): handle no-namespace
89
+ case.
90
+
91
+ * test/og/tc_relation.rb: implemented.
92
+
93
+ 10-05-2005 George Moschovitis <gm@navel.gr>
94
+
95
+ * lib/og/collection.rb: totaly recoded to support lazyer synchronization
96
+ with the data-store,
97
+ don't extend from array,
98
+ use method missing to catch more methods.
99
+
100
+ * README: added link for pure ruby mysql interface. [jbritt]
101
+
102
+ 09-05-2005 George Moschovitis <gm@navel.gr>
103
+
104
+ * lib/og/store/sqlite.rb: kinda works :)
105
+
106
+ * lib/og/store/psql.rb (#read_all): fixed stupid and nasty bug.
107
+
108
+ * lib/og/relation/has_many.rb: fixed collection update.
109
+
110
+ 08-05-2005 George Moschovitis <gm@navel.gr>
111
+
112
+ * examples/mysql_to_psql.rb: updated!
113
+ YEAH, it works.
114
+
115
+ * lib/og/store.rb: :<< alias for save.
116
+
117
+ * examples/*: copied from old og.
118
+
119
+ * lib/og/store/psql.rb (#create_table): generate join tables.
120
+
121
+ * lib/og/relation/many_to_many.rb (#enchant): implemented,
122
+ worked a LOT on the join table generation.
123
+
124
+ * lib/og/store/sql.rb (#resolve_options): cleaned up,
125
+ handle join/join_condition options.
126
+ (#join): introduced.
127
+ (#join_table..): use key1, key2,
128
+ require yaml, needed.
129
+
130
+ * replaced some OGTABLE's.
131
+
132
+ 07-05-2005 George Moschovitis <gm@navel.gr>
133
+
134
+ * lib/og/store/sql.rb (#read_all): (SqlUtils#table): implemented
135
+ (SqlUtils#join): nice implementation.
136
+ (#resolve_options): renamed from resolve_from, handles
137
+ all options.
138
+ (#find/#find_one): refactored.
139
+
140
+ 06-05-2005 George Moschovitis <gm@navel.gr>
141
+
142
+ * lib/og/typemacro.rb (##VarChar): fixed.
143
+
144
+ * lib/og/store.rb (#enchant): create finders for properties.
145
+
146
+ * test/og/store/tc_psql.rb: use reload,
147
+ test generated finders.
148
+
149
+ * lib/og/store/sql.rb (#read_all): small fix to make compatible
150
+ with mysql,
151
+ (#reload): generalized and added here,
152
+ fixed stupid bug.
153
+
154
+ * lib/og/store/psql.rb: small updates.
155
+
156
+ * lib/og/store/mysql.rb: introduced and started the
157
+ implementation,
158
+ (Mysql::Result): adapted,
159
+ yeah, this store passes the tests.
160
+
161
+ 05-05-2005 George Moschovitis <gm@navel.gr>
162
+
163
+ * lib/og/store/sql.rb (#find_one): parse all options,
164
+ set limit = 1 if not defined,
165
+ fixed limit,
166
+ (#find): parse :extra option,
167
+ fixed limit.
168
+
169
+ * lib/og/mixin/orderable.rb: converted to latest code,
170
+ no stupid 1 = 1 scope.
171
+
172
+ * test/og/mixin/tc_timestamped.rb: implemented.
173
+
174
+ * lib/og/store/memory.rb (ObjectHash): use string keys.
175
+ (#initialize): read from the yaml file.
176
+ (#close): dump to the yaml file.
177
+ YEAH, serialization works,
178
+ (#query): added support for order.
179
+
180
+ * lib/og/entity.rb (#update): added support for selective
181
+ update.
182
+
183
+ * lib/og/store/sql.rb (#update): handle case of updating
184
+ selected properties,
185
+ (#enable_logging): implemented.
186
+
187
+ 04-05-2005 George Moschovitis <gm@navel.gr>
188
+
189
+ * lib/og/store/memory.rb (#update_properties): implemented.
190
+
191
+ * :where as :condition alias.
192
+
193
+ * lib/og/entity.rb (#enchant): evaluate aliases for the
194
+ primary key,
195
+ (#update): added
196
+ (##update_properties): added.
197
+
198
+ * lib/og/store/sql.rb (#update_properties): implemented,
199
+ use @ in variables.
200
+
201
+ * lib/og/store.rb (#update_properties): introduced.
202
+
203
+ * converted many files to make compatible with facets 0.7.1
204
+
205
+ 03-05-2005 George Moschovitis <gm@navel.gr>
206
+
207
+ * lib/og/store.rb: factored out code from sql.rb, memory.rb
208
+
209
+ * lib/og/mixin/orderable.rb: use aspects for callbacks.
210
+
211
+ * test/og/mixin/*: copied tests from old version.
212
+
213
+ * lib/og/manager.rb (#manage_classes): improved.
214
+
215
+ * lib/og.rb: cleaned up, removed older code.
216
+
217
+ * lib/og/relation/belongs_to: set descendants, only here needed.
218
+
219
+ * lib/og/relation/*: use RefersTo as the basis relation.
220
+
221
+ * lib/og/entity.rb (#count): implemented.
222
+ (##transaction): implemented,
223
+ (##delete): implemented.
224
+
225
+ * pass the class as an option to many methods.
226
+
227
+ * lib/og/store/memory.rb (#count): implemented,
228
+ improved condition handling in count and query,
229
+ (#delete): works with descendants,
230
+ use og_delete.
231
+
232
+ * lib/og/store/psql.rb (#first_value): implemented.
233
+
234
+ * lib/og/store/sql.rb (#count): implemented,
235
+ fixed signature of methods,
236
+ (#og_delete): implemented.
237
+ (#delete): use og_delete.
238
+
239
+ 02-05-2005 George Moschovitis <gm@navel.gr>
240
+
241
+ * lib/og/store/memory.rb: introduced,
242
+ (#og_insert): implemtented,
243
+ (#og_update): implemented,
244
+ I got insertions working,
245
+ (#query): implemented!
246
+ Incredible, the memory store passes all tests.
247
+
248
+ 01-05-2005 George Moschovitis <gm@navel.gr>
249
+
250
+ * lib/og/store/sqlite.rb: implemented the rest of the
251
+ functionality,
252
+ (#eval_og_insert): implemented.
253
+
254
+ * lib/og/store/psql.rb: override PGresult,
255
+ (#each_row): implemented.
256
+
257
+ * lib/og/store/sql.rb: removed resultset methods,
258
+ (#read_all): use each_row.
259
+ (#find_one/all): use new read methods.
260
+
261
+ 30-04-2005 George Moschovitis <gm@navel.gr>
262
+
263
+ * lib/og/store/psql.rb: shorter query/select.
264
+
265
+ * lib/og/store/sql.rb (SqlUtils): renamed from SqlStoreUtils.
266
+ (#result_blank?): implemented,
267
+ (#result_get): implemented,
268
+ (#result_close): implemented,
269
+ (#read_one): implemented, also handles join,
270
+ (#read_join_relations): implemented.
271
+
272
+ * lib/og/relation.rb (#resolve_target): supports the no
273
+ forward declaration trick.
274
+
275
+ * lib/og/entity.rb (#const_missing): added trick, no need for
276
+ forward declarations [mneumann].
277
+
278
+ 29-04-2005 George Moschovitis <gm@navel.gr>
279
+
280
+ * lib/og/store/sqlite.rb (#create_table): implemented,
281
+ (#create_column_map): implemented.
282
+
283
+ * lib/og/relation/many_to_many.rb: introduced.
284
+
285
+ * lib/og/relation/refers_to.rb: implemented as extension of
286
+ has_one.
287
+
288
+ * lib/og/relation/belongs_to.rb: reimplemented as extension of
289
+ has_one.
290
+
291
+ * lib/og/relation/has_one.rb: implemented.
292
+
293
+ * lib/og/relation.rb (#init_options): handle plural/singular,
294
+ further cleanup of the relation code,
295
+ even more cleanup, moved init_options code to the Relation
296
+ constructor,
297
+ totaly removed RelationMacros::Utils.
298
+
299
+ 28-04-2005 George Moschovitis <gm@navel.gr>
300
+
301
+ * lib/og/relation/has_many.rb: some refactoring.
302
+
303
+ * lib/og/relation.rb (Relation::Utils): introduced,
304
+ (#init_options): implemented.
305
+ (#method_missing): access the options as methods.
306
+
307
+ * lib/og/typemacros.rb: copied from old.
308
+
309
+ * test/og/store/psql.rb (#test_conversions): added.
310
+
311
+ * lib/og/store/sql.rb (SqlStoreUtils): refactored.
312
+ (#quote): ultraclean implementation.
313
+
314
+ * lib/og/store/psql.rb: no custom transaction methods.
315
+
316
+ 26-04-2005 George Moschovitis <gm@navel.gr>
317
+
318
+ * lib/og/store/sql.rb: added some escape/parsing methods.
319
+
320
+ * lib/og/store/sqlite.rb: introduced.
321
+
322
+ * lib/og/psql.rb (#join_all): implemented.
323
+ (#reload): implemented.
324
+
325
+ * copied various support files from old Og.
326
+
327
+ 25-04-2005 George Moschovitis <gm@navel.gr>
328
+
329
+ * yeah I got a simple eager relation working.
330
+
331
+ * lib/og/psql.rb (#join_one): implemented.
332
+
333
+ * lib/og/sql.rb (#find): join clause calculation.
334
+ (#read_prop): use offset.
335
+
336
+ * lib/og/relation/belongs_to.rb: updated to latest code.
337
+ precalculate stuff.
338
+
339
+ * lib/og/relation.rb (#relations): implemented,
340
+ (#inspect_relation): implemented.
341
+ extend from Hash, not Flexob.
342
+ set setter.
343
+ use inflector to inflect relation names.
344
+
345
+ * yeah i got my blog up using the new Og.
346
+
347
+ * lib/og/mixin/*: copied from old.
348
+
349
+ * replaced the original implementation.
350
+
351
+ * lib/og/manager.rb (#manage): def ==,
352
+ (#manageable_classes): improved detection.
353
+
354
+ * lib/og/collection.rb (#clear): added.
355
+ (#delete): added.
356
+
357
+ * lib/og/entity.rb (#transaction): added.
358
+ (#find, #find_one): made options optional
359
+ cleaned up.
360
+
361
+ 24-04-2005 George Moschovitis <gm@navel.gr>
362
+
363
+ * relation caching also works.
364
+
365
+ * yeah I got an 'active' collection working.
366
+
367
+ * lib/og/relation/has_many.rb (#add_entity): implemented.
368
+ reloading option works.
369
+
370
+ * lib/og/collection.rb: overload array methods.
371
+ (#initialize): pass adder method.
372
+
373
+ * lib/og/store.rb (#unsaved?): implemented.
374
+
375
+ * lib/og/store/sql.rb (#find_one): fixed duplicate query.
376
+
377
+ * lib/og/entity.rb (#create): added, takes block.
378
+ (#primary_key): more fault tolerant.
379
+
380
+ 23-04-2005 George Moschovitis <gm@navel.gr>
381
+
382
+ * lib/og/entity.rb: add [] in class,
383
+ load, find, find_first and aliases.
384
+
385
+ * lib/og/relation/has_many.rb (#enchant): implemented,
386
+ (HasManyCollection): introduced.
387
+
388
+ * don't use property.name.
389
+
390
+ * test/og/store/tc_psql.rb: implemented.
391
+
392
+ * lib/og/store/sql.rb (#og_read): greatly simplified.
393
+ (#find): implemented,
394
+ (#find_one): implemented.
395
+
396
+ * lib/og/manager.rb (#setup): honour :destroy.
397
+
398
+ * lib/og/store/psql.rb: added many methods from the old
399
+ adapter.
400
+ (og_insert): works!
401
+ (#create_column_map): introduced.
402
+ (og_read): yeah, it works!
403
+ (#close): added,
404
+ (#read_all): added.
405
+
406
+ * lib/og/store.rb (#enchant): call lifecycle method compilers.
407
+ (#close): added.
408
+
409
+ 22-04-2005 George Moschovitis <gm@navel.gr>
410
+
411
+ * lib/og/store/filesys.rb (#enchant): use less evals.
412
+
413
+ * lib/og/store/sql.rb: started implementing,
414
+ (#create_table/#drop_table): introduced.
415
+ added typmap support.
416
+
417
+ * lib/og/store/psql.rb: started implementing.
418
+ (#create_table): implemented.
419
+ (#enchant): no evals,
420
+ add saved?
421
+
422
+ * I got enchanting working.
423
+
424
+ * lib/og/store.rb (#reload): introduced,
425
+ (#enchant): set og_store,
426
+ add index macro.
427
+
428
+ 21-04-2005 George Moschovitis <gm@navel.gr>
429
+
430
+ * lib/og/store/filesys.rb: introduced,
431
+ (#create, #destroy): implemented.
432
+ after many changes, got something working.
433
+ (#destroy): use rm_rf.
434
+ use OGNAME,
435
+ dont remove leading module from OGNAME.
436
+ (#path): helper.
437
+ (#delete): implemented.
438
+
439
+ * lib/og/store/psql.rb: introduced.
440
+
441
+ * lib/og/store/sql.rb: introduced.
442
+
443
+ * lib/og/relation/belongs_to (#enchant): full.
444
+
445
+ * YEAH, added support for different primary keys.
446
+
447
+ * lib/og/collection.rb: introduced.
448
+
449
+ * lib/og/errors.rb: introduced,
450
+ (StoreException): introduced.
451
+
452
+ * lib/og/manager.rb: introduced.
453
+ (#managable_classes): implemented.
454
+ (EntityInfo): introduced.
455
+
456
+ * test/tc_og.rb: reintroduced.
457
+
458
+ * lib/og/relation: introduced.
459
+
460
+ * lib/og/store.rb: introduced,
461
+ unified store/connection.
462
+
463
+ * lib/og/mixin: introduced.
464
+
465
+ * lib/og/entity.rb: introduced.
466
+ (EntityMixin): introduced.
467
+ (Entity): introduced.
468
+ (InstanceMethods): introduced.
469
+ (ClassMethods): introduced.
470
+ (#resolve_primary_key): implemented.
471
+
472
+ * started working on new implementation.
473
+
474
+ 20-04-2005 George Moschovitis <gm@navel.gr>
475
+
476
+ * lib/og/enchant.rb (#self.update): gets oid argument.
477
+
478
+ 19-04-2005 George Moschovitis <gm@navel.gr>
479
+
480
+ * lib/og/meta.rb: started using facets :)
481
+
482
+ * Rakefile: added facets dependency.
483
+
1
484
  16-04-2005 George Moschovitis <gm@navel.gr>
2
485
 
486
+ * --- VERSION 0.16.0 ---
487
+
3
488
  * lib/og/mixins/timestamped.rb: implemented with aspects.
4
489
 
5
490
  15-04-2005 George Moschovitis <gm@navel.gr>