dm-core 0.9.11 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/.autotest +17 -14
  2. data/.gitignore +3 -1
  3. data/FAQ +6 -5
  4. data/History.txt +5 -50
  5. data/Manifest.txt +66 -76
  6. data/QUICKLINKS +1 -1
  7. data/README.txt +21 -15
  8. data/Rakefile +6 -7
  9. data/SPECS +2 -29
  10. data/TODO +1 -1
  11. data/deps.rip +2 -0
  12. data/dm-core.gemspec +11 -15
  13. data/lib/dm-core.rb +105 -110
  14. data/lib/dm-core/adapters.rb +135 -16
  15. data/lib/dm-core/adapters/abstract_adapter.rb +251 -181
  16. data/lib/dm-core/adapters/data_objects_adapter.rb +482 -534
  17. data/lib/dm-core/adapters/in_memory_adapter.rb +90 -69
  18. data/lib/dm-core/adapters/mysql_adapter.rb +22 -115
  19. data/lib/dm-core/adapters/oracle_adapter.rb +249 -0
  20. data/lib/dm-core/adapters/postgres_adapter.rb +7 -173
  21. data/lib/dm-core/adapters/sqlite3_adapter.rb +4 -97
  22. data/lib/dm-core/adapters/yaml_adapter.rb +116 -0
  23. data/lib/dm-core/associations/many_to_many.rb +372 -90
  24. data/lib/dm-core/associations/many_to_one.rb +220 -73
  25. data/lib/dm-core/associations/one_to_many.rb +319 -255
  26. data/lib/dm-core/associations/one_to_one.rb +66 -53
  27. data/lib/dm-core/associations/relationship.rb +561 -156
  28. data/lib/dm-core/collection.rb +1101 -379
  29. data/lib/dm-core/core_ext/kernel.rb +12 -0
  30. data/lib/dm-core/core_ext/symbol.rb +10 -0
  31. data/lib/dm-core/identity_map.rb +4 -34
  32. data/lib/dm-core/migrations.rb +1283 -0
  33. data/lib/dm-core/model.rb +570 -369
  34. data/lib/dm-core/model/descendant_set.rb +81 -0
  35. data/lib/dm-core/model/hook.rb +45 -0
  36. data/lib/dm-core/model/is.rb +32 -0
  37. data/lib/dm-core/model/property.rb +247 -0
  38. data/lib/dm-core/model/relationship.rb +335 -0
  39. data/lib/dm-core/model/scope.rb +90 -0
  40. data/lib/dm-core/property.rb +808 -273
  41. data/lib/dm-core/property_set.rb +141 -98
  42. data/lib/dm-core/query.rb +1037 -483
  43. data/lib/dm-core/query/conditions/comparison.rb +872 -0
  44. data/lib/dm-core/query/conditions/operation.rb +221 -0
  45. data/lib/dm-core/query/direction.rb +43 -0
  46. data/lib/dm-core/query/operator.rb +84 -0
  47. data/lib/dm-core/query/path.rb +138 -0
  48. data/lib/dm-core/query/sort.rb +45 -0
  49. data/lib/dm-core/repository.rb +210 -94
  50. data/lib/dm-core/resource.rb +641 -421
  51. data/lib/dm-core/spec/adapter_shared_spec.rb +294 -0
  52. data/lib/dm-core/spec/data_objects_adapter_shared_spec.rb +106 -0
  53. data/lib/dm-core/support/chainable.rb +22 -0
  54. data/lib/dm-core/support/deprecate.rb +12 -0
  55. data/lib/dm-core/support/logger.rb +13 -0
  56. data/lib/dm-core/{naming_conventions.rb → support/naming_conventions.rb} +6 -6
  57. data/lib/dm-core/transaction.rb +333 -92
  58. data/lib/dm-core/type.rb +98 -60
  59. data/lib/dm-core/types/boolean.rb +1 -1
  60. data/lib/dm-core/types/discriminator.rb +34 -20
  61. data/lib/dm-core/types/object.rb +7 -4
  62. data/lib/dm-core/types/paranoid_boolean.rb +11 -9
  63. data/lib/dm-core/types/paranoid_datetime.rb +11 -9
  64. data/lib/dm-core/types/serial.rb +3 -3
  65. data/lib/dm-core/types/text.rb +3 -4
  66. data/lib/dm-core/version.rb +1 -1
  67. data/script/performance.rb +102 -109
  68. data/script/profile.rb +169 -38
  69. data/spec/lib/adapter_helpers.rb +105 -0
  70. data/spec/lib/collection_helpers.rb +18 -0
  71. data/spec/lib/counter_adapter.rb +34 -0
  72. data/spec/lib/pending_helpers.rb +27 -0
  73. data/spec/lib/rspec_immediate_feedback_formatter.rb +53 -0
  74. data/spec/public/associations/many_to_many_spec.rb +193 -0
  75. data/spec/public/associations/many_to_one_spec.rb +73 -0
  76. data/spec/public/associations/one_to_many_spec.rb +77 -0
  77. data/spec/public/associations/one_to_one_spec.rb +156 -0
  78. data/spec/public/collection_spec.rb +65 -0
  79. data/spec/public/migrations_spec.rb +359 -0
  80. data/spec/public/model/relationship_spec.rb +924 -0
  81. data/spec/public/model_spec.rb +159 -0
  82. data/spec/public/property_spec.rb +829 -0
  83. data/spec/public/resource_spec.rb +71 -0
  84. data/spec/public/sel_spec.rb +44 -0
  85. data/spec/public/setup_spec.rb +145 -0
  86. data/spec/public/shared/association_collection_shared_spec.rb +317 -0
  87. data/spec/public/shared/collection_shared_spec.rb +1670 -0
  88. data/spec/public/shared/finder_shared_spec.rb +1619 -0
  89. data/spec/public/shared/resource_shared_spec.rb +924 -0
  90. data/spec/public/shared/sel_shared_spec.rb +112 -0
  91. data/spec/public/transaction_spec.rb +129 -0
  92. data/spec/public/types/discriminator_spec.rb +130 -0
  93. data/spec/semipublic/adapters/abstract_adapter_spec.rb +30 -0
  94. data/spec/semipublic/adapters/in_memory_adapter_spec.rb +12 -0
  95. data/spec/semipublic/adapters/mysql_adapter_spec.rb +17 -0
  96. data/spec/semipublic/adapters/oracle_adapter_spec.rb +194 -0
  97. data/spec/semipublic/adapters/postgres_adapter_spec.rb +17 -0
  98. data/spec/semipublic/adapters/sqlite3_adapter_spec.rb +17 -0
  99. data/spec/semipublic/adapters/yaml_adapter_spec.rb +12 -0
  100. data/spec/semipublic/associations/many_to_one_spec.rb +53 -0
  101. data/spec/semipublic/associations/relationship_spec.rb +194 -0
  102. data/spec/semipublic/associations_spec.rb +177 -0
  103. data/spec/semipublic/collection_spec.rb +142 -0
  104. data/spec/semipublic/property_spec.rb +61 -0
  105. data/spec/semipublic/query/conditions_spec.rb +528 -0
  106. data/spec/semipublic/query/path_spec.rb +443 -0
  107. data/spec/semipublic/query_spec.rb +2626 -0
  108. data/spec/semipublic/resource_spec.rb +47 -0
  109. data/spec/semipublic/shared/condition_shared_spec.rb +9 -0
  110. data/spec/semipublic/shared/resource_shared_spec.rb +126 -0
  111. data/spec/spec.opts +3 -1
  112. data/spec/spec_helper.rb +80 -57
  113. data/tasks/ci.rb +19 -31
  114. data/tasks/dm.rb +43 -48
  115. data/tasks/doc.rb +8 -11
  116. data/tasks/gemspec.rb +5 -5
  117. data/tasks/hoe.rb +15 -16
  118. data/tasks/install.rb +8 -10
  119. metadata +74 -111
  120. data/lib/dm-core/associations.rb +0 -207
  121. data/lib/dm-core/associations/relationship_chain.rb +0 -81
  122. data/lib/dm-core/auto_migrations.rb +0 -105
  123. data/lib/dm-core/dependency_queue.rb +0 -32
  124. data/lib/dm-core/hook.rb +0 -11
  125. data/lib/dm-core/is.rb +0 -16
  126. data/lib/dm-core/logger.rb +0 -232
  127. data/lib/dm-core/migrations/destructive_migrations.rb +0 -17
  128. data/lib/dm-core/migrator.rb +0 -29
  129. data/lib/dm-core/scope.rb +0 -58
  130. data/lib/dm-core/support.rb +0 -7
  131. data/lib/dm-core/support/array.rb +0 -13
  132. data/lib/dm-core/support/assertions.rb +0 -8
  133. data/lib/dm-core/support/errors.rb +0 -23
  134. data/lib/dm-core/support/kernel.rb +0 -11
  135. data/lib/dm-core/support/symbol.rb +0 -41
  136. data/lib/dm-core/type_map.rb +0 -80
  137. data/lib/dm-core/types.rb +0 -19
  138. data/script/all +0 -4
  139. data/spec/integration/association_spec.rb +0 -1382
  140. data/spec/integration/association_through_spec.rb +0 -203
  141. data/spec/integration/associations/many_to_many_spec.rb +0 -449
  142. data/spec/integration/associations/many_to_one_spec.rb +0 -163
  143. data/spec/integration/associations/one_to_many_spec.rb +0 -188
  144. data/spec/integration/auto_migrations_spec.rb +0 -413
  145. data/spec/integration/collection_spec.rb +0 -1073
  146. data/spec/integration/data_objects_adapter_spec.rb +0 -32
  147. data/spec/integration/dependency_queue_spec.rb +0 -46
  148. data/spec/integration/model_spec.rb +0 -197
  149. data/spec/integration/mysql_adapter_spec.rb +0 -85
  150. data/spec/integration/postgres_adapter_spec.rb +0 -731
  151. data/spec/integration/property_spec.rb +0 -253
  152. data/spec/integration/query_spec.rb +0 -514
  153. data/spec/integration/repository_spec.rb +0 -61
  154. data/spec/integration/resource_spec.rb +0 -513
  155. data/spec/integration/sqlite3_adapter_spec.rb +0 -352
  156. data/spec/integration/sti_spec.rb +0 -273
  157. data/spec/integration/strategic_eager_loading_spec.rb +0 -156
  158. data/spec/integration/transaction_spec.rb +0 -75
  159. data/spec/integration/type_spec.rb +0 -275
  160. data/spec/lib/logging_helper.rb +0 -18
  161. data/spec/lib/mock_adapter.rb +0 -27
  162. data/spec/lib/model_loader.rb +0 -100
  163. data/spec/lib/publicize_methods.rb +0 -28
  164. data/spec/models/content.rb +0 -16
  165. data/spec/models/vehicles.rb +0 -34
  166. data/spec/models/zoo.rb +0 -48
  167. data/spec/unit/adapters/abstract_adapter_spec.rb +0 -133
  168. data/spec/unit/adapters/adapter_shared_spec.rb +0 -15
  169. data/spec/unit/adapters/data_objects_adapter_spec.rb +0 -632
  170. data/spec/unit/adapters/in_memory_adapter_spec.rb +0 -98
  171. data/spec/unit/adapters/postgres_adapter_spec.rb +0 -133
  172. data/spec/unit/associations/many_to_many_spec.rb +0 -32
  173. data/spec/unit/associations/many_to_one_spec.rb +0 -159
  174. data/spec/unit/associations/one_to_many_spec.rb +0 -393
  175. data/spec/unit/associations/one_to_one_spec.rb +0 -7
  176. data/spec/unit/associations/relationship_spec.rb +0 -71
  177. data/spec/unit/associations_spec.rb +0 -242
  178. data/spec/unit/auto_migrations_spec.rb +0 -111
  179. data/spec/unit/collection_spec.rb +0 -182
  180. data/spec/unit/data_mapper_spec.rb +0 -35
  181. data/spec/unit/identity_map_spec.rb +0 -126
  182. data/spec/unit/is_spec.rb +0 -80
  183. data/spec/unit/migrator_spec.rb +0 -33
  184. data/spec/unit/model_spec.rb +0 -321
  185. data/spec/unit/naming_conventions_spec.rb +0 -36
  186. data/spec/unit/property_set_spec.rb +0 -90
  187. data/spec/unit/property_spec.rb +0 -753
  188. data/spec/unit/query_spec.rb +0 -571
  189. data/spec/unit/repository_spec.rb +0 -93
  190. data/spec/unit/resource_spec.rb +0 -649
  191. data/spec/unit/scope_spec.rb +0 -142
  192. data/spec/unit/transaction_spec.rb +0 -493
  193. data/spec/unit/type_map_spec.rb +0 -114
  194. data/spec/unit/type_spec.rb +0 -119
data/.autotest CHANGED
@@ -1,26 +1,29 @@
1
1
  Autotest.add_hook :initialize do |at|
2
- ignore = %w[ .git burn www log plugins script tasks bin CHANGELOG FAQ MIT-LICENSE PERFORMANCE QUICKLINKS README ]
3
-
4
- unless ENV['AUTOTEST'] == 'integration'
5
- ignore << 'spec/integration'
6
- end
7
-
8
- ignore.each do |exception|
2
+ %w[ .git burn www log plugins script tasks bin CHANGELOG FAQ MIT-LICENSE PERFORMANCE QUICKLINKS README ].each do |exception|
9
3
  at.add_exception(exception)
10
4
  end
11
5
 
12
6
  at.clear_mappings
13
7
 
14
- at.add_mapping(%r{^spec/.+_spec\.rb$}) do |filename,_|
15
- filename
8
+ spec_folders = /(?:semi)?public/
9
+
10
+ # when a file is updated, make sure it's dependent public and semipublic specs pass
11
+ at.add_mapping %r{\Alib/dm\-core/(.+)\.rb\z} do |_,match|
12
+ at.files_matching %r{\Aspec/#{spec_folders}/#{match[1]}_spec\.rb\z}
13
+ end
14
+
15
+ # when the spec configuration changes make sure all specs pass
16
+ at.add_mapping %r{\Aspec/spec_helper\.rb\z} do
17
+ at.files_matching %r{\Aspec/.+_spec\.rb\z}
16
18
  end
17
19
 
18
- at.add_mapping(%r{^lib/data_mapper/(.+)\.rb$}) do |_,match|
19
- [ "spec/unit/#{match[1]}_spec.rb" ] +
20
- at.files_matching(%r{^spec/integration/.+_spec\.rb$})
20
+ # when a spec is updated, make sure it passes
21
+ at.add_mapping %r{\Aspec/#{spec_folders}/(.+)_spec\.rb\z} do |filename,_|
22
+ filename
21
23
  end
22
24
 
23
- at.add_mapping(%r{^spec/spec_helper\.rb$}) do
24
- at.files_matching(%r{^spec/.+_spec\.rb$})
25
+ # when the collection shared spec is update, make sure all dependent specs pass
26
+ at.add_mapping %r{\Aspec/lib/collection_shared_spec\.rb\z} do
27
+ at.files_matching %r{\Aspec/#{spec_folders}/collection_spec\.rb\z}
25
28
  end
26
29
  end
data/.gitignore CHANGED
@@ -3,9 +3,10 @@ log/*
3
3
  doc
4
4
  cov
5
5
  pkg
6
- .DS_Store
6
+ coverage.html
7
7
  coverage/*
8
8
  *.db
9
+ spec/db
9
10
  spec/integration/*.db*
10
11
  nbproject
11
12
  profile_results.*
@@ -16,3 +17,4 @@ lib/coverage.html
16
17
  _Yardoc
17
18
  .yardoc
18
19
  tmp/*
20
+ \.*
data/FAQ CHANGED
@@ -24,7 +24,7 @@ model has two or more keys, no big deal
24
24
  Create a property and make it a ParanoidDateTime or ParanoidBoolean type.
25
25
 
26
26
  property :deleted_at, ParanoidDateTime
27
- property :deleted, ParanoidBoolean
27
+ property :deleted, ParanoidBoolean
28
28
 
29
29
  All of your calls to <tt>##all()</tt>, <tt>##first()</tt> will be scoped
30
30
  with <tt>:deleted_at => nil</tt> or <tt>:deleted => false</tt>. Plus,
@@ -36,8 +36,9 @@ This is what the Discriminator data-type is for:
36
36
 
37
37
  class Person
38
38
  include DataMapper::Resource
39
- property :id, Serial
40
- property :type, Discriminator ## other shared properties here
39
+
40
+ property :id, Serial
41
+ property :type, Discriminator ## other shared properties here
41
42
  end
42
43
 
43
44
  class Salesperson < Person; end
@@ -48,8 +49,8 @@ the data-store.
48
49
 
49
50
  === How do I run my own commands?
50
51
 
51
- repository.adapter.query("select * from users where clue > 0")
52
- repository(:integration).adapter.query("select * from users where clue > 0")
52
+ repository.adapter.query("SELECT * FROM users WHERE clue > 0")
53
+ repository(:integration).adapter.query("SELECT * FROM users WHERE clue > 0")
53
54
 
54
55
  This does not return any Users (har har), but rather Struct's that will quack
55
56
  like Users. They'll be read-only as well.
@@ -1,52 +1,7 @@
1
- === 0.9.11 / not released
1
+ === 0.10.0 / 2009-10-15
2
2
 
3
- * 1 major enhancement:
3
+ * Countless enhancements:
4
4
 
5
- * Added deprecation warning for inferred child_key naming convention change
6
-
7
- * 6 bug fixes:
8
-
9
- * Removed unecessary code from SEL
10
- * 1.9.1 fix for Logger to use Array#join instead of Array#to_s
11
- * 1.9.1 fix for specs to pass
12
- * Fix for multiple join models to create correct SQL
13
- * Fix for STI and lazy loading
14
- * Fixed Resource#eql?
15
-
16
- === 0.9.10 / 2009-01-19
17
-
18
- * 1 major enhancement:
19
-
20
- * Ruby 1.9.1 compatibility
21
-
22
- * 1 minor enhancement:
23
-
24
- * Updated Resource marshaling to be more thorough
25
-
26
- === 0.9.9 / 2009-01-04
27
-
28
- * 1 minor enhancement:
29
-
30
- * Updated Resource and Collection to be serializable with Marshal
31
-
32
- * 1 bug fix:
33
-
34
- * Fixed Model#copy to copy properties that are the same in both
35
- repositories.
36
-
37
- === 0.9.8 / 2008-12-07
38
-
39
- * 3 minor enhancements:
40
-
41
- * Updated Resource#inspect to not lazy-load unloaded attributes.
42
- * Updated ManyToOne::Proxy to delegate #class to parent. This will
43
- allow the Merb resource() route helper method to use the association
44
- proxy to generate the URL.
45
- * Updated Resource#attributes= to respect method visibility. This means
46
- that only public mutators will set the attribute value.
47
-
48
- * 1 bug fix:
49
-
50
- * Fixed regression where an update to a resource with a lazy property
51
- could cause the record to reload when accessing the lazy property,
52
- clobbering any changes made prior.
5
+ * Total rewrite of most of dm-core, including YARD docs for more
6
+ than half the methods and ~90% coverage of code. More to be done
7
+ but this is a great start.
@@ -10,6 +10,7 @@ README.txt
10
10
  Rakefile
11
11
  SPECS
12
12
  TODO
13
+ deps.rip
13
14
  dm-core.gemspec
14
15
  lib/dm-core.rb
15
16
  lib/dm-core/adapters.rb
@@ -17,42 +18,46 @@ lib/dm-core/adapters/abstract_adapter.rb
17
18
  lib/dm-core/adapters/data_objects_adapter.rb
18
19
  lib/dm-core/adapters/in_memory_adapter.rb
19
20
  lib/dm-core/adapters/mysql_adapter.rb
21
+ lib/dm-core/adapters/oracle_adapter.rb
20
22
  lib/dm-core/adapters/postgres_adapter.rb
21
23
  lib/dm-core/adapters/sqlite3_adapter.rb
22
- lib/dm-core/associations.rb
24
+ lib/dm-core/adapters/yaml_adapter.rb
23
25
  lib/dm-core/associations/many_to_many.rb
24
26
  lib/dm-core/associations/many_to_one.rb
25
27
  lib/dm-core/associations/one_to_many.rb
26
28
  lib/dm-core/associations/one_to_one.rb
27
29
  lib/dm-core/associations/relationship.rb
28
- lib/dm-core/associations/relationship_chain.rb
29
- lib/dm-core/auto_migrations.rb
30
30
  lib/dm-core/collection.rb
31
- lib/dm-core/dependency_queue.rb
32
- lib/dm-core/hook.rb
31
+ lib/dm-core/core_ext/kernel.rb
32
+ lib/dm-core/core_ext/symbol.rb
33
33
  lib/dm-core/identity_map.rb
34
- lib/dm-core/is.rb
35
- lib/dm-core/logger.rb
36
- lib/dm-core/migrations/destructive_migrations.rb
37
- lib/dm-core/migrator.rb
34
+ lib/dm-core/migrations.rb
38
35
  lib/dm-core/model.rb
39
- lib/dm-core/naming_conventions.rb
36
+ lib/dm-core/model/descendant_set.rb
37
+ lib/dm-core/model/hook.rb
38
+ lib/dm-core/model/is.rb
39
+ lib/dm-core/model/property.rb
40
+ lib/dm-core/model/relationship.rb
41
+ lib/dm-core/model/scope.rb
40
42
  lib/dm-core/property.rb
41
43
  lib/dm-core/property_set.rb
42
44
  lib/dm-core/query.rb
45
+ lib/dm-core/query/conditions/comparison.rb
46
+ lib/dm-core/query/conditions/operation.rb
47
+ lib/dm-core/query/direction.rb
48
+ lib/dm-core/query/operator.rb
49
+ lib/dm-core/query/path.rb
50
+ lib/dm-core/query/sort.rb
43
51
  lib/dm-core/repository.rb
44
52
  lib/dm-core/resource.rb
45
- lib/dm-core/scope.rb
46
- lib/dm-core/support.rb
47
- lib/dm-core/support/array.rb
48
- lib/dm-core/support/assertions.rb
49
- lib/dm-core/support/errors.rb
50
- lib/dm-core/support/kernel.rb
51
- lib/dm-core/support/symbol.rb
53
+ lib/dm-core/spec/adapter_shared_spec.rb
54
+ lib/dm-core/spec/data_objects_adapter_shared_spec.rb
55
+ lib/dm-core/support/chainable.rb
56
+ lib/dm-core/support/deprecate.rb
57
+ lib/dm-core/support/logger.rb
58
+ lib/dm-core/support/naming_conventions.rb
52
59
  lib/dm-core/transaction.rb
53
60
  lib/dm-core/type.rb
54
- lib/dm-core/type_map.rb
55
- lib/dm-core/types.rb
56
61
  lib/dm-core/types/boolean.rb
57
62
  lib/dm-core/types/discriminator.rb
58
63
  lib/dm-core/types/object.rb
@@ -61,67 +66,52 @@ lib/dm-core/types/paranoid_datetime.rb
61
66
  lib/dm-core/types/serial.rb
62
67
  lib/dm-core/types/text.rb
63
68
  lib/dm-core/version.rb
64
- script/all
65
69
  script/performance.rb
66
70
  script/profile.rb
67
- spec/integration/association_spec.rb
68
- spec/integration/association_through_spec.rb
69
- spec/integration/associations/many_to_many_spec.rb
70
- spec/integration/associations/many_to_one_spec.rb
71
- spec/integration/associations/one_to_many_spec.rb
72
- spec/integration/auto_migrations_spec.rb
73
- spec/integration/collection_spec.rb
74
- spec/integration/data_objects_adapter_spec.rb
75
- spec/integration/dependency_queue_spec.rb
76
- spec/integration/model_spec.rb
77
- spec/integration/mysql_adapter_spec.rb
78
- spec/integration/postgres_adapter_spec.rb
79
- spec/integration/property_spec.rb
80
- spec/integration/query_spec.rb
81
- spec/integration/repository_spec.rb
82
- spec/integration/resource_spec.rb
83
- spec/integration/sqlite3_adapter_spec.rb
84
- spec/integration/sti_spec.rb
85
- spec/integration/strategic_eager_loading_spec.rb
86
- spec/integration/transaction_spec.rb
87
- spec/integration/type_spec.rb
88
- spec/lib/logging_helper.rb
89
- spec/lib/mock_adapter.rb
90
- spec/lib/model_loader.rb
91
- spec/lib/publicize_methods.rb
92
- spec/models/content.rb
93
- spec/models/vehicles.rb
94
- spec/models/zoo.rb
71
+ spec/lib/adapter_helpers.rb
72
+ spec/lib/collection_helpers.rb
73
+ spec/lib/counter_adapter.rb
74
+ spec/lib/pending_helpers.rb
75
+ spec/lib/rspec_immediate_feedback_formatter.rb
76
+ spec/public/associations/many_to_many_spec.rb
77
+ spec/public/associations/many_to_one_spec.rb
78
+ spec/public/associations/one_to_many_spec.rb
79
+ spec/public/associations/one_to_one_spec.rb
80
+ spec/public/collection_spec.rb
81
+ spec/public/migrations_spec.rb
82
+ spec/public/model/relationship_spec.rb
83
+ spec/public/model_spec.rb
84
+ spec/public/property_spec.rb
85
+ spec/public/resource_spec.rb
86
+ spec/public/sel_spec.rb
87
+ spec/public/setup_spec.rb
88
+ spec/public/shared/association_collection_shared_spec.rb
89
+ spec/public/shared/collection_shared_spec.rb
90
+ spec/public/shared/finder_shared_spec.rb
91
+ spec/public/shared/resource_shared_spec.rb
92
+ spec/public/shared/sel_shared_spec.rb
93
+ spec/public/transaction_spec.rb
94
+ spec/public/types/discriminator_spec.rb
95
+ spec/semipublic/adapters/abstract_adapter_spec.rb
96
+ spec/semipublic/adapters/in_memory_adapter_spec.rb
97
+ spec/semipublic/adapters/mysql_adapter_spec.rb
98
+ spec/semipublic/adapters/oracle_adapter_spec.rb
99
+ spec/semipublic/adapters/postgres_adapter_spec.rb
100
+ spec/semipublic/adapters/sqlite3_adapter_spec.rb
101
+ spec/semipublic/adapters/yaml_adapter_spec.rb
102
+ spec/semipublic/associations/many_to_one_spec.rb
103
+ spec/semipublic/associations/relationship_spec.rb
104
+ spec/semipublic/associations_spec.rb
105
+ spec/semipublic/collection_spec.rb
106
+ spec/semipublic/property_spec.rb
107
+ spec/semipublic/query/conditions_spec.rb
108
+ spec/semipublic/query/path_spec.rb
109
+ spec/semipublic/query_spec.rb
110
+ spec/semipublic/resource_spec.rb
111
+ spec/semipublic/shared/condition_shared_spec.rb
112
+ spec/semipublic/shared/resource_shared_spec.rb
95
113
  spec/spec.opts
96
114
  spec/spec_helper.rb
97
- spec/unit/adapters/abstract_adapter_spec.rb
98
- spec/unit/adapters/adapter_shared_spec.rb
99
- spec/unit/adapters/data_objects_adapter_spec.rb
100
- spec/unit/adapters/in_memory_adapter_spec.rb
101
- spec/unit/adapters/postgres_adapter_spec.rb
102
- spec/unit/associations/many_to_many_spec.rb
103
- spec/unit/associations/many_to_one_spec.rb
104
- spec/unit/associations/one_to_many_spec.rb
105
- spec/unit/associations/one_to_one_spec.rb
106
- spec/unit/associations/relationship_spec.rb
107
- spec/unit/associations_spec.rb
108
- spec/unit/auto_migrations_spec.rb
109
- spec/unit/collection_spec.rb
110
- spec/unit/data_mapper_spec.rb
111
- spec/unit/identity_map_spec.rb
112
- spec/unit/is_spec.rb
113
- spec/unit/migrator_spec.rb
114
- spec/unit/model_spec.rb
115
- spec/unit/naming_conventions_spec.rb
116
- spec/unit/property_set_spec.rb
117
- spec/unit/property_spec.rb
118
- spec/unit/query_spec.rb
119
- spec/unit/repository_spec.rb
120
- spec/unit/resource_spec.rb
121
- spec/unit/scope_spec.rb
122
- spec/unit/transaction_spec.rb
123
- spec/unit/type_map_spec.rb
124
- spec/unit/type_spec.rb
125
115
  tasks/ci.rb
126
116
  tasks/dm.rb
127
117
  tasks/doc.rb
data/QUICKLINKS CHANGED
@@ -6,6 +6,6 @@
6
6
  * FAQ[link:/files/FAQ.html]
7
7
  * Contact Us
8
8
  * Website - http://www.datamapper.org
9
- * Bug Reports - http://wm.lighthouseapp.com/projects/4819-datamapper/overview
9
+ * Bug Reports - http://datamapper.lighthouseapp.com
10
10
  * IRC Channel - <tt>##datamapper</tt> on irc.freenode.net
11
11
  * Mailing List - http://groups.google.com/group/datamapper/
data/README.txt CHANGED
@@ -8,8 +8,8 @@
8
8
  DataMapper sports a very accessible code-base and a welcoming community.
9
9
  Outside contributions and feedback are welcome and encouraged, especially
10
10
  constructive criticism. Make your voice heard! Submit a
11
- ticket[http://wm.lighthouseapp.com/projects/4819-datamapper/overview] or
12
- patch[http://wm.lighthouseapp.com/projects/4819-datamapper/overview], speak up
11
+ ticket[http://datamapper.lighthouseapp.com] or
12
+ patch[http://datamapper.lighthouseapp.com], speak up
13
13
  on our mailing-list[http://groups.google.com/group/datamapper/], chat with us
14
14
  on irc[irc://irc.freenode.net/#datamapper], write a spec, get it reviewed, ask
15
15
  for commit rights. It's as easy as that to become a contributor.
@@ -21,10 +21,12 @@ Pretty profound impact. If you run the following code in ActiveRecord you'll
21
21
  see all <tt>false</tt> results. Do the same in DataMapper and it's
22
22
  <tt>true</tt> all the way down.
23
23
 
24
- @parent = Tree.find(:first, :conditions => ['name = ?', 'bob'])
24
+ repository do
25
+ @parent = Tree.first(:name => 'bob')
25
26
 
26
- @parent.children.each do |child|
27
- puts @parent.object_id == child.parent.object_id
27
+ @parent.children.each do |child|
28
+ puts @parent.object_id == child.parent.object_id
29
+ end
28
30
  end
29
31
 
30
32
  This makes DataMapper faster and allocate less resources to get things done.
@@ -42,9 +44,11 @@ You can also configure which strategy you'd like to use to track dirtiness.
42
44
 
43
45
  Ready for something amazing? The following example executes only two queries.
44
46
 
45
- zoos = Zoo.all
46
- first = zoos.first
47
- first.exhibits # Loads the exhibits for all the Zoo objects in the zoos variable.
47
+ repository do
48
+ zoos = Zoo.all
49
+ first = zoos.first
50
+ first.exhibits # Loads the exhibits for all the Zoo objects in the zoos variable.
51
+ end
48
52
 
49
53
  Pretty impressive huh? The idea is that you aren't going to load a set of
50
54
  objects and use only an association in just one of them. This should hold up
@@ -71,6 +75,7 @@ text-fields) by passing a @lazy@ option to your field mapping with a value of
71
75
 
72
76
  class Animal
73
77
  include DataMapper::Resource
78
+
74
79
  property :name, String
75
80
  property :notes, Text, :lazy => false
76
81
  end
@@ -79,9 +84,11 @@ Plus, lazy-loading of text fields happens automatically and intelligently when
79
84
  working with associations. The following only issues 2 queries to load up all
80
85
  of the notes fields on each animal:
81
86
 
82
- animals = Animal.all
83
- animals.each do |pet|
84
- pet.notes
87
+ repository do
88
+ animals = Animal.all
89
+ animals.each do |pet|
90
+ pet.notes
91
+ end
85
92
  end
86
93
 
87
94
  == Plays Well With Others
@@ -131,13 +138,12 @@ need other comparisons though? Try these:
131
138
  Person.all(:name.not => 'bob')
132
139
 
133
140
  # If the value of a pair is an Array, we do an IN-clause for you.
134
- Person.all(:name.like => 'S%', :id => [1, 2, 3, 4, 5])
141
+ Person.all(:name.like => 'S%', :id => [ 1, 2, 3, 4, 5 ])
135
142
 
136
- # An alias for Zoo.find(11)
137
- Zoo[11]
143
+ Zoo.get(11)
138
144
 
139
145
  # Does a NOT IN () clause for you.
140
- Person.all(:name.not => ['bob','rick','steve'])
146
+ Person.all(:name.not => [ 'bob', 'rick', 'steve' ])
141
147
 
142
148
  See? Fewer SQL fragments dirtying your Ruby code. And that's just a few of the
143
149
  nice syntax tweaks DataMapper delivers out of the box...
data/Rakefile CHANGED
@@ -1,22 +1,21 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby -KU
2
+
2
3
  require 'pathname'
3
4
  require 'rubygems'
4
5
  require 'rake'
5
6
  require 'rake/rdoctask'
6
- require 'spec/rake/spectask'
7
-
8
- require 'lib/dm-core/version'
9
7
 
10
8
  ROOT = Pathname(__FILE__).dirname.expand_path
11
9
 
10
+ require ROOT + 'lib/dm-core/version'
11
+
12
12
  AUTHOR = 'Dan Kubb'
13
13
  EMAIL = 'dan.kubb@gmail.com'
14
14
  GEM_NAME = 'dm-core'
15
15
  GEM_VERSION = DataMapper::VERSION
16
16
  GEM_DEPENDENCIES = [
17
- %w[ data_objects ~>0.9.11 ],
18
- %w[ extlib ~>0.9.11 ],
19
- %w[ addressable ~>2.0.2 ],
17
+ %w[ extlib ~>0.9.13 ],
18
+ %w[ addressable ~>2.1 ],
20
19
  ]
21
20
 
22
21
  PROJECT_NAME = 'datamapper'