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.
- data/.autotest +17 -14
- data/.gitignore +3 -1
- data/FAQ +6 -5
- data/History.txt +5 -50
- data/Manifest.txt +66 -76
- data/QUICKLINKS +1 -1
- data/README.txt +21 -15
- data/Rakefile +6 -7
- data/SPECS +2 -29
- data/TODO +1 -1
- data/deps.rip +2 -0
- data/dm-core.gemspec +11 -15
- data/lib/dm-core.rb +105 -110
- data/lib/dm-core/adapters.rb +135 -16
- data/lib/dm-core/adapters/abstract_adapter.rb +251 -181
- data/lib/dm-core/adapters/data_objects_adapter.rb +482 -534
- data/lib/dm-core/adapters/in_memory_adapter.rb +90 -69
- data/lib/dm-core/adapters/mysql_adapter.rb +22 -115
- data/lib/dm-core/adapters/oracle_adapter.rb +249 -0
- data/lib/dm-core/adapters/postgres_adapter.rb +7 -173
- data/lib/dm-core/adapters/sqlite3_adapter.rb +4 -97
- data/lib/dm-core/adapters/yaml_adapter.rb +116 -0
- data/lib/dm-core/associations/many_to_many.rb +372 -90
- data/lib/dm-core/associations/many_to_one.rb +220 -73
- data/lib/dm-core/associations/one_to_many.rb +319 -255
- data/lib/dm-core/associations/one_to_one.rb +66 -53
- data/lib/dm-core/associations/relationship.rb +561 -156
- data/lib/dm-core/collection.rb +1101 -379
- data/lib/dm-core/core_ext/kernel.rb +12 -0
- data/lib/dm-core/core_ext/symbol.rb +10 -0
- data/lib/dm-core/identity_map.rb +4 -34
- data/lib/dm-core/migrations.rb +1283 -0
- data/lib/dm-core/model.rb +570 -369
- data/lib/dm-core/model/descendant_set.rb +81 -0
- data/lib/dm-core/model/hook.rb +45 -0
- data/lib/dm-core/model/is.rb +32 -0
- data/lib/dm-core/model/property.rb +247 -0
- data/lib/dm-core/model/relationship.rb +335 -0
- data/lib/dm-core/model/scope.rb +90 -0
- data/lib/dm-core/property.rb +808 -273
- data/lib/dm-core/property_set.rb +141 -98
- data/lib/dm-core/query.rb +1037 -483
- data/lib/dm-core/query/conditions/comparison.rb +872 -0
- data/lib/dm-core/query/conditions/operation.rb +221 -0
- data/lib/dm-core/query/direction.rb +43 -0
- data/lib/dm-core/query/operator.rb +84 -0
- data/lib/dm-core/query/path.rb +138 -0
- data/lib/dm-core/query/sort.rb +45 -0
- data/lib/dm-core/repository.rb +210 -94
- data/lib/dm-core/resource.rb +641 -421
- data/lib/dm-core/spec/adapter_shared_spec.rb +294 -0
- data/lib/dm-core/spec/data_objects_adapter_shared_spec.rb +106 -0
- data/lib/dm-core/support/chainable.rb +22 -0
- data/lib/dm-core/support/deprecate.rb +12 -0
- data/lib/dm-core/support/logger.rb +13 -0
- data/lib/dm-core/{naming_conventions.rb → support/naming_conventions.rb} +6 -6
- data/lib/dm-core/transaction.rb +333 -92
- data/lib/dm-core/type.rb +98 -60
- data/lib/dm-core/types/boolean.rb +1 -1
- data/lib/dm-core/types/discriminator.rb +34 -20
- data/lib/dm-core/types/object.rb +7 -4
- data/lib/dm-core/types/paranoid_boolean.rb +11 -9
- data/lib/dm-core/types/paranoid_datetime.rb +11 -9
- data/lib/dm-core/types/serial.rb +3 -3
- data/lib/dm-core/types/text.rb +3 -4
- data/lib/dm-core/version.rb +1 -1
- data/script/performance.rb +102 -109
- data/script/profile.rb +169 -38
- data/spec/lib/adapter_helpers.rb +105 -0
- data/spec/lib/collection_helpers.rb +18 -0
- data/spec/lib/counter_adapter.rb +34 -0
- data/spec/lib/pending_helpers.rb +27 -0
- data/spec/lib/rspec_immediate_feedback_formatter.rb +53 -0
- data/spec/public/associations/many_to_many_spec.rb +193 -0
- data/spec/public/associations/many_to_one_spec.rb +73 -0
- data/spec/public/associations/one_to_many_spec.rb +77 -0
- data/spec/public/associations/one_to_one_spec.rb +156 -0
- data/spec/public/collection_spec.rb +65 -0
- data/spec/public/migrations_spec.rb +359 -0
- data/spec/public/model/relationship_spec.rb +924 -0
- data/spec/public/model_spec.rb +159 -0
- data/spec/public/property_spec.rb +829 -0
- data/spec/public/resource_spec.rb +71 -0
- data/spec/public/sel_spec.rb +44 -0
- data/spec/public/setup_spec.rb +145 -0
- data/spec/public/shared/association_collection_shared_spec.rb +317 -0
- data/spec/public/shared/collection_shared_spec.rb +1670 -0
- data/spec/public/shared/finder_shared_spec.rb +1619 -0
- data/spec/public/shared/resource_shared_spec.rb +924 -0
- data/spec/public/shared/sel_shared_spec.rb +112 -0
- data/spec/public/transaction_spec.rb +129 -0
- data/spec/public/types/discriminator_spec.rb +130 -0
- data/spec/semipublic/adapters/abstract_adapter_spec.rb +30 -0
- data/spec/semipublic/adapters/in_memory_adapter_spec.rb +12 -0
- data/spec/semipublic/adapters/mysql_adapter_spec.rb +17 -0
- data/spec/semipublic/adapters/oracle_adapter_spec.rb +194 -0
- data/spec/semipublic/adapters/postgres_adapter_spec.rb +17 -0
- data/spec/semipublic/adapters/sqlite3_adapter_spec.rb +17 -0
- data/spec/semipublic/adapters/yaml_adapter_spec.rb +12 -0
- data/spec/semipublic/associations/many_to_one_spec.rb +53 -0
- data/spec/semipublic/associations/relationship_spec.rb +194 -0
- data/spec/semipublic/associations_spec.rb +177 -0
- data/spec/semipublic/collection_spec.rb +142 -0
- data/spec/semipublic/property_spec.rb +61 -0
- data/spec/semipublic/query/conditions_spec.rb +528 -0
- data/spec/semipublic/query/path_spec.rb +443 -0
- data/spec/semipublic/query_spec.rb +2626 -0
- data/spec/semipublic/resource_spec.rb +47 -0
- data/spec/semipublic/shared/condition_shared_spec.rb +9 -0
- data/spec/semipublic/shared/resource_shared_spec.rb +126 -0
- data/spec/spec.opts +3 -1
- data/spec/spec_helper.rb +80 -57
- data/tasks/ci.rb +19 -31
- data/tasks/dm.rb +43 -48
- data/tasks/doc.rb +8 -11
- data/tasks/gemspec.rb +5 -5
- data/tasks/hoe.rb +15 -16
- data/tasks/install.rb +8 -10
- metadata +74 -111
- data/lib/dm-core/associations.rb +0 -207
- data/lib/dm-core/associations/relationship_chain.rb +0 -81
- data/lib/dm-core/auto_migrations.rb +0 -105
- data/lib/dm-core/dependency_queue.rb +0 -32
- data/lib/dm-core/hook.rb +0 -11
- data/lib/dm-core/is.rb +0 -16
- data/lib/dm-core/logger.rb +0 -232
- data/lib/dm-core/migrations/destructive_migrations.rb +0 -17
- data/lib/dm-core/migrator.rb +0 -29
- data/lib/dm-core/scope.rb +0 -58
- data/lib/dm-core/support.rb +0 -7
- data/lib/dm-core/support/array.rb +0 -13
- data/lib/dm-core/support/assertions.rb +0 -8
- data/lib/dm-core/support/errors.rb +0 -23
- data/lib/dm-core/support/kernel.rb +0 -11
- data/lib/dm-core/support/symbol.rb +0 -41
- data/lib/dm-core/type_map.rb +0 -80
- data/lib/dm-core/types.rb +0 -19
- data/script/all +0 -4
- data/spec/integration/association_spec.rb +0 -1382
- data/spec/integration/association_through_spec.rb +0 -203
- data/spec/integration/associations/many_to_many_spec.rb +0 -449
- data/spec/integration/associations/many_to_one_spec.rb +0 -163
- data/spec/integration/associations/one_to_many_spec.rb +0 -188
- data/spec/integration/auto_migrations_spec.rb +0 -413
- data/spec/integration/collection_spec.rb +0 -1073
- data/spec/integration/data_objects_adapter_spec.rb +0 -32
- data/spec/integration/dependency_queue_spec.rb +0 -46
- data/spec/integration/model_spec.rb +0 -197
- data/spec/integration/mysql_adapter_spec.rb +0 -85
- data/spec/integration/postgres_adapter_spec.rb +0 -731
- data/spec/integration/property_spec.rb +0 -253
- data/spec/integration/query_spec.rb +0 -514
- data/spec/integration/repository_spec.rb +0 -61
- data/spec/integration/resource_spec.rb +0 -513
- data/spec/integration/sqlite3_adapter_spec.rb +0 -352
- data/spec/integration/sti_spec.rb +0 -273
- data/spec/integration/strategic_eager_loading_spec.rb +0 -156
- data/spec/integration/transaction_spec.rb +0 -75
- data/spec/integration/type_spec.rb +0 -275
- data/spec/lib/logging_helper.rb +0 -18
- data/spec/lib/mock_adapter.rb +0 -27
- data/spec/lib/model_loader.rb +0 -100
- data/spec/lib/publicize_methods.rb +0 -28
- data/spec/models/content.rb +0 -16
- data/spec/models/vehicles.rb +0 -34
- data/spec/models/zoo.rb +0 -48
- data/spec/unit/adapters/abstract_adapter_spec.rb +0 -133
- data/spec/unit/adapters/adapter_shared_spec.rb +0 -15
- data/spec/unit/adapters/data_objects_adapter_spec.rb +0 -632
- data/spec/unit/adapters/in_memory_adapter_spec.rb +0 -98
- data/spec/unit/adapters/postgres_adapter_spec.rb +0 -133
- data/spec/unit/associations/many_to_many_spec.rb +0 -32
- data/spec/unit/associations/many_to_one_spec.rb +0 -159
- data/spec/unit/associations/one_to_many_spec.rb +0 -393
- data/spec/unit/associations/one_to_one_spec.rb +0 -7
- data/spec/unit/associations/relationship_spec.rb +0 -71
- data/spec/unit/associations_spec.rb +0 -242
- data/spec/unit/auto_migrations_spec.rb +0 -111
- data/spec/unit/collection_spec.rb +0 -182
- data/spec/unit/data_mapper_spec.rb +0 -35
- data/spec/unit/identity_map_spec.rb +0 -126
- data/spec/unit/is_spec.rb +0 -80
- data/spec/unit/migrator_spec.rb +0 -33
- data/spec/unit/model_spec.rb +0 -321
- data/spec/unit/naming_conventions_spec.rb +0 -36
- data/spec/unit/property_set_spec.rb +0 -90
- data/spec/unit/property_spec.rb +0 -753
- data/spec/unit/query_spec.rb +0 -571
- data/spec/unit/repository_spec.rb +0 -93
- data/spec/unit/resource_spec.rb +0 -649
- data/spec/unit/scope_spec.rb +0 -142
- data/spec/unit/transaction_spec.rb +0 -493
- data/spec/unit/type_map_spec.rb +0 -114
- data/spec/unit/type_spec.rb +0 -119
data/.autotest
CHANGED
@@ -1,26 +1,29 @@
|
|
1
1
|
Autotest.add_hook :initialize do |at|
|
2
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
-
|
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
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,
|
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
|
-
|
40
|
-
property :
|
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("
|
52
|
-
repository(:integration).adapter.query("
|
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.
|
data/History.txt
CHANGED
@@ -1,52 +1,7 @@
|
|
1
|
-
=== 0.
|
1
|
+
=== 0.10.0 / 2009-10-15
|
2
2
|
|
3
|
-
*
|
3
|
+
* Countless enhancements:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
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.
|
data/Manifest.txt
CHANGED
@@ -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/
|
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/
|
32
|
-
lib/dm-core/
|
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/
|
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/
|
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/
|
46
|
-
lib/dm-core/
|
47
|
-
lib/dm-core/support/
|
48
|
-
lib/dm-core/support/
|
49
|
-
lib/dm-core/support/
|
50
|
-
lib/dm-core/support/
|
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/
|
68
|
-
spec/
|
69
|
-
spec/
|
70
|
-
spec/
|
71
|
-
spec/
|
72
|
-
spec/
|
73
|
-
spec/
|
74
|
-
spec/
|
75
|
-
spec/
|
76
|
-
spec/
|
77
|
-
spec/
|
78
|
-
spec/
|
79
|
-
spec/
|
80
|
-
spec/
|
81
|
-
spec/
|
82
|
-
spec/
|
83
|
-
spec/
|
84
|
-
spec/
|
85
|
-
spec/
|
86
|
-
spec/
|
87
|
-
spec/
|
88
|
-
spec/
|
89
|
-
spec/
|
90
|
-
spec/
|
91
|
-
spec/
|
92
|
-
spec/
|
93
|
-
spec/
|
94
|
-
spec/
|
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://
|
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://
|
12
|
-
patch[http://
|
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
|
-
|
24
|
+
repository do
|
25
|
+
@parent = Tree.first(:name => 'bob')
|
25
26
|
|
26
|
-
|
27
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
83
|
-
|
84
|
-
pet
|
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
|
-
|
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[
|
18
|
-
%w[
|
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'
|