dm-core 1.0.2 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/Gemfile +28 -94
  2. data/LICENSE +1 -1
  3. data/README.rdoc +44 -11
  4. data/Rakefile +1 -7
  5. data/VERSION +1 -1
  6. data/dm-core.gemspec +398 -299
  7. data/lib/dm-core.rb +23 -13
  8. data/lib/dm-core/adapters/abstract_adapter.rb +1 -1
  9. data/lib/dm-core/associations/many_to_many.rb +1 -3
  10. data/lib/dm-core/associations/many_to_one.rb +54 -36
  11. data/lib/dm-core/associations/one_to_many.rb +1 -2
  12. data/lib/dm-core/associations/relationship.rb +11 -2
  13. data/lib/dm-core/collection.rb +3 -7
  14. data/lib/dm-core/core_ext/symbol.rb +1 -1
  15. data/lib/dm-core/identity_map.rb +0 -5
  16. data/lib/dm-core/model.rb +11 -21
  17. data/lib/dm-core/model/property.rb +43 -58
  18. data/lib/dm-core/model/relationship.rb +49 -44
  19. data/lib/dm-core/property.rb +106 -130
  20. data/lib/dm-core/property/date_time.rb +1 -3
  21. data/lib/dm-core/property/decimal.rb +11 -7
  22. data/lib/dm-core/property/integer.rb +2 -2
  23. data/lib/dm-core/property/lookup.rb +3 -16
  24. data/lib/dm-core/property/numeric.rb +3 -3
  25. data/lib/dm-core/property/object.rb +2 -11
  26. data/lib/dm-core/property/string.rb +1 -1
  27. data/lib/dm-core/property_set.rb +34 -54
  28. data/lib/dm-core/query.rb +85 -56
  29. data/lib/dm-core/query/conditions/comparison.rb +3 -6
  30. data/lib/dm-core/query/direction.rb +0 -4
  31. data/lib/dm-core/query/path.rb +22 -6
  32. data/lib/dm-core/relationship_set.rb +74 -0
  33. data/lib/dm-core/resource.rb +21 -32
  34. data/lib/dm-core/resource/state.rb +3 -4
  35. data/lib/dm-core/spec/lib/spec_helper.rb +1 -4
  36. data/lib/dm-core/spec/setup.rb +12 -5
  37. data/lib/dm-core/spec/shared/public/property_spec.rb +35 -21
  38. data/lib/dm-core/spec/shared/resource_spec.rb +1 -1
  39. data/lib/dm-core/spec/shared/semipublic/property_spec.rb +9 -9
  40. data/lib/dm-core/spec/shared/semipublic/query/conditions/abstract_comparison_spec.rb +261 -0
  41. data/lib/dm-core/support/deprecate.rb +1 -1
  42. data/lib/dm-core/support/descendant_set.rb +12 -5
  43. data/lib/dm-core/support/ordered_set.rb +382 -0
  44. data/lib/dm-core/support/subject_set.rb +252 -0
  45. data/lib/dm-core/version.rb +1 -1
  46. data/spec/public/associations/many_to_many/read_multiple_join_spec.rb +1 -2
  47. data/spec/public/associations/many_to_many_spec.rb +11 -9
  48. data/spec/public/associations/many_to_one_spec.rb +1 -1
  49. data/spec/public/associations/many_to_one_with_boolean_cpk_spec.rb +1 -1
  50. data/spec/public/associations/many_to_one_with_custom_fk_spec.rb +2 -2
  51. data/spec/public/associations/one_to_many_spec.rb +6 -5
  52. data/spec/public/associations/one_to_one_spec.rb +1 -1
  53. data/spec/public/associations/one_to_one_with_boolean_cpk_spec.rb +1 -1
  54. data/spec/public/collection_spec.rb +7 -6
  55. data/spec/public/finalize_spec.rb +1 -1
  56. data/spec/public/model/hook_spec.rb +4 -3
  57. data/spec/public/model/property_spec.rb +9 -3
  58. data/spec/public/model/relationship_spec.rb +2 -4
  59. data/spec/public/model_spec.rb +1 -1
  60. data/spec/public/property/binary_spec.rb +1 -1
  61. data/spec/public/property/boolean_spec.rb +1 -1
  62. data/spec/public/property/class_spec.rb +1 -1
  63. data/spec/public/property/date_spec.rb +1 -1
  64. data/spec/public/property/date_time_spec.rb +1 -1
  65. data/spec/public/property/decimal_spec.rb +7 -6
  66. data/spec/public/property/discriminator_spec.rb +1 -1
  67. data/spec/public/property/float_spec.rb +1 -1
  68. data/spec/public/property/integer_spec.rb +1 -1
  69. data/spec/public/property/object_spec.rb +2 -2
  70. data/spec/public/property/serial_spec.rb +1 -1
  71. data/spec/public/property/string_spec.rb +1 -1
  72. data/spec/public/property/text_spec.rb +6 -3
  73. data/spec/public/property/time_spec.rb +1 -1
  74. data/spec/public/property_spec.rb +13 -11
  75. data/spec/public/resource_spec.rb +43 -1
  76. data/spec/public/sel_spec.rb +1 -1
  77. data/spec/public/setup_spec.rb +1 -1
  78. data/spec/public/shared/collection_shared_spec.rb +6 -1
  79. data/spec/semipublic/adapters/abstract_adapter_spec.rb +1 -1
  80. data/spec/semipublic/adapters/in_memory_adapter_spec.rb +1 -1
  81. data/spec/semipublic/associations/many_to_many_spec.rb +1 -1
  82. data/spec/semipublic/associations/many_to_one_spec.rb +1 -1
  83. data/spec/semipublic/associations/one_to_many_spec.rb +1 -1
  84. data/spec/semipublic/associations/one_to_one_spec.rb +1 -1
  85. data/spec/semipublic/associations/relationship_spec.rb +1 -1
  86. data/spec/semipublic/associations_spec.rb +1 -1
  87. data/spec/semipublic/collection_spec.rb +1 -1
  88. data/spec/semipublic/model_spec.rb +1 -1
  89. data/spec/semipublic/property/binary_spec.rb +1 -1
  90. data/spec/semipublic/property/boolean_spec.rb +1 -1
  91. data/spec/semipublic/property/class_spec.rb +1 -1
  92. data/spec/semipublic/property/date_spec.rb +1 -1
  93. data/spec/semipublic/property/date_time_spec.rb +1 -1
  94. data/spec/semipublic/property/decimal_spec.rb +6 -5
  95. data/spec/semipublic/property/discriminator_spec.rb +1 -1
  96. data/spec/semipublic/property/float_spec.rb +1 -1
  97. data/spec/semipublic/property/integer_spec.rb +1 -1
  98. data/spec/semipublic/property/lookup_spec.rb +8 -5
  99. data/spec/semipublic/property/serial_spec.rb +1 -1
  100. data/spec/semipublic/property/string_spec.rb +1 -1
  101. data/spec/semipublic/property/text_spec.rb +1 -1
  102. data/spec/semipublic/property/time_spec.rb +1 -1
  103. data/spec/semipublic/property_spec.rb +32 -7
  104. data/spec/semipublic/query/conditions/comparison_spec.rb +1 -264
  105. data/spec/semipublic/query/conditions/operation_spec.rb +1 -2
  106. data/spec/semipublic/query/path_spec.rb +27 -1
  107. data/spec/semipublic/query_spec.rb +87 -36
  108. data/spec/semipublic/resource/state/clean_spec.rb +1 -2
  109. data/spec/semipublic/resource/state/deleted_spec.rb +1 -2
  110. data/spec/semipublic/resource/state/dirty_spec.rb +1 -2
  111. data/spec/semipublic/resource/state/immutable_spec.rb +1 -2
  112. data/spec/semipublic/resource/state/transient_spec.rb +7 -2
  113. data/spec/semipublic/resource/state_spec.rb +1 -1
  114. data/spec/semipublic/resource_spec.rb +1 -1
  115. data/spec/unit/array_spec.rb +1 -0
  116. data/spec/unit/data_mapper/ordered_set/append_spec.rb +26 -0
  117. data/spec/unit/data_mapper/ordered_set/clear_spec.rb +24 -0
  118. data/spec/unit/data_mapper/ordered_set/delete_spec.rb +28 -0
  119. data/spec/unit/data_mapper/ordered_set/each_spec.rb +19 -0
  120. data/spec/unit/data_mapper/ordered_set/empty_spec.rb +20 -0
  121. data/spec/unit/data_mapper/ordered_set/entries_spec.rb +22 -0
  122. data/spec/unit/data_mapper/ordered_set/eql_spec.rb +51 -0
  123. data/spec/unit/data_mapper/ordered_set/equal_value_spec.rb +84 -0
  124. data/spec/unit/data_mapper/ordered_set/hash_spec.rb +12 -0
  125. data/spec/unit/data_mapper/ordered_set/include_spec.rb +23 -0
  126. data/spec/unit/data_mapper/ordered_set/index_spec.rb +28 -0
  127. data/spec/unit/data_mapper/ordered_set/initialize_spec.rb +32 -0
  128. data/spec/unit/data_mapper/ordered_set/merge_spec.rb +36 -0
  129. data/spec/unit/data_mapper/ordered_set/shared/append_spec.rb +24 -0
  130. data/spec/unit/data_mapper/ordered_set/shared/clear_spec.rb +9 -0
  131. data/spec/unit/data_mapper/ordered_set/shared/delete_spec.rb +25 -0
  132. data/spec/unit/data_mapper/ordered_set/shared/each_spec.rb +17 -0
  133. data/spec/unit/data_mapper/ordered_set/shared/empty_spec.rb +9 -0
  134. data/spec/unit/data_mapper/ordered_set/shared/entries_spec.rb +9 -0
  135. data/spec/unit/data_mapper/ordered_set/shared/include_spec.rb +9 -0
  136. data/spec/unit/data_mapper/ordered_set/shared/index_spec.rb +13 -0
  137. data/spec/unit/data_mapper/ordered_set/shared/initialize_spec.rb +28 -0
  138. data/spec/unit/data_mapper/ordered_set/shared/merge_spec.rb +28 -0
  139. data/spec/unit/data_mapper/ordered_set/shared/size_spec.rb +13 -0
  140. data/spec/unit/data_mapper/ordered_set/shared/to_ary_spec.rb +11 -0
  141. data/spec/unit/data_mapper/ordered_set/size_spec.rb +27 -0
  142. data/spec/unit/data_mapper/ordered_set/to_ary_spec.rb +23 -0
  143. data/spec/unit/data_mapper/subject_set/append_spec.rb +47 -0
  144. data/spec/unit/data_mapper/subject_set/clear_spec.rb +34 -0
  145. data/spec/unit/data_mapper/subject_set/delete_spec.rb +40 -0
  146. data/spec/unit/data_mapper/subject_set/each_spec.rb +30 -0
  147. data/spec/unit/data_mapper/subject_set/empty_spec.rb +31 -0
  148. data/spec/unit/data_mapper/subject_set/entries_spec.rb +31 -0
  149. data/spec/unit/data_mapper/subject_set/get_spec.rb +34 -0
  150. data/spec/unit/data_mapper/subject_set/include_spec.rb +32 -0
  151. data/spec/unit/data_mapper/subject_set/named_spec.rb +33 -0
  152. data/spec/unit/data_mapper/subject_set/shared/append_spec.rb +18 -0
  153. data/spec/unit/data_mapper/subject_set/shared/clear_spec.rb +9 -0
  154. data/spec/unit/data_mapper/subject_set/shared/delete_spec.rb +9 -0
  155. data/spec/unit/data_mapper/subject_set/shared/each_spec.rb +9 -0
  156. data/spec/unit/data_mapper/subject_set/shared/empty_spec.rb +9 -0
  157. data/spec/unit/data_mapper/subject_set/shared/entries_spec.rb +9 -0
  158. data/spec/unit/data_mapper/subject_set/shared/get_spec.rb +9 -0
  159. data/spec/unit/data_mapper/subject_set/shared/include_spec.rb +9 -0
  160. data/spec/unit/data_mapper/subject_set/shared/named_spec.rb +9 -0
  161. data/spec/unit/data_mapper/subject_set/shared/size_spec.rb +13 -0
  162. data/spec/unit/data_mapper/subject_set/shared/to_ary_spec.rb +9 -0
  163. data/spec/unit/data_mapper/subject_set/shared/values_at_spec.rb +44 -0
  164. data/spec/unit/data_mapper/subject_set/size_spec.rb +42 -0
  165. data/spec/unit/data_mapper/subject_set/to_ary_spec.rb +34 -0
  166. data/spec/unit/data_mapper/subject_set/values_at_spec.rb +57 -0
  167. data/spec/unit/hash_spec.rb +2 -1
  168. data/spec/unit/hook_spec.rb +1 -0
  169. data/spec/unit/lazy_array_spec.rb +2 -1
  170. data/spec/unit/module_spec.rb +2 -1
  171. data/spec/unit/object_spec.rb +1 -0
  172. data/spec/unit/try_dup_spec.rb +1 -0
  173. data/tasks/spec.rake +0 -3
  174. metadata +149 -52
  175. data/.gitignore +0 -37
  176. data/lib/dm-core/type.rb +0 -216
  177. data/lib/dm-core/types/boolean.rb +0 -9
  178. data/lib/dm-core/types/decimal.rb +0 -9
  179. data/lib/dm-core/types/discriminator.rb +0 -50
  180. data/lib/dm-core/types/object.rb +0 -25
  181. data/lib/dm-core/types/serial.rb +0 -11
  182. data/lib/dm-core/types/text.rb +0 -11
  183. data/tasks/local_gemfile.rake +0 -16
  184. data/tasks/metrics.rake +0 -37
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/core_ext/hash'
2
3
 
3
4
  begin
@@ -24,7 +25,7 @@ end
24
25
 
25
26
 
26
27
  describe Hash, 'to_mash' do
27
- before :each do
28
+ before do
28
29
  @hash = Hash.new(10)
29
30
  end
30
31
 
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/support/hook'
2
3
 
3
4
  describe DataMapper::Hook do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/support/lazy_array'
2
3
 
3
4
  # only needed for specs
@@ -1953,7 +1954,7 @@ end
1953
1954
  describe 'an unknown method' do
1954
1955
  action { subject.unknown }
1955
1956
 
1956
- should_raise_error(NoMethodError)
1957
+ should_raise_error(NameError)
1957
1958
  end
1958
1959
  end
1959
1960
  end
@@ -1,8 +1,9 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/core_ext/module'
2
3
 
3
4
  describe Module do
4
5
 
5
- before(:all) do
6
+ before :all do
6
7
  Object.send(:remove_const, :Foo) if defined?(Foo)
7
8
  Object.send(:remove_const, :Baz) if defined?(Baz)
8
9
  Object.send(:remove_const, :Bar) if defined?(Bar)
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/core_ext/object'
2
3
 
3
4
  describe Object do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'dm-core/core_ext/try_dup'
2
3
 
3
4
  describe "try_dup" do
@@ -35,7 +35,4 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
39
- task :rcov => :check_dependencies
40
-
41
38
  task :default => :spec
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 2
9
- version: 1.0.2
4
+ prerelease: 6
5
+ version: 1.1.0.rc1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Dan Kubb
@@ -14,66 +10,75 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-09-07 00:00:00 -07:00
13
+ date: 2011-02-28 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
- name: extlib
22
- prerelease: false
17
+ name: activesupport
23
18
  requirement: &id001 !ruby/object:Gem::Requirement
24
19
  none: false
25
20
  requirements:
26
21
  - - ~>
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 9
31
- - 15
32
- version: 0.9.15
23
+ version: 3.0.4
33
24
  type: :runtime
25
+ prerelease: false
34
26
  version_requirements: *id001
35
27
  - !ruby/object:Gem::Dependency
36
- name: addressable
37
- prerelease: false
28
+ name: i18n
38
29
  requirement: &id002 !ruby/object:Gem::Requirement
39
30
  none: false
40
31
  requirements:
41
32
  - - ~>
42
33
  - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 2
46
- version: "2.2"
34
+ version: 0.5.0
47
35
  type: :runtime
36
+ prerelease: false
48
37
  version_requirements: *id002
49
38
  - !ruby/object:Gem::Dependency
50
- name: rspec
51
- prerelease: false
39
+ name: addressable
52
40
  requirement: &id003 !ruby/object:Gem::Requirement
53
41
  none: false
54
42
  requirements:
55
43
  - - ~>
56
44
  - !ruby/object:Gem::Version
57
- segments:
58
- - 1
59
- - 3
60
- version: "1.3"
61
- type: :development
45
+ version: "2.2"
46
+ type: :runtime
47
+ prerelease: false
62
48
  version_requirements: *id003
63
49
  - !ruby/object:Gem::Dependency
64
50
  name: jeweler
65
- prerelease: false
66
51
  requirement: &id004 !ruby/object:Gem::Requirement
67
52
  none: false
68
53
  requirements:
69
54
  - - ~>
70
55
  - !ruby/object:Gem::Version
71
- segments:
72
- - 1
73
- - 4
74
- version: "1.4"
56
+ version: 1.5.2
75
57
  type: :development
58
+ prerelease: false
76
59
  version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.8.7
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: rspec
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 1.3.1
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *id006
77
82
  description: Faster, Better, Simpler.
78
83
  email: dan.kubb@gmail.com
79
84
  executables: []
@@ -86,7 +91,6 @@ extra_rdoc_files:
86
91
  files:
87
92
  - .autotest
88
93
  - .document
89
- - .gitignore
90
94
  - Gemfile
91
95
  - LICENSE
92
96
  - README.rdoc
@@ -146,6 +150,7 @@ files:
146
150
  - lib/dm-core/query/operator.rb
147
151
  - lib/dm-core/query/path.rb
148
152
  - lib/dm-core/query/sort.rb
153
+ - lib/dm-core/relationship_set.rb
149
154
  - lib/dm-core/repository.rb
150
155
  - lib/dm-core/resource.rb
151
156
  - lib/dm-core/resource/state.rb
@@ -166,6 +171,7 @@ files:
166
171
  - lib/dm-core/spec/shared/resource_spec.rb
167
172
  - lib/dm-core/spec/shared/sel_spec.rb
168
173
  - lib/dm-core/spec/shared/semipublic/property_spec.rb
174
+ - lib/dm-core/spec/shared/semipublic/query/conditions/abstract_comparison_spec.rb
169
175
  - lib/dm-core/support/assertions.rb
170
176
  - lib/dm-core/support/chainable.rb
171
177
  - lib/dm-core/support/deprecate.rb
@@ -176,14 +182,9 @@ files:
176
182
  - lib/dm-core/support/local_object_space.rb
177
183
  - lib/dm-core/support/logger.rb
178
184
  - lib/dm-core/support/naming_conventions.rb
185
+ - lib/dm-core/support/ordered_set.rb
179
186
  - lib/dm-core/support/subject.rb
180
- - lib/dm-core/type.rb
181
- - lib/dm-core/types/boolean.rb
182
- - lib/dm-core/types/decimal.rb
183
- - lib/dm-core/types/discriminator.rb
184
- - lib/dm-core/types/object.rb
185
- - lib/dm-core/types/serial.rb
186
- - lib/dm-core/types/text.rb
187
+ - lib/dm-core/support/subject_set.rb
187
188
  - lib/dm-core/version.rb
188
189
  - script/performance.rb
189
190
  - script/profile.rb
@@ -269,6 +270,57 @@ files:
269
270
  - spec/spec_helper.rb
270
271
  - spec/support/properties/huge_integer.rb
271
272
  - spec/unit/array_spec.rb
273
+ - spec/unit/data_mapper/ordered_set/append_spec.rb
274
+ - spec/unit/data_mapper/ordered_set/clear_spec.rb
275
+ - spec/unit/data_mapper/ordered_set/delete_spec.rb
276
+ - spec/unit/data_mapper/ordered_set/each_spec.rb
277
+ - spec/unit/data_mapper/ordered_set/empty_spec.rb
278
+ - spec/unit/data_mapper/ordered_set/entries_spec.rb
279
+ - spec/unit/data_mapper/ordered_set/eql_spec.rb
280
+ - spec/unit/data_mapper/ordered_set/equal_value_spec.rb
281
+ - spec/unit/data_mapper/ordered_set/hash_spec.rb
282
+ - spec/unit/data_mapper/ordered_set/include_spec.rb
283
+ - spec/unit/data_mapper/ordered_set/index_spec.rb
284
+ - spec/unit/data_mapper/ordered_set/initialize_spec.rb
285
+ - spec/unit/data_mapper/ordered_set/merge_spec.rb
286
+ - spec/unit/data_mapper/ordered_set/shared/append_spec.rb
287
+ - spec/unit/data_mapper/ordered_set/shared/clear_spec.rb
288
+ - spec/unit/data_mapper/ordered_set/shared/delete_spec.rb
289
+ - spec/unit/data_mapper/ordered_set/shared/each_spec.rb
290
+ - spec/unit/data_mapper/ordered_set/shared/empty_spec.rb
291
+ - spec/unit/data_mapper/ordered_set/shared/entries_spec.rb
292
+ - spec/unit/data_mapper/ordered_set/shared/include_spec.rb
293
+ - spec/unit/data_mapper/ordered_set/shared/index_spec.rb
294
+ - spec/unit/data_mapper/ordered_set/shared/initialize_spec.rb
295
+ - spec/unit/data_mapper/ordered_set/shared/merge_spec.rb
296
+ - spec/unit/data_mapper/ordered_set/shared/size_spec.rb
297
+ - spec/unit/data_mapper/ordered_set/shared/to_ary_spec.rb
298
+ - spec/unit/data_mapper/ordered_set/size_spec.rb
299
+ - spec/unit/data_mapper/ordered_set/to_ary_spec.rb
300
+ - spec/unit/data_mapper/subject_set/append_spec.rb
301
+ - spec/unit/data_mapper/subject_set/clear_spec.rb
302
+ - spec/unit/data_mapper/subject_set/delete_spec.rb
303
+ - spec/unit/data_mapper/subject_set/each_spec.rb
304
+ - spec/unit/data_mapper/subject_set/empty_spec.rb
305
+ - spec/unit/data_mapper/subject_set/entries_spec.rb
306
+ - spec/unit/data_mapper/subject_set/get_spec.rb
307
+ - spec/unit/data_mapper/subject_set/include_spec.rb
308
+ - spec/unit/data_mapper/subject_set/named_spec.rb
309
+ - spec/unit/data_mapper/subject_set/shared/append_spec.rb
310
+ - spec/unit/data_mapper/subject_set/shared/clear_spec.rb
311
+ - spec/unit/data_mapper/subject_set/shared/delete_spec.rb
312
+ - spec/unit/data_mapper/subject_set/shared/each_spec.rb
313
+ - spec/unit/data_mapper/subject_set/shared/empty_spec.rb
314
+ - spec/unit/data_mapper/subject_set/shared/entries_spec.rb
315
+ - spec/unit/data_mapper/subject_set/shared/get_spec.rb
316
+ - spec/unit/data_mapper/subject_set/shared/include_spec.rb
317
+ - spec/unit/data_mapper/subject_set/shared/named_spec.rb
318
+ - spec/unit/data_mapper/subject_set/shared/size_spec.rb
319
+ - spec/unit/data_mapper/subject_set/shared/to_ary_spec.rb
320
+ - spec/unit/data_mapper/subject_set/shared/values_at_spec.rb
321
+ - spec/unit/data_mapper/subject_set/size_spec.rb
322
+ - spec/unit/data_mapper/subject_set/to_ary_spec.rb
323
+ - spec/unit/data_mapper/subject_set/values_at_spec.rb
272
324
  - spec/unit/hash_spec.rb
273
325
  - spec/unit/hook_spec.rb
274
326
  - spec/unit/lazy_array_spec.rb
@@ -276,18 +328,16 @@ files:
276
328
  - spec/unit/object_spec.rb
277
329
  - spec/unit/try_dup_spec.rb
278
330
  - tasks/ci.rake
279
- - tasks/local_gemfile.rake
280
- - tasks/metrics.rake
281
331
  - tasks/spec.rake
282
332
  - tasks/yard.rake
283
333
  - tasks/yardstick.rake
284
- has_rdoc: yard
334
+ has_rdoc: true
285
335
  homepage: http://github.com/datamapper/dm-core
286
336
  licenses: []
287
337
 
288
338
  post_install_message:
289
- rdoc_options:
290
- - --charset=UTF-8
339
+ rdoc_options: []
340
+
291
341
  require_paths:
292
342
  - lib
293
343
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -295,21 +345,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
295
345
  requirements:
296
346
  - - ">="
297
347
  - !ruby/object:Gem::Version
298
- segments:
299
- - 0
300
348
  version: "0"
301
349
  required_rubygems_version: !ruby/object:Gem::Requirement
302
350
  none: false
303
351
  requirements:
304
- - - ">="
352
+ - - ">"
305
353
  - !ruby/object:Gem::Version
306
- segments:
307
- - 0
308
- version: "0"
354
+ version: 1.3.1
309
355
  requirements: []
310
356
 
311
357
  rubyforge_project: datamapper
312
- rubygems_version: 1.3.7
358
+ rubygems_version: 1.5.2
313
359
  signing_key:
314
360
  specification_version: 3
315
361
  summary: An Object/Relational Mapper for Ruby
@@ -394,6 +440,57 @@ test_files:
394
440
  - spec/spec_helper.rb
395
441
  - spec/support/properties/huge_integer.rb
396
442
  - spec/unit/array_spec.rb
443
+ - spec/unit/data_mapper/ordered_set/append_spec.rb
444
+ - spec/unit/data_mapper/ordered_set/clear_spec.rb
445
+ - spec/unit/data_mapper/ordered_set/delete_spec.rb
446
+ - spec/unit/data_mapper/ordered_set/each_spec.rb
447
+ - spec/unit/data_mapper/ordered_set/empty_spec.rb
448
+ - spec/unit/data_mapper/ordered_set/entries_spec.rb
449
+ - spec/unit/data_mapper/ordered_set/eql_spec.rb
450
+ - spec/unit/data_mapper/ordered_set/equal_value_spec.rb
451
+ - spec/unit/data_mapper/ordered_set/hash_spec.rb
452
+ - spec/unit/data_mapper/ordered_set/include_spec.rb
453
+ - spec/unit/data_mapper/ordered_set/index_spec.rb
454
+ - spec/unit/data_mapper/ordered_set/initialize_spec.rb
455
+ - spec/unit/data_mapper/ordered_set/merge_spec.rb
456
+ - spec/unit/data_mapper/ordered_set/shared/append_spec.rb
457
+ - spec/unit/data_mapper/ordered_set/shared/clear_spec.rb
458
+ - spec/unit/data_mapper/ordered_set/shared/delete_spec.rb
459
+ - spec/unit/data_mapper/ordered_set/shared/each_spec.rb
460
+ - spec/unit/data_mapper/ordered_set/shared/empty_spec.rb
461
+ - spec/unit/data_mapper/ordered_set/shared/entries_spec.rb
462
+ - spec/unit/data_mapper/ordered_set/shared/include_spec.rb
463
+ - spec/unit/data_mapper/ordered_set/shared/index_spec.rb
464
+ - spec/unit/data_mapper/ordered_set/shared/initialize_spec.rb
465
+ - spec/unit/data_mapper/ordered_set/shared/merge_spec.rb
466
+ - spec/unit/data_mapper/ordered_set/shared/size_spec.rb
467
+ - spec/unit/data_mapper/ordered_set/shared/to_ary_spec.rb
468
+ - spec/unit/data_mapper/ordered_set/size_spec.rb
469
+ - spec/unit/data_mapper/ordered_set/to_ary_spec.rb
470
+ - spec/unit/data_mapper/subject_set/append_spec.rb
471
+ - spec/unit/data_mapper/subject_set/clear_spec.rb
472
+ - spec/unit/data_mapper/subject_set/delete_spec.rb
473
+ - spec/unit/data_mapper/subject_set/each_spec.rb
474
+ - spec/unit/data_mapper/subject_set/empty_spec.rb
475
+ - spec/unit/data_mapper/subject_set/entries_spec.rb
476
+ - spec/unit/data_mapper/subject_set/get_spec.rb
477
+ - spec/unit/data_mapper/subject_set/include_spec.rb
478
+ - spec/unit/data_mapper/subject_set/named_spec.rb
479
+ - spec/unit/data_mapper/subject_set/shared/append_spec.rb
480
+ - spec/unit/data_mapper/subject_set/shared/clear_spec.rb
481
+ - spec/unit/data_mapper/subject_set/shared/delete_spec.rb
482
+ - spec/unit/data_mapper/subject_set/shared/each_spec.rb
483
+ - spec/unit/data_mapper/subject_set/shared/empty_spec.rb
484
+ - spec/unit/data_mapper/subject_set/shared/entries_spec.rb
485
+ - spec/unit/data_mapper/subject_set/shared/get_spec.rb
486
+ - spec/unit/data_mapper/subject_set/shared/include_spec.rb
487
+ - spec/unit/data_mapper/subject_set/shared/named_spec.rb
488
+ - spec/unit/data_mapper/subject_set/shared/size_spec.rb
489
+ - spec/unit/data_mapper/subject_set/shared/to_ary_spec.rb
490
+ - spec/unit/data_mapper/subject_set/shared/values_at_spec.rb
491
+ - spec/unit/data_mapper/subject_set/size_spec.rb
492
+ - spec/unit/data_mapper/subject_set/to_ary_spec.rb
493
+ - spec/unit/data_mapper/subject_set/values_at_spec.rb
397
494
  - spec/unit/hash_spec.rb
398
495
  - spec/unit/hook_spec.rb
399
496
  - spec/unit/lazy_array_spec.rb
data/.gitignore DELETED
@@ -1,37 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## Rubinius
17
- *.rbc
18
-
19
- ## PROJECT::GENERAL
20
- *.gem
21
- coverage
22
- rdoc
23
- pkg
24
- tmp
25
- doc
26
- log
27
- .yardoc
28
- measurements
29
-
30
- ## BUNDLER
31
- .bundle
32
- Gemfile.local
33
- Gemfile.lock
34
- Gemfile.local.lock
35
-
36
- ## PROJECT::SPECIFIC
37
- spec/db/
@@ -1,216 +0,0 @@
1
- module DataMapper
2
-
3
- # = Types
4
- # Provides means of writing custom types for properties. Each type is based
5
- # on a ruby primitive and handles its own serialization and materialization,
6
- # and therefore is responsible for providing those methods.
7
- #
8
- # To see complete list of supported types, see documentation for
9
- # Property::PRIMITIVES. dm-types library provides less common
10
- # types such as ip address, uuid, json, yaml, uri, slug, version,
11
- # file path, bcrypt hash and so forth.
12
- #
13
- # == Defining new Types
14
- # To define a new type, subclass DataMapper::Type, pick ruby primitive, and
15
- # set the options for this type.
16
- #
17
- # class LowerCase < DataMapper::Type
18
- # primitive String
19
- # auto_validation true
20
- # length 255
21
- # end
22
- #
23
- # Following this, you will be able to use LowerCase as a type for any given
24
- # property. If special materialization and serialization is required,
25
- # override the class methods
26
- #
27
- # class LowerCase < DataMapper::Type
28
- # primitive String
29
- # auto_validation true
30
- # length 255
31
- #
32
- # def self.dump(value, property)
33
- # return nil unless value
34
- # value.to_s.downcase
35
- # end
36
- #
37
- # def self.load(value)
38
- # value
39
- # end
40
- # end
41
- #
42
- # Properties of LowerCase type now will downcase it's values before
43
- # it is persisted to the storage.
44
- #
45
- # One more real world example from dm-types library is a JSON type
46
- # that stores values serialized as JSON, and often useful for embedded
47
- # values:
48
- #
49
- #
50
- # module DataMapper
51
- # module Types
52
- # class Json < DataMapper::Type
53
- # primitive String
54
- # length 65535
55
- # lazy true
56
- #
57
- # def self.load(value, property)
58
- # if value.nil?
59
- # nil
60
- # elsif value.kind_of?(String)
61
- # ::JSON.load(value)
62
- # else
63
- # raise ArgumentError, '+value+ of a property of JSON type must be nil or a String'
64
- # end
65
- # end
66
- #
67
- # def self.dump(value, property)
68
- # if value.nil? || value.kind_of?(String)
69
- # value
70
- # else
71
- # ::JSON.dump(value)
72
- # end
73
- # end
74
- #
75
- # def self.typecast(value, property)
76
- # if value.nil? || value.kind_of?(Array) || value.kind_of?(Hash)
77
- # value
78
- # else
79
- # ::JSON.load(value.to_s)
80
- # end
81
- # end
82
- # end # class Json
83
- # JSON = Json
84
- # end # module Types
85
- # end # module DataMapper
86
-
87
- # TODO: this is only for the backward compatibility in case someone's subclassing from one of the deprecated types
88
- module Types; end
89
-
90
- class Type
91
- # Until cooperation of Property and Type does not change, each must
92
- # have a separate list of options, because plugins (ex.: dm-validations)
93
- # may want to extend one or the other, and expects no side effects
94
- PROPERTY_OPTIONS = [
95
- :accessor, :reader, :writer,
96
- :lazy, :default, :key, :serial, :field, :size, :length,
97
- :format, :index, :unique_index, :auto_validation,
98
- :validates, :unique, :precision, :scale, :min, :max,
99
- :allow_nil, :allow_blank, :required
100
- ]
101
-
102
- class << self
103
- # @api private
104
- def configure(primitive_type, options)
105
- warn "DataMapper.Type.configure is deprecated, specify the primitive and options explicitly (#{caller[0]})"
106
-
107
- @_primitive_type = primitive_type
108
- @_options = options
109
-
110
- def self.inherited(base)
111
- base.primitive @_primitive_type
112
- @_options.each { |key, value| base.send(key, value) }
113
- end
114
-
115
- self
116
- end
117
-
118
- # Ruby primitive type to use as basis for this type. See
119
- # Property::PRIMITIVES for list of types.
120
- #
121
- # @param primitive [Class, nil]
122
- # The class for the primitive. If nil is passed in, it returns the
123
- # current primitive
124
- #
125
- # @return [Class] if the <primitive> param is nil, return the current primitive.
126
- #
127
- # @api public
128
- def primitive(primitive = nil)
129
- return @primitive if primitive.nil?
130
- @primitive = primitive
131
-
132
- return unless @primitive.respond_to?(:options)
133
- options = @primitive.options
134
-
135
- return unless options.respond_to?(:each)
136
-
137
- # inherit the options from the primitive if any
138
- options.each do |key, value|
139
- send(key, value) unless send(key)
140
- end
141
- end
142
-
143
- # Load Property options
144
- PROPERTY_OPTIONS.each do |property_option|
145
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
146
- def #{property_option}(*args) # def unique(*args)
147
- if args.any? # if args.any?
148
- @#{property_option} = args.first # @unique = args.first
149
- else # else
150
- defined?(@#{property_option}) ? @#{property_option} : nil # defined?(@unique) ? @unique : nil
151
- end # end
152
- end # end
153
- RUBY
154
- end
155
-
156
- def nullable(value)
157
- # :required is preferable to :allow_nil, but :nullable maps precisely to :allow_nil
158
- warn "#nullable is deprecated, use #required instead (#{caller[0]})"
159
- allow_nil(value)
160
- end
161
-
162
- # Gives all the options set on this type
163
- #
164
- # @return [Hash] with all options and their values set on this type
165
- #
166
- # @api public
167
- def options
168
- options = {}
169
- PROPERTY_OPTIONS.each do |method|
170
- next if (value = send(method)).nil?
171
- options[method] = value
172
- end
173
- options
174
- end
175
- end
176
-
177
- # Stub instance method for dumping
178
- #
179
- # @param value [Object, nil] value to dump
180
- # @param property [Property, nil] property the type is being used by
181
- #
182
- # @return [Object] Dumped object
183
- #
184
- # @api public
185
- def self.dump(value, property)
186
- value
187
- end
188
-
189
- # Stub instance method for loading
190
- #
191
- # @param value [Object, nil] value to serialize
192
- # @param property [Property, nil] property the type is being used by
193
- #
194
- # @return [Object] Serialized object. Must be the same type as the Ruby primitive
195
- #
196
- # @api public
197
- def self.load(value, property)
198
- value
199
- end
200
-
201
- # A hook to allow types to extend or modify property it's bound to.
202
- # Implementations are not supposed to modify the state of the type class, and
203
- # should produce no side-effects on the type class.
204
- def self.bind(property)
205
- # no op
206
- end
207
-
208
- end # class Type
209
-
210
- # @deprecated
211
- def self.Type(primitive_type, options = {})
212
- warn "DataMapper.Type(#{primitive_type}) is deprecated, specify the primitive and options explicitly (#{caller[0]})"
213
- Class.new(Type).configure(primitive_type, options)
214
- end
215
-
216
- end # module DataMapper