mongodoc 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/README.textile +143 -0
  2. data/Rakefile +35 -3
  3. data/VERSION +1 -1
  4. data/examples/simple_document.rb +35 -0
  5. data/examples/simple_object.rb +32 -0
  6. data/features/finders.feature +72 -0
  7. data/features/mongodoc_base.feature +12 -2
  8. data/features/named_scopes.feature +66 -0
  9. data/features/new_record.feature +36 -0
  10. data/features/partial_updates.feature +105 -0
  11. data/features/step_definitions/criteria_steps.rb +4 -41
  12. data/features/step_definitions/document_steps.rb +56 -5
  13. data/features/step_definitions/documents.rb +14 -3
  14. data/features/step_definitions/finder_steps.rb +15 -0
  15. data/features/step_definitions/named_scope_steps.rb +18 -0
  16. data/features/step_definitions/partial_update_steps.rb +32 -0
  17. data/features/step_definitions/query_steps.rb +51 -0
  18. data/features/using_criteria.feature +5 -1
  19. data/lib/mongodoc/attributes.rb +76 -63
  20. data/lib/mongodoc/collection.rb +9 -9
  21. data/lib/mongodoc/criteria.rb +152 -161
  22. data/lib/mongodoc/cursor.rb +7 -5
  23. data/lib/mongodoc/document.rb +95 -31
  24. data/lib/mongodoc/finders.rb +29 -0
  25. data/lib/mongodoc/named_scope.rb +68 -0
  26. data/lib/mongodoc/parent_proxy.rb +15 -6
  27. data/lib/mongodoc/proxy.rb +22 -13
  28. data/lib/mongodoc.rb +3 -3
  29. data/mongodoc.gemspec +42 -14
  30. data/perf/mongodoc_runner.rb +90 -0
  31. data/perf/ruby_driver_runner.rb +64 -0
  32. data/spec/attributes_spec.rb +46 -12
  33. data/spec/collection_spec.rb +23 -23
  34. data/spec/criteria_spec.rb +124 -187
  35. data/spec/cursor_spec.rb +21 -17
  36. data/spec/document_ext.rb +2 -2
  37. data/spec/document_spec.rb +187 -218
  38. data/spec/embedded_save_spec.rb +104 -0
  39. data/spec/finders_spec.rb +81 -0
  40. data/spec/hash_matchers.rb +27 -0
  41. data/spec/named_scope_spec.rb +82 -0
  42. data/spec/new_record_spec.rb +216 -0
  43. data/spec/parent_proxy_spec.rb +8 -6
  44. data/spec/proxy_spec.rb +80 -0
  45. data/spec/spec_helper.rb +2 -0
  46. metadata +35 -7
  47. data/README.rdoc +0 -75
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Hill
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-10 00:00:00 -05:00
12
+ date: 2010-01-18 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.18.1
23
+ version: 0.18.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mongo_ext
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - "="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.18.1
33
+ version: 0.18.2
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: durran-validatable
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - "="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.8.3
43
+ version: 1.8.4
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: leshill-will_paginate
@@ -80,25 +80,35 @@ extensions: []
80
80
 
81
81
  extra_rdoc_files:
82
82
  - LICENSE
83
- - README.rdoc
83
+ - README.textile
84
84
  files:
85
85
  - .document
86
86
  - .gitignore
87
87
  - LICENSE
88
- - README.rdoc
88
+ - README.textile
89
89
  - Rakefile
90
90
  - VERSION
91
91
  - data/.gitignore
92
+ - examples/simple_document.rb
93
+ - examples/simple_object.rb
94
+ - features/finders.feature
92
95
  - features/mongodb.yml
93
96
  - features/mongodoc_base.feature
97
+ - features/named_scopes.feature
98
+ - features/new_record.feature
99
+ - features/partial_updates.feature
94
100
  - features/saving_an_object.feature
95
101
  - features/step_definitions/collection_steps.rb
96
102
  - features/step_definitions/criteria_steps.rb
97
103
  - features/step_definitions/document_steps.rb
98
104
  - features/step_definitions/documents.rb
105
+ - features/step_definitions/finder_steps.rb
99
106
  - features/step_definitions/json_steps.rb
107
+ - features/step_definitions/named_scope_steps.rb
100
108
  - features/step_definitions/object_steps.rb
101
109
  - features/step_definitions/objects.rb
110
+ - features/step_definitions/partial_update_steps.rb
111
+ - features/step_definitions/query_steps.rb
102
112
  - features/step_definitions/util_steps.rb
103
113
  - features/support/support.rb
104
114
  - features/using_criteria.feature
@@ -125,12 +135,16 @@ files:
125
135
  - lib/mongodoc/ext/string.rb
126
136
  - lib/mongodoc/ext/symbol.rb
127
137
  - lib/mongodoc/ext/time.rb
138
+ - lib/mongodoc/finders.rb
139
+ - lib/mongodoc/named_scope.rb
128
140
  - lib/mongodoc/parent_proxy.rb
129
141
  - lib/mongodoc/proxy.rb
130
142
  - lib/mongodoc/query.rb
131
143
  - mongod.example.yml
132
144
  - mongodb.example.yml
133
145
  - mongodoc.gemspec
146
+ - perf/mongodoc_runner.rb
147
+ - perf/ruby_driver_runner.rb
134
148
  - script/console
135
149
  - spec/attributes_spec.rb
136
150
  - spec/bson_matchers.rb
@@ -141,9 +155,15 @@ files:
141
155
  - spec/cursor_spec.rb
142
156
  - spec/document_ext.rb
143
157
  - spec/document_spec.rb
158
+ - spec/embedded_save_spec.rb
159
+ - spec/finders_spec.rb
160
+ - spec/hash_matchers.rb
144
161
  - spec/mongodb.yml
145
162
  - spec/mongodb_pairs.yml
163
+ - spec/named_scope_spec.rb
164
+ - spec/new_record_spec.rb
146
165
  - spec/parent_proxy_spec.rb
166
+ - spec/proxy_spec.rb
147
167
  - spec/query_spec.rb
148
168
  - spec/spec.opts
149
169
  - spec/spec_helper.rb
@@ -185,6 +205,14 @@ test_files:
185
205
  - spec/cursor_spec.rb
186
206
  - spec/document_ext.rb
187
207
  - spec/document_spec.rb
208
+ - spec/embedded_save_spec.rb
209
+ - spec/finders_spec.rb
210
+ - spec/hash_matchers.rb
211
+ - spec/named_scope_spec.rb
212
+ - spec/new_record_spec.rb
188
213
  - spec/parent_proxy_spec.rb
214
+ - spec/proxy_spec.rb
189
215
  - spec/query_spec.rb
190
216
  - spec/spec_helper.rb
217
+ - examples/simple_document.rb
218
+ - examples/simple_object.rb
data/README.rdoc DELETED
@@ -1,75 +0,0 @@
1
- = mongodoc
2
-
3
- Version: 0.1 12/7/09
4
-
5
- == Introduction
6
-
7
- mongodoc is yet another ODM for MongoDB in Ruby.
8
-
9
- Here is an example:
10
-
11
- require 'mongodoc'
12
-
13
- class Address < MongoDoc::Document
14
- key :street
15
- key :city
16
- key :state
17
- key :zip_code
18
- end
19
-
20
- class Contact < MongoDoc::Document
21
- key :name
22
- key :interests
23
- has_many :addresses
24
- end
25
-
26
- MongoDoc.connect_to_database 'test'
27
- contact = Contact.new(:name => 'Joe Strummer', :interests => ['music', 'art', 'acting'])
28
- contact.addresses << Address.new(:street => '1 Main Street', :city => 'Anywhere', :state => 'ID', :zip_code => '56789')
29
- contact.save
30
-
31
- Contact.criteria.in({'interests' => ['ruby', 'art']}).first
32
- Contact.criteria.where('addresses.state' => 'ID').first
33
-
34
- == Installation
35
-
36
- sudo gem install mongodoc
37
-
38
- == Configuration
39
-
40
- Configure your database connection in ./mongodb.yml, you do not need one if you are running on localhost with the default port
41
-
42
- name: test
43
- host: localhost
44
- port: 27017
45
- options:
46
- auto_reconnect: true
47
-
48
- You can change the location of the configuration file:
49
-
50
- MongoDoc.config_path = './config/mongodb.yml'
51
-
52
- == Credits
53
-
54
- Les Hill, leshill on github
55
-
56
- mongodoc
57
-
58
- === Thanks
59
-
60
- Thanks to Sandro and Durran for some great conversations and some lovely code.
61
-
62
- == Note on Patches/Pull Requests
63
-
64
- * Fork the project.
65
- * Make your feature addition or bug fix.
66
- * Add tests for it. This is important so I don't break it in a
67
- future version unintentionally.
68
- * Commit, do not mess with rakefile, version, or history.
69
- (if you want to have your own version, that is fine but
70
- bump version in a commit by itself I can ignore when I pull)
71
- * Send me a pull request. Bonus points for topic branches.
72
-
73
- == Copyright
74
-
75
- Copyright (c) 2009 Les Hill. See LICENSE for details.