mongoid 1.2.14 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. data/lib/mongoid.rb +10 -3
  2. data/lib/mongoid/associations.rb +133 -97
  3. data/lib/mongoid/associations/belongs_to_related.rb +2 -3
  4. data/lib/mongoid/associations/{belongs_to.rb → embedded_in.rb} +14 -6
  5. data/lib/mongoid/associations/{has_many.rb → embeds_many.rb} +89 -31
  6. data/lib/mongoid/associations/{has_one.rb → embeds_one.rb} +8 -7
  7. data/lib/mongoid/associations/has_many_related.rb +52 -7
  8. data/lib/mongoid/associations/has_one_related.rb +8 -4
  9. data/lib/mongoid/associations/meta_data.rb +2 -1
  10. data/lib/mongoid/associations/options.rb +6 -1
  11. data/lib/mongoid/associations/proxy.rb +14 -21
  12. data/lib/mongoid/attributes.rb +27 -12
  13. data/lib/mongoid/collection.rb +4 -3
  14. data/lib/mongoid/collections.rb +41 -0
  15. data/lib/mongoid/collections/master.rb +3 -2
  16. data/lib/mongoid/collections/slaves.rb +3 -2
  17. data/lib/mongoid/components.rb +21 -19
  18. data/lib/mongoid/concern.rb +31 -0
  19. data/lib/mongoid/config.rb +117 -12
  20. data/lib/mongoid/contexts.rb +1 -1
  21. data/lib/mongoid/contexts/enumerable.rb +1 -1
  22. data/lib/mongoid/contexts/mongo.rb +1 -1
  23. data/lib/mongoid/contexts/paging.rb +10 -2
  24. data/lib/mongoid/criterion/inclusion.rb +17 -0
  25. data/lib/mongoid/criterion/optional.rb +1 -1
  26. data/lib/mongoid/dirty.rb +253 -0
  27. data/lib/mongoid/document.rb +81 -52
  28. data/lib/mongoid/errors.rb +32 -1
  29. data/lib/mongoid/extensions.rb +11 -9
  30. data/lib/mongoid/extensions/big_decimal/conversions.rb +2 -2
  31. data/lib/mongoid/extensions/boolean/conversions.rb +8 -2
  32. data/lib/mongoid/extensions/date/conversions.rb +13 -4
  33. data/lib/mongoid/extensions/datetime/conversions.rb +1 -6
  34. data/lib/mongoid/extensions/float/conversions.rb +5 -1
  35. data/lib/mongoid/extensions/hash/assimilation.rb +12 -3
  36. data/lib/mongoid/extensions/hash/conversions.rb +34 -4
  37. data/lib/mongoid/extensions/integer/conversions.rb +5 -1
  38. data/lib/mongoid/extensions/nil/assimilation.rb +4 -0
  39. data/lib/mongoid/extensions/object/conversions.rb +1 -1
  40. data/lib/mongoid/extensions/string/conversions.rb +1 -1
  41. data/lib/mongoid/extensions/symbol/inflections.rb +1 -1
  42. data/lib/mongoid/extensions/time_conversions.rb +35 -0
  43. data/lib/mongoid/extras.rb +6 -9
  44. data/lib/mongoid/factory.rb +2 -1
  45. data/lib/mongoid/field.rb +9 -2
  46. data/lib/mongoid/fields.rb +1 -0
  47. data/lib/mongoid/identity.rb +3 -3
  48. data/lib/mongoid/indexes.rb +3 -3
  49. data/lib/mongoid/memoization.rb +8 -2
  50. data/lib/mongoid/named_scope.rb +0 -3
  51. data/lib/mongoid/observable.rb +30 -0
  52. data/lib/mongoid/paths.rb +62 -0
  53. data/lib/mongoid/persistence.rb +222 -0
  54. data/lib/mongoid/persistence/command.rb +39 -0
  55. data/lib/mongoid/persistence/insert.rb +50 -0
  56. data/lib/mongoid/persistence/insert_embedded.rb +38 -0
  57. data/lib/mongoid/persistence/remove.rb +39 -0
  58. data/lib/mongoid/persistence/remove_all.rb +37 -0
  59. data/lib/mongoid/persistence/remove_embedded.rb +50 -0
  60. data/lib/mongoid/persistence/update.rb +63 -0
  61. data/lib/mongoid/state.rb +28 -21
  62. data/lib/mongoid/timestamps.rb +5 -8
  63. data/lib/mongoid/version.rb +4 -0
  64. data/lib/mongoid/versioning.rb +6 -7
  65. metadata +81 -300
  66. data/.gitignore +0 -6
  67. data/.watchr +0 -29
  68. data/Rakefile +0 -53
  69. data/VERSION +0 -1
  70. data/caliper.yml +0 -4
  71. data/lib/mongoid/collections/mimic.rb +0 -46
  72. data/lib/mongoid/commands.rb +0 -174
  73. data/lib/mongoid/commands/create.rb +0 -21
  74. data/lib/mongoid/commands/delete.rb +0 -16
  75. data/lib/mongoid/commands/delete_all.rb +0 -23
  76. data/lib/mongoid/commands/deletion.rb +0 -18
  77. data/lib/mongoid/commands/destroy.rb +0 -19
  78. data/lib/mongoid/commands/destroy_all.rb +0 -23
  79. data/lib/mongoid/commands/save.rb +0 -27
  80. data/lib/mongoid/extensions/time/conversions.rb +0 -18
  81. data/mongoid.gemspec +0 -395
  82. data/perf/benchmark.rb +0 -77
  83. data/spec/integration/mongoid/associations_spec.rb +0 -340
  84. data/spec/integration/mongoid/attributes_spec.rb +0 -22
  85. data/spec/integration/mongoid/commands_spec.rb +0 -218
  86. data/spec/integration/mongoid/contexts/enumerable_spec.rb +0 -33
  87. data/spec/integration/mongoid/criteria_spec.rb +0 -272
  88. data/spec/integration/mongoid/document_spec.rb +0 -593
  89. data/spec/integration/mongoid/extensions_spec.rb +0 -26
  90. data/spec/integration/mongoid/finders_spec.rb +0 -119
  91. data/spec/integration/mongoid/inheritance_spec.rb +0 -137
  92. data/spec/integration/mongoid/named_scope_spec.rb +0 -46
  93. data/spec/models/address.rb +0 -39
  94. data/spec/models/animal.rb +0 -6
  95. data/spec/models/callbacks.rb +0 -18
  96. data/spec/models/comment.rb +0 -8
  97. data/spec/models/country_code.rb +0 -6
  98. data/spec/models/employer.rb +0 -5
  99. data/spec/models/game.rb +0 -7
  100. data/spec/models/inheritance.rb +0 -56
  101. data/spec/models/location.rb +0 -5
  102. data/spec/models/mixed_drink.rb +0 -4
  103. data/spec/models/name.rb +0 -13
  104. data/spec/models/namespacing.rb +0 -11
  105. data/spec/models/patient.rb +0 -4
  106. data/spec/models/person.rb +0 -99
  107. data/spec/models/pet.rb +0 -7
  108. data/spec/models/pet_owner.rb +0 -6
  109. data/spec/models/phone.rb +0 -7
  110. data/spec/models/post.rb +0 -15
  111. data/spec/models/translation.rb +0 -5
  112. data/spec/models/vet_visit.rb +0 -5
  113. data/spec/spec.opts +0 -3
  114. data/spec/spec_helper.rb +0 -31
  115. data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +0 -145
  116. data/spec/unit/mongoid/associations/belongs_to_spec.rb +0 -193
  117. data/spec/unit/mongoid/associations/has_many_related_spec.rb +0 -420
  118. data/spec/unit/mongoid/associations/has_many_spec.rb +0 -519
  119. data/spec/unit/mongoid/associations/has_one_related_spec.rb +0 -179
  120. data/spec/unit/mongoid/associations/has_one_spec.rb +0 -282
  121. data/spec/unit/mongoid/associations/meta_data_spec.rb +0 -88
  122. data/spec/unit/mongoid/associations/options_spec.rb +0 -192
  123. data/spec/unit/mongoid/associations_spec.rb +0 -595
  124. data/spec/unit/mongoid/attributes_spec.rb +0 -507
  125. data/spec/unit/mongoid/callbacks_spec.rb +0 -55
  126. data/spec/unit/mongoid/collection_spec.rb +0 -187
  127. data/spec/unit/mongoid/collections/cyclic_iterator_spec.rb +0 -75
  128. data/spec/unit/mongoid/collections/master_spec.rb +0 -41
  129. data/spec/unit/mongoid/collections/mimic_spec.rb +0 -43
  130. data/spec/unit/mongoid/collections/slaves_spec.rb +0 -81
  131. data/spec/unit/mongoid/commands/create_spec.rb +0 -30
  132. data/spec/unit/mongoid/commands/delete_all_spec.rb +0 -58
  133. data/spec/unit/mongoid/commands/delete_spec.rb +0 -38
  134. data/spec/unit/mongoid/commands/destroy_all_spec.rb +0 -23
  135. data/spec/unit/mongoid/commands/destroy_spec.rb +0 -50
  136. data/spec/unit/mongoid/commands/save_spec.rb +0 -105
  137. data/spec/unit/mongoid/commands_spec.rb +0 -275
  138. data/spec/unit/mongoid/config_spec.rb +0 -172
  139. data/spec/unit/mongoid/contexts/enumerable_spec.rb +0 -421
  140. data/spec/unit/mongoid/contexts/mongo_spec.rb +0 -682
  141. data/spec/unit/mongoid/contexts_spec.rb +0 -25
  142. data/spec/unit/mongoid/criteria_spec.rb +0 -824
  143. data/spec/unit/mongoid/criterion/complex_spec.rb +0 -19
  144. data/spec/unit/mongoid/criterion/exclusion_spec.rb +0 -91
  145. data/spec/unit/mongoid/criterion/inclusion_spec.rb +0 -219
  146. data/spec/unit/mongoid/criterion/optional_spec.rb +0 -319
  147. data/spec/unit/mongoid/cursor_spec.rb +0 -74
  148. data/spec/unit/mongoid/deprecation_spec.rb +0 -24
  149. data/spec/unit/mongoid/document_spec.rb +0 -952
  150. data/spec/unit/mongoid/errors_spec.rb +0 -103
  151. data/spec/unit/mongoid/extensions/array/accessors_spec.rb +0 -50
  152. data/spec/unit/mongoid/extensions/array/assimilation_spec.rb +0 -24
  153. data/spec/unit/mongoid/extensions/array/conversions_spec.rb +0 -35
  154. data/spec/unit/mongoid/extensions/array/parentization_spec.rb +0 -20
  155. data/spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb +0 -22
  156. data/spec/unit/mongoid/extensions/binary/conversions_spec.rb +0 -22
  157. data/spec/unit/mongoid/extensions/boolean/conversions_spec.rb +0 -49
  158. data/spec/unit/mongoid/extensions/date/conversions_spec.rb +0 -102
  159. data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +0 -70
  160. data/spec/unit/mongoid/extensions/float/conversions_spec.rb +0 -61
  161. data/spec/unit/mongoid/extensions/hash/accessors_spec.rb +0 -184
  162. data/spec/unit/mongoid/extensions/hash/assimilation_spec.rb +0 -46
  163. data/spec/unit/mongoid/extensions/hash/conversions_spec.rb +0 -21
  164. data/spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb +0 -17
  165. data/spec/unit/mongoid/extensions/hash/scoping_spec.rb +0 -14
  166. data/spec/unit/mongoid/extensions/integer/conversions_spec.rb +0 -61
  167. data/spec/unit/mongoid/extensions/nil/assimilation_spec.rb +0 -24
  168. data/spec/unit/mongoid/extensions/object/conversions_spec.rb +0 -57
  169. data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +0 -34
  170. data/spec/unit/mongoid/extensions/string/conversions_spec.rb +0 -17
  171. data/spec/unit/mongoid/extensions/string/inflections_spec.rb +0 -208
  172. data/spec/unit/mongoid/extensions/symbol/inflections_spec.rb +0 -91
  173. data/spec/unit/mongoid/extensions/time/conversions_spec.rb +0 -70
  174. data/spec/unit/mongoid/extras_spec.rb +0 -102
  175. data/spec/unit/mongoid/factory_spec.rb +0 -31
  176. data/spec/unit/mongoid/field_spec.rb +0 -143
  177. data/spec/unit/mongoid/fields_spec.rb +0 -181
  178. data/spec/unit/mongoid/finders_spec.rb +0 -404
  179. data/spec/unit/mongoid/identity_spec.rb +0 -109
  180. data/spec/unit/mongoid/indexes_spec.rb +0 -93
  181. data/spec/unit/mongoid/javascript_spec.rb +0 -48
  182. data/spec/unit/mongoid/matchers/all_spec.rb +0 -27
  183. data/spec/unit/mongoid/matchers/default_spec.rb +0 -27
  184. data/spec/unit/mongoid/matchers/exists_spec.rb +0 -56
  185. data/spec/unit/mongoid/matchers/gt_spec.rb +0 -39
  186. data/spec/unit/mongoid/matchers/gte_spec.rb +0 -49
  187. data/spec/unit/mongoid/matchers/in_spec.rb +0 -27
  188. data/spec/unit/mongoid/matchers/lt_spec.rb +0 -39
  189. data/spec/unit/mongoid/matchers/lte_spec.rb +0 -49
  190. data/spec/unit/mongoid/matchers/ne_spec.rb +0 -27
  191. data/spec/unit/mongoid/matchers/nin_spec.rb +0 -27
  192. data/spec/unit/mongoid/matchers/size_spec.rb +0 -27
  193. data/spec/unit/mongoid/matchers_spec.rb +0 -329
  194. data/spec/unit/mongoid/memoization_spec.rb +0 -75
  195. data/spec/unit/mongoid/named_scope_spec.rb +0 -123
  196. data/spec/unit/mongoid/scope_spec.rb +0 -240
  197. data/spec/unit/mongoid/state_spec.rb +0 -83
  198. data/spec/unit/mongoid/timestamps_spec.rb +0 -25
  199. data/spec/unit/mongoid/versioning_spec.rb +0 -41
  200. data/spec/unit/mongoid_spec.rb +0 -46
@@ -1,27 +0,0 @@
1
- # encoding: utf-8
2
- module Mongoid #:nodoc:
3
- module Commands
4
- class Save
5
- # Performs a save of the supplied +Document+, handling all associated
6
- # callbacks and validation.
7
- #
8
- # Options:
9
- #
10
- # doc: A +Document+ that is going to be persisted.
11
- #
12
- # Returns: +true+ if validation passes, +false+ if not.
13
- def self.execute(doc, validate = true)
14
- return false if validate && !doc.valid?
15
- doc.run_callbacks :before_save
16
- parent = doc._parent
17
- if parent ? Save.execute(parent, validate) : doc.collection.save(doc.raw_attributes, :safe => Mongoid.persist_in_safe_mode)
18
- doc.new_record = false
19
- doc.run_callbacks :after_save
20
- return true
21
- else
22
- return false
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
- module Mongoid #:nodoc:
3
- module Extensions #:nodoc:
4
- module Time #:nodoc:
5
- module Conversions #:nodoc:
6
- def set(value)
7
- return nil if value.blank?
8
- time = ::Time.parse(value.is_a?(::Time) ? value.strftime("%Y-%m-%d %H:%M:%S %Z") : value.to_s)
9
- time.utc? ? time : time.utc
10
- end
11
- def get(value)
12
- return nil if value.blank?
13
- ::Time.zone ? value.getlocal : value
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,395 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{mongoid}
8
- s.version = "1.2.14"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Durran Jordan"]
12
- s.date = %q{2010-03-17}
13
- s.email = %q{durran@gmail.com}
14
- s.extra_rdoc_files = [
15
- "README.rdoc"
16
- ]
17
- s.files = [
18
- ".gitignore",
19
- ".watchr",
20
- "MIT_LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "caliper.yml",
25
- "lib/mongoid.rb",
26
- "lib/mongoid/associations.rb",
27
- "lib/mongoid/associations/belongs_to.rb",
28
- "lib/mongoid/associations/belongs_to_related.rb",
29
- "lib/mongoid/associations/has_many.rb",
30
- "lib/mongoid/associations/has_many_related.rb",
31
- "lib/mongoid/associations/has_one.rb",
32
- "lib/mongoid/associations/has_one_related.rb",
33
- "lib/mongoid/associations/meta_data.rb",
34
- "lib/mongoid/associations/options.rb",
35
- "lib/mongoid/associations/proxy.rb",
36
- "lib/mongoid/attributes.rb",
37
- "lib/mongoid/callbacks.rb",
38
- "lib/mongoid/collection.rb",
39
- "lib/mongoid/collections/cyclic_iterator.rb",
40
- "lib/mongoid/collections/master.rb",
41
- "lib/mongoid/collections/mimic.rb",
42
- "lib/mongoid/collections/operations.rb",
43
- "lib/mongoid/collections/slaves.rb",
44
- "lib/mongoid/commands.rb",
45
- "lib/mongoid/commands/create.rb",
46
- "lib/mongoid/commands/delete.rb",
47
- "lib/mongoid/commands/delete_all.rb",
48
- "lib/mongoid/commands/deletion.rb",
49
- "lib/mongoid/commands/destroy.rb",
50
- "lib/mongoid/commands/destroy_all.rb",
51
- "lib/mongoid/commands/save.rb",
52
- "lib/mongoid/components.rb",
53
- "lib/mongoid/config.rb",
54
- "lib/mongoid/contexts.rb",
55
- "lib/mongoid/contexts/enumerable.rb",
56
- "lib/mongoid/contexts/ids.rb",
57
- "lib/mongoid/contexts/mongo.rb",
58
- "lib/mongoid/contexts/paging.rb",
59
- "lib/mongoid/criteria.rb",
60
- "lib/mongoid/criterion/complex.rb",
61
- "lib/mongoid/criterion/exclusion.rb",
62
- "lib/mongoid/criterion/inclusion.rb",
63
- "lib/mongoid/criterion/optional.rb",
64
- "lib/mongoid/cursor.rb",
65
- "lib/mongoid/deprecation.rb",
66
- "lib/mongoid/document.rb",
67
- "lib/mongoid/errors.rb",
68
- "lib/mongoid/extensions.rb",
69
- "lib/mongoid/extensions/array/accessors.rb",
70
- "lib/mongoid/extensions/array/aliasing.rb",
71
- "lib/mongoid/extensions/array/assimilation.rb",
72
- "lib/mongoid/extensions/array/conversions.rb",
73
- "lib/mongoid/extensions/array/parentization.rb",
74
- "lib/mongoid/extensions/big_decimal/conversions.rb",
75
- "lib/mongoid/extensions/binary/conversions.rb",
76
- "lib/mongoid/extensions/boolean/conversions.rb",
77
- "lib/mongoid/extensions/date/conversions.rb",
78
- "lib/mongoid/extensions/datetime/conversions.rb",
79
- "lib/mongoid/extensions/float/conversions.rb",
80
- "lib/mongoid/extensions/hash/accessors.rb",
81
- "lib/mongoid/extensions/hash/assimilation.rb",
82
- "lib/mongoid/extensions/hash/conversions.rb",
83
- "lib/mongoid/extensions/hash/criteria_helpers.rb",
84
- "lib/mongoid/extensions/hash/scoping.rb",
85
- "lib/mongoid/extensions/integer/conversions.rb",
86
- "lib/mongoid/extensions/nil/assimilation.rb",
87
- "lib/mongoid/extensions/object/conversions.rb",
88
- "lib/mongoid/extensions/objectid/conversions.rb",
89
- "lib/mongoid/extensions/proc/scoping.rb",
90
- "lib/mongoid/extensions/string/conversions.rb",
91
- "lib/mongoid/extensions/string/inflections.rb",
92
- "lib/mongoid/extensions/symbol/inflections.rb",
93
- "lib/mongoid/extensions/time/conversions.rb",
94
- "lib/mongoid/extras.rb",
95
- "lib/mongoid/factory.rb",
96
- "lib/mongoid/field.rb",
97
- "lib/mongoid/fields.rb",
98
- "lib/mongoid/finders.rb",
99
- "lib/mongoid/identity.rb",
100
- "lib/mongoid/indexes.rb",
101
- "lib/mongoid/javascript.rb",
102
- "lib/mongoid/javascript/functions.yml",
103
- "lib/mongoid/matchers.rb",
104
- "lib/mongoid/matchers/all.rb",
105
- "lib/mongoid/matchers/default.rb",
106
- "lib/mongoid/matchers/exists.rb",
107
- "lib/mongoid/matchers/gt.rb",
108
- "lib/mongoid/matchers/gte.rb",
109
- "lib/mongoid/matchers/in.rb",
110
- "lib/mongoid/matchers/lt.rb",
111
- "lib/mongoid/matchers/lte.rb",
112
- "lib/mongoid/matchers/ne.rb",
113
- "lib/mongoid/matchers/nin.rb",
114
- "lib/mongoid/matchers/size.rb",
115
- "lib/mongoid/memoization.rb",
116
- "lib/mongoid/named_scope.rb",
117
- "lib/mongoid/scope.rb",
118
- "lib/mongoid/state.rb",
119
- "lib/mongoid/timestamps.rb",
120
- "lib/mongoid/versioning.rb",
121
- "mongoid.gemspec",
122
- "perf/benchmark.rb",
123
- "spec/integration/mongoid/associations_spec.rb",
124
- "spec/integration/mongoid/attributes_spec.rb",
125
- "spec/integration/mongoid/commands_spec.rb",
126
- "spec/integration/mongoid/contexts/enumerable_spec.rb",
127
- "spec/integration/mongoid/criteria_spec.rb",
128
- "spec/integration/mongoid/document_spec.rb",
129
- "spec/integration/mongoid/extensions_spec.rb",
130
- "spec/integration/mongoid/finders_spec.rb",
131
- "spec/integration/mongoid/inheritance_spec.rb",
132
- "spec/integration/mongoid/named_scope_spec.rb",
133
- "spec/models/address.rb",
134
- "spec/models/animal.rb",
135
- "spec/models/callbacks.rb",
136
- "spec/models/comment.rb",
137
- "spec/models/country_code.rb",
138
- "spec/models/employer.rb",
139
- "spec/models/game.rb",
140
- "spec/models/inheritance.rb",
141
- "spec/models/location.rb",
142
- "spec/models/mixed_drink.rb",
143
- "spec/models/name.rb",
144
- "spec/models/namespacing.rb",
145
- "spec/models/patient.rb",
146
- "spec/models/person.rb",
147
- "spec/models/pet.rb",
148
- "spec/models/pet_owner.rb",
149
- "spec/models/phone.rb",
150
- "spec/models/post.rb",
151
- "spec/models/translation.rb",
152
- "spec/models/vet_visit.rb",
153
- "spec/spec.opts",
154
- "spec/spec_helper.rb",
155
- "spec/unit/mongoid/associations/belongs_to_related_spec.rb",
156
- "spec/unit/mongoid/associations/belongs_to_spec.rb",
157
- "spec/unit/mongoid/associations/has_many_related_spec.rb",
158
- "spec/unit/mongoid/associations/has_many_spec.rb",
159
- "spec/unit/mongoid/associations/has_one_related_spec.rb",
160
- "spec/unit/mongoid/associations/has_one_spec.rb",
161
- "spec/unit/mongoid/associations/meta_data_spec.rb",
162
- "spec/unit/mongoid/associations/options_spec.rb",
163
- "spec/unit/mongoid/associations_spec.rb",
164
- "spec/unit/mongoid/attributes_spec.rb",
165
- "spec/unit/mongoid/callbacks_spec.rb",
166
- "spec/unit/mongoid/collection_spec.rb",
167
- "spec/unit/mongoid/collections/cyclic_iterator_spec.rb",
168
- "spec/unit/mongoid/collections/master_spec.rb",
169
- "spec/unit/mongoid/collections/mimic_spec.rb",
170
- "spec/unit/mongoid/collections/slaves_spec.rb",
171
- "spec/unit/mongoid/commands/create_spec.rb",
172
- "spec/unit/mongoid/commands/delete_all_spec.rb",
173
- "spec/unit/mongoid/commands/delete_spec.rb",
174
- "spec/unit/mongoid/commands/destroy_all_spec.rb",
175
- "spec/unit/mongoid/commands/destroy_spec.rb",
176
- "spec/unit/mongoid/commands/save_spec.rb",
177
- "spec/unit/mongoid/commands_spec.rb",
178
- "spec/unit/mongoid/config_spec.rb",
179
- "spec/unit/mongoid/contexts/enumerable_spec.rb",
180
- "spec/unit/mongoid/contexts/mongo_spec.rb",
181
- "spec/unit/mongoid/contexts_spec.rb",
182
- "spec/unit/mongoid/criteria_spec.rb",
183
- "spec/unit/mongoid/criterion/complex_spec.rb",
184
- "spec/unit/mongoid/criterion/exclusion_spec.rb",
185
- "spec/unit/mongoid/criterion/inclusion_spec.rb",
186
- "spec/unit/mongoid/criterion/optional_spec.rb",
187
- "spec/unit/mongoid/cursor_spec.rb",
188
- "spec/unit/mongoid/deprecation_spec.rb",
189
- "spec/unit/mongoid/document_spec.rb",
190
- "spec/unit/mongoid/errors_spec.rb",
191
- "spec/unit/mongoid/extensions/array/accessors_spec.rb",
192
- "spec/unit/mongoid/extensions/array/assimilation_spec.rb",
193
- "spec/unit/mongoid/extensions/array/conversions_spec.rb",
194
- "spec/unit/mongoid/extensions/array/parentization_spec.rb",
195
- "spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb",
196
- "spec/unit/mongoid/extensions/binary/conversions_spec.rb",
197
- "spec/unit/mongoid/extensions/boolean/conversions_spec.rb",
198
- "spec/unit/mongoid/extensions/date/conversions_spec.rb",
199
- "spec/unit/mongoid/extensions/datetime/conversions_spec.rb",
200
- "spec/unit/mongoid/extensions/float/conversions_spec.rb",
201
- "spec/unit/mongoid/extensions/hash/accessors_spec.rb",
202
- "spec/unit/mongoid/extensions/hash/assimilation_spec.rb",
203
- "spec/unit/mongoid/extensions/hash/conversions_spec.rb",
204
- "spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb",
205
- "spec/unit/mongoid/extensions/hash/scoping_spec.rb",
206
- "spec/unit/mongoid/extensions/integer/conversions_spec.rb",
207
- "spec/unit/mongoid/extensions/nil/assimilation_spec.rb",
208
- "spec/unit/mongoid/extensions/object/conversions_spec.rb",
209
- "spec/unit/mongoid/extensions/proc/scoping_spec.rb",
210
- "spec/unit/mongoid/extensions/string/conversions_spec.rb",
211
- "spec/unit/mongoid/extensions/string/inflections_spec.rb",
212
- "spec/unit/mongoid/extensions/symbol/inflections_spec.rb",
213
- "spec/unit/mongoid/extensions/time/conversions_spec.rb",
214
- "spec/unit/mongoid/extras_spec.rb",
215
- "spec/unit/mongoid/factory_spec.rb",
216
- "spec/unit/mongoid/field_spec.rb",
217
- "spec/unit/mongoid/fields_spec.rb",
218
- "spec/unit/mongoid/finders_spec.rb",
219
- "spec/unit/mongoid/identity_spec.rb",
220
- "spec/unit/mongoid/indexes_spec.rb",
221
- "spec/unit/mongoid/javascript_spec.rb",
222
- "spec/unit/mongoid/matchers/all_spec.rb",
223
- "spec/unit/mongoid/matchers/default_spec.rb",
224
- "spec/unit/mongoid/matchers/exists_spec.rb",
225
- "spec/unit/mongoid/matchers/gt_spec.rb",
226
- "spec/unit/mongoid/matchers/gte_spec.rb",
227
- "spec/unit/mongoid/matchers/in_spec.rb",
228
- "spec/unit/mongoid/matchers/lt_spec.rb",
229
- "spec/unit/mongoid/matchers/lte_spec.rb",
230
- "spec/unit/mongoid/matchers/ne_spec.rb",
231
- "spec/unit/mongoid/matchers/nin_spec.rb",
232
- "spec/unit/mongoid/matchers/size_spec.rb",
233
- "spec/unit/mongoid/matchers_spec.rb",
234
- "spec/unit/mongoid/memoization_spec.rb",
235
- "spec/unit/mongoid/named_scope_spec.rb",
236
- "spec/unit/mongoid/scope_spec.rb",
237
- "spec/unit/mongoid/state_spec.rb",
238
- "spec/unit/mongoid/timestamps_spec.rb",
239
- "spec/unit/mongoid/versioning_spec.rb",
240
- "spec/unit/mongoid_spec.rb"
241
- ]
242
- s.homepage = %q{http://mongoid.org}
243
- s.rdoc_options = ["--charset=UTF-8"]
244
- s.require_paths = ["lib"]
245
- s.rubygems_version = %q{1.3.6}
246
- s.summary = %q{ODM framework for MongoDB}
247
- s.test_files = [
248
- "spec/integration/mongoid/associations_spec.rb",
249
- "spec/integration/mongoid/attributes_spec.rb",
250
- "spec/integration/mongoid/commands_spec.rb",
251
- "spec/integration/mongoid/contexts/enumerable_spec.rb",
252
- "spec/integration/mongoid/criteria_spec.rb",
253
- "spec/integration/mongoid/document_spec.rb",
254
- "spec/integration/mongoid/extensions_spec.rb",
255
- "spec/integration/mongoid/finders_spec.rb",
256
- "spec/integration/mongoid/inheritance_spec.rb",
257
- "spec/integration/mongoid/named_scope_spec.rb",
258
- "spec/models/address.rb",
259
- "spec/models/animal.rb",
260
- "spec/models/callbacks.rb",
261
- "spec/models/comment.rb",
262
- "spec/models/country_code.rb",
263
- "spec/models/employer.rb",
264
- "spec/models/game.rb",
265
- "spec/models/inheritance.rb",
266
- "spec/models/location.rb",
267
- "spec/models/mixed_drink.rb",
268
- "spec/models/name.rb",
269
- "spec/models/namespacing.rb",
270
- "spec/models/patient.rb",
271
- "spec/models/person.rb",
272
- "spec/models/pet.rb",
273
- "spec/models/pet_owner.rb",
274
- "spec/models/phone.rb",
275
- "spec/models/post.rb",
276
- "spec/models/translation.rb",
277
- "spec/models/vet_visit.rb",
278
- "spec/spec_helper.rb",
279
- "spec/unit/mongoid/associations/belongs_to_related_spec.rb",
280
- "spec/unit/mongoid/associations/belongs_to_spec.rb",
281
- "spec/unit/mongoid/associations/has_many_related_spec.rb",
282
- "spec/unit/mongoid/associations/has_many_spec.rb",
283
- "spec/unit/mongoid/associations/has_one_related_spec.rb",
284
- "spec/unit/mongoid/associations/has_one_spec.rb",
285
- "spec/unit/mongoid/associations/meta_data_spec.rb",
286
- "spec/unit/mongoid/associations/options_spec.rb",
287
- "spec/unit/mongoid/associations_spec.rb",
288
- "spec/unit/mongoid/attributes_spec.rb",
289
- "spec/unit/mongoid/callbacks_spec.rb",
290
- "spec/unit/mongoid/collection_spec.rb",
291
- "spec/unit/mongoid/collections/cyclic_iterator_spec.rb",
292
- "spec/unit/mongoid/collections/master_spec.rb",
293
- "spec/unit/mongoid/collections/mimic_spec.rb",
294
- "spec/unit/mongoid/collections/slaves_spec.rb",
295
- "spec/unit/mongoid/commands/create_spec.rb",
296
- "spec/unit/mongoid/commands/delete_all_spec.rb",
297
- "spec/unit/mongoid/commands/delete_spec.rb",
298
- "spec/unit/mongoid/commands/destroy_all_spec.rb",
299
- "spec/unit/mongoid/commands/destroy_spec.rb",
300
- "spec/unit/mongoid/commands/save_spec.rb",
301
- "spec/unit/mongoid/commands_spec.rb",
302
- "spec/unit/mongoid/config_spec.rb",
303
- "spec/unit/mongoid/contexts/enumerable_spec.rb",
304
- "spec/unit/mongoid/contexts/mongo_spec.rb",
305
- "spec/unit/mongoid/contexts_spec.rb",
306
- "spec/unit/mongoid/criteria_spec.rb",
307
- "spec/unit/mongoid/criterion/complex_spec.rb",
308
- "spec/unit/mongoid/criterion/exclusion_spec.rb",
309
- "spec/unit/mongoid/criterion/inclusion_spec.rb",
310
- "spec/unit/mongoid/criterion/optional_spec.rb",
311
- "spec/unit/mongoid/cursor_spec.rb",
312
- "spec/unit/mongoid/deprecation_spec.rb",
313
- "spec/unit/mongoid/document_spec.rb",
314
- "spec/unit/mongoid/errors_spec.rb",
315
- "spec/unit/mongoid/extensions/array/accessors_spec.rb",
316
- "spec/unit/mongoid/extensions/array/assimilation_spec.rb",
317
- "spec/unit/mongoid/extensions/array/conversions_spec.rb",
318
- "spec/unit/mongoid/extensions/array/parentization_spec.rb",
319
- "spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb",
320
- "spec/unit/mongoid/extensions/binary/conversions_spec.rb",
321
- "spec/unit/mongoid/extensions/boolean/conversions_spec.rb",
322
- "spec/unit/mongoid/extensions/date/conversions_spec.rb",
323
- "spec/unit/mongoid/extensions/datetime/conversions_spec.rb",
324
- "spec/unit/mongoid/extensions/float/conversions_spec.rb",
325
- "spec/unit/mongoid/extensions/hash/accessors_spec.rb",
326
- "spec/unit/mongoid/extensions/hash/assimilation_spec.rb",
327
- "spec/unit/mongoid/extensions/hash/conversions_spec.rb",
328
- "spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb",
329
- "spec/unit/mongoid/extensions/hash/scoping_spec.rb",
330
- "spec/unit/mongoid/extensions/integer/conversions_spec.rb",
331
- "spec/unit/mongoid/extensions/nil/assimilation_spec.rb",
332
- "spec/unit/mongoid/extensions/object/conversions_spec.rb",
333
- "spec/unit/mongoid/extensions/proc/scoping_spec.rb",
334
- "spec/unit/mongoid/extensions/string/conversions_spec.rb",
335
- "spec/unit/mongoid/extensions/string/inflections_spec.rb",
336
- "spec/unit/mongoid/extensions/symbol/inflections_spec.rb",
337
- "spec/unit/mongoid/extensions/time/conversions_spec.rb",
338
- "spec/unit/mongoid/extras_spec.rb",
339
- "spec/unit/mongoid/factory_spec.rb",
340
- "spec/unit/mongoid/field_spec.rb",
341
- "spec/unit/mongoid/fields_spec.rb",
342
- "spec/unit/mongoid/finders_spec.rb",
343
- "spec/unit/mongoid/identity_spec.rb",
344
- "spec/unit/mongoid/indexes_spec.rb",
345
- "spec/unit/mongoid/javascript_spec.rb",
346
- "spec/unit/mongoid/matchers/all_spec.rb",
347
- "spec/unit/mongoid/matchers/default_spec.rb",
348
- "spec/unit/mongoid/matchers/exists_spec.rb",
349
- "spec/unit/mongoid/matchers/gt_spec.rb",
350
- "spec/unit/mongoid/matchers/gte_spec.rb",
351
- "spec/unit/mongoid/matchers/in_spec.rb",
352
- "spec/unit/mongoid/matchers/lt_spec.rb",
353
- "spec/unit/mongoid/matchers/lte_spec.rb",
354
- "spec/unit/mongoid/matchers/ne_spec.rb",
355
- "spec/unit/mongoid/matchers/nin_spec.rb",
356
- "spec/unit/mongoid/matchers/size_spec.rb",
357
- "spec/unit/mongoid/matchers_spec.rb",
358
- "spec/unit/mongoid/memoization_spec.rb",
359
- "spec/unit/mongoid/named_scope_spec.rb",
360
- "spec/unit/mongoid/scope_spec.rb",
361
- "spec/unit/mongoid/state_spec.rb",
362
- "spec/unit/mongoid/timestamps_spec.rb",
363
- "spec/unit/mongoid/versioning_spec.rb",
364
- "spec/unit/mongoid_spec.rb"
365
- ]
366
-
367
- if s.respond_to? :specification_version then
368
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
369
- s.specification_version = 3
370
-
371
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
372
- s.add_runtime_dependency(%q<activesupport>, ["<= 2.3.5"])
373
- s.add_runtime_dependency(%q<mongo>, [">= 0.19.1"])
374
- s.add_runtime_dependency(%q<durran-validatable>, [">= 2.0.1"])
375
- s.add_runtime_dependency(%q<will_paginate>, ["< 2.9"])
376
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
377
- s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
378
- else
379
- s.add_dependency(%q<activesupport>, ["<= 2.3.5"])
380
- s.add_dependency(%q<mongo>, [">= 0.19.1"])
381
- s.add_dependency(%q<durran-validatable>, [">= 2.0.1"])
382
- s.add_dependency(%q<will_paginate>, ["< 2.9"])
383
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
384
- s.add_dependency(%q<mocha>, [">= 0.9.8"])
385
- end
386
- else
387
- s.add_dependency(%q<activesupport>, ["<= 2.3.5"])
388
- s.add_dependency(%q<mongo>, [">= 0.19.1"])
389
- s.add_dependency(%q<durran-validatable>, [">= 2.0.1"])
390
- s.add_dependency(%q<will_paginate>, ["< 2.9"])
391
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
392
- s.add_dependency(%q<mocha>, [">= 0.9.8"])
393
- end
394
- end
395
-
@@ -1,77 +0,0 @@
1
- require "rubygems"
2
- require "ruby-prof"
3
- require "benchmark"
4
- require "mongoid"
5
-
6
- Mongoid.configure do |config|
7
- config.persist_in_safe_mode = false
8
- config.master = Mongo::Connection.new.db("mongoid_perf_test")
9
- end
10
-
11
- Mongoid.master.collection("people").drop
12
-
13
- class Person
14
- include Mongoid::Document
15
- include Mongoid::Timestamps
16
- field :birth_date, :type => Date
17
- has_one :name
18
- has_one :address
19
- has_many :phones
20
- end
21
-
22
- class Name
23
- include Mongoid::Document
24
- field :given
25
- field :family
26
- field :middle
27
- belongs_to :person, :inverse_of => :name
28
- end
29
-
30
- class Address
31
- include Mongoid::Document
32
- field :street
33
- field :city
34
- field :state
35
- field :post_code
36
- field :address_type
37
- belongs_to :person, :inverse_of => :address
38
- end
39
-
40
- class Phone
41
- include Mongoid::Document
42
- field :country_code, :type => Integer
43
- field :number
44
- field :phone_type
45
- belongs_to :person, :inverse_of => :phones
46
- end
47
-
48
- # RubyProf.start
49
-
50
- puts "Starting benchmark..."
51
-
52
- Benchmark.bm do |bm|
53
- bm.report("Mongoid") do
54
- 10000.times do |n|
55
- person = Person.new(:birth_date => Date.new(1970, 1, 1))
56
- name = Name.new(:given => "James", :family => "Kirk", :middle => "Tiberius")
57
- address = Address.new(
58
- :street => "1 Starfleet Command Way",
59
- :city => "San Francisco",
60
- :state => "CA",
61
- :post_code => "94133",
62
- :type => "Work"
63
- )
64
- phone = Phone.new(:country_code => 1, :number => "415-555-1212", :type => "Mobile")
65
- person.name = name
66
- person.address = address
67
- person.phones << phone
68
- person.save
69
- end
70
- end
71
- end
72
-
73
- # result = RubyProf.stop
74
- # printer = RubyProf::FlatPrinter.new(result)
75
- # printer.print(STDOUT, 0)
76
-
77
- # Mongoid.database.collection("people").drop