dm-core 1.1.0 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -11
- data/README.rdoc +1 -1
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/dm-core.gemspec +30 -176
- data/lib/dm-core.rb +32 -67
- data/lib/dm-core/adapters/abstract_adapter.rb +1 -2
- data/lib/dm-core/associations/many_to_many.rb +11 -5
- data/lib/dm-core/associations/many_to_one.rb +17 -2
- data/lib/dm-core/associations/one_to_many.rb +16 -0
- data/lib/dm-core/backwards.rb +13 -0
- data/lib/dm-core/collection.rb +1 -1
- data/lib/dm-core/model.rb +99 -41
- data/lib/dm-core/model/property.rb +24 -27
- data/lib/dm-core/model/relationship.rb +22 -28
- data/lib/dm-core/property.rb +37 -50
- data/lib/dm-core/property/boolean.rb +6 -10
- data/lib/dm-core/property/date.rb +0 -2
- data/lib/dm-core/property/date_time.rb +0 -2
- data/lib/dm-core/property/decimal.rb +5 -1
- data/lib/dm-core/property/discriminator.rb +24 -26
- data/lib/dm-core/property/float.rb +5 -1
- data/lib/dm-core/property/numeric.rb +6 -9
- data/lib/dm-core/property/string.rb +2 -1
- data/lib/dm-core/property/time.rb +0 -2
- data/lib/dm-core/property/typecast/time.rb +7 -2
- data/lib/dm-core/property_set.rb +1 -3
- data/lib/dm-core/query.rb +3 -10
- data/lib/dm-core/query/conditions/comparison.rb +5 -1
- data/lib/dm-core/query/conditions/operation.rb +1 -1
- data/lib/dm-core/relationship_set.rb +0 -2
- data/lib/dm-core/resource.rb +27 -28
- data/lib/dm-core/resource/{state.rb → persistence_state.rb} +2 -2
- data/lib/dm-core/resource/{state → persistence_state}/clean.rb +4 -4
- data/lib/dm-core/resource/{state → persistence_state}/deleted.rb +2 -2
- data/lib/dm-core/resource/{state → persistence_state}/dirty.rb +2 -2
- data/lib/dm-core/resource/{state → persistence_state}/immutable.rb +3 -3
- data/lib/dm-core/resource/{state → persistence_state}/persisted.rb +3 -3
- data/lib/dm-core/resource/{state → persistence_state}/transient.rb +3 -3
- data/lib/dm-core/spec/lib/adapter_helpers.rb +2 -5
- data/lib/dm-core/spec/setup.rb +3 -2
- data/lib/dm-core/spec/shared/public/property_spec.rb +8 -0
- data/lib/dm-core/spec/shared/resource_spec.rb +14 -0
- data/lib/dm-core/spec/shared/semipublic/property_spec.rb +1 -1
- data/lib/dm-core/support/descendant_set.rb +0 -2
- data/lib/dm-core/support/ext/array.rb +0 -19
- data/lib/dm-core/support/ext/blank.rb +1 -0
- data/lib/dm-core/support/hook.rb +0 -3
- data/lib/dm-core/support/naming_conventions.rb +6 -0
- data/lib/dm-core/support/ordered_set.rb +0 -2
- data/lib/dm-core/support/subject_set.rb +0 -2
- data/lib/dm-core/version.rb +1 -1
- data/spec/public/associations/many_to_many_spec.rb +0 -1
- data/spec/public/model/property_spec.rb +55 -9
- data/spec/public/model/relationship_spec.rb +24 -2
- data/spec/public/model_spec.rb +32 -0
- data/spec/public/property/binary_spec.rb +14 -6
- data/spec/public/property/boolean_spec.rb +14 -6
- data/spec/public/property/class_spec.rb +14 -6
- data/spec/public/property/date_spec.rb +14 -6
- data/spec/public/property/date_time_spec.rb +14 -6
- data/spec/public/property/decimal_spec.rb +10 -2
- data/spec/public/property/discriminator_spec.rb +15 -1
- data/spec/public/property/float_spec.rb +14 -6
- data/spec/public/property/integer_spec.rb +14 -6
- data/spec/public/property/object_spec.rb +8 -0
- data/spec/public/property/serial_spec.rb +14 -6
- data/spec/public/property/string_spec.rb +14 -6
- data/spec/public/property/text_spec.rb +14 -6
- data/spec/public/property/time_spec.rb +14 -6
- data/spec/public/resource_spec.rb +58 -0
- data/spec/public/shared/finder_shared_spec.rb +8 -4
- data/spec/semipublic/associations/many_to_many_spec.rb +2 -0
- data/spec/semipublic/associations/many_to_one_spec.rb +2 -0
- data/spec/semipublic/associations/one_to_many_spec.rb +2 -0
- data/spec/semipublic/associations/one_to_one_spec.rb +2 -0
- data/spec/semipublic/property/binary_spec.rb +5 -5
- data/spec/semipublic/property/boolean_spec.rb +5 -5
- data/spec/semipublic/property/class_spec.rb +5 -5
- data/spec/semipublic/property/date_spec.rb +5 -5
- data/spec/semipublic/property/date_time_spec.rb +5 -5
- data/spec/semipublic/property/decimal_spec.rb +2 -2
- data/spec/semipublic/property/discriminator_spec.rb +5 -5
- data/spec/semipublic/property/float_spec.rb +5 -5
- data/spec/semipublic/property/integer_spec.rb +5 -5
- data/spec/semipublic/property/lookup_spec.rb +3 -3
- data/spec/semipublic/property/serial_spec.rb +5 -5
- data/spec/semipublic/property/string_spec.rb +5 -5
- data/spec/semipublic/property/text_spec.rb +5 -5
- data/spec/semipublic/property/time_spec.rb +5 -5
- data/spec/semipublic/query/conditions/comparison_spec.rb +44 -4
- data/spec/semipublic/query_spec.rb +2 -11
- data/spec/semipublic/resource/state/clean_spec.rb +6 -6
- data/spec/semipublic/resource/state/deleted_spec.rb +4 -4
- data/spec/semipublic/resource/state/dirty_spec.rb +8 -8
- data/spec/semipublic/resource/state/immutable_spec.rb +6 -6
- data/spec/semipublic/resource/state/transient_spec.rb +5 -5
- data/spec/semipublic/resource/state_spec.rb +15 -15
- data/spec/semipublic/shared/resource_shared_spec.rb +7 -1
- data/spec/semipublic/shared/resource_state_shared_spec.rb +8 -8
- data/spec/unit/array_spec.rb +0 -14
- data/spec/unit/blank_spec.rb +11 -0
- metadata +70 -188
- data/lib/dm-core/support/inflector.rb +0 -3
data/Gemfile
CHANGED
@@ -5,26 +5,28 @@ source 'http://rubygems.org'
|
|
5
5
|
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
6
|
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
7
7
|
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
|
8
|
-
DM_VERSION = '~> 1.
|
9
|
-
DO_VERSION = '~> 0.10.
|
8
|
+
DM_VERSION = '~> 1.2.0.rc1'
|
9
|
+
DO_VERSION = '~> 0.10.6'
|
10
10
|
DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
|
11
11
|
|
12
|
-
gem 'addressable', '~> 2.2.
|
12
|
+
gem 'addressable', '~> 2.2.6'
|
13
13
|
|
14
14
|
group :development do
|
15
15
|
|
16
|
-
gem 'jeweler', '~> 1.
|
17
|
-
gem 'rake', '~> 0.
|
18
|
-
gem 'rspec', '~> 1.3.
|
19
|
-
gem 'yard', '~> 0.6'
|
16
|
+
gem 'jeweler', '~> 1.6.4'
|
17
|
+
gem 'rake', '~> 0.9.2'
|
18
|
+
gem 'rspec', '~> 1.3.2'
|
20
19
|
|
21
20
|
end
|
22
21
|
|
23
|
-
|
22
|
+
platforms :mri_18 do
|
23
|
+
group :quality do
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
gem 'rcov', '~> 0.9.10'
|
26
|
+
gem 'yard', '~> 0.7.2'
|
27
|
+
gem 'yardstick', '~> 0.4'
|
27
28
|
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
group :datamapper do
|
@@ -50,7 +52,7 @@ group :datamapper do
|
|
50
52
|
end
|
51
53
|
|
52
54
|
adapters.each do |adapter|
|
53
|
-
gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
|
55
|
+
gem "dm-#{adapter}-adapter", ENV.fetch('ADAPTER_VERSION', DM_VERSION), SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
|
54
56
|
end
|
55
57
|
|
56
58
|
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
DataMapper sports a very accessible code-base and a welcoming community.
|
6
6
|
Outside contributions and feedback are welcome and encouraged, especially
|
7
7
|
constructive criticism. Make your voice heard! Submit a
|
8
|
-
ticket[
|
8
|
+
ticket[https://github.com/datamapper/dm-core/issues] or
|
9
9
|
patch[http://datamapper.lighthouseapp.com], speak up
|
10
10
|
on our mailing-list[http://groups.google.com/group/datamapper/], chat with us
|
11
11
|
on irc[irc://irc.freenode.net/#datamapper], write a spec, get it reviewed, ask
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
begin
|
5
|
-
gem 'jeweler', '~> 1.
|
5
|
+
gem 'jeweler', '~> 1.6.4'
|
6
6
|
require 'jeweler'
|
7
7
|
|
8
8
|
Jeweler::Tasks.new do |gem|
|
@@ -12,7 +12,6 @@ begin
|
|
12
12
|
gem.email = 'dan.kubb@gmail.com'
|
13
13
|
gem.homepage = 'http://github.com/datamapper/%s' % gem.name
|
14
14
|
gem.authors = [ 'Dan Kubb' ]
|
15
|
-
gem.has_rdoc = 'yard'
|
16
15
|
|
17
16
|
gem.rubyforge_project = 'datamapper'
|
18
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0.rc1
|
data/dm-core.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.
|
7
|
+
s.name = "dm-core"
|
8
|
+
s.version = "1.2.0.rc1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Kubb"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2011-09-09"
|
13
|
+
s.description = "Faster, Better, Simpler."
|
14
|
+
s.email = "dan.kubb@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.rdoc"
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/dm-core/associations/one_to_many.rb",
|
36
36
|
"lib/dm-core/associations/one_to_one.rb",
|
37
37
|
"lib/dm-core/associations/relationship.rb",
|
38
|
+
"lib/dm-core/backwards.rb",
|
38
39
|
"lib/dm-core/collection.rb",
|
39
40
|
"lib/dm-core/core_ext/kernel.rb",
|
40
41
|
"lib/dm-core/core_ext/pathname.rb",
|
@@ -76,13 +77,13 @@ Gem::Specification.new do |s|
|
|
76
77
|
"lib/dm-core/relationship_set.rb",
|
77
78
|
"lib/dm-core/repository.rb",
|
78
79
|
"lib/dm-core/resource.rb",
|
79
|
-
"lib/dm-core/resource/
|
80
|
-
"lib/dm-core/resource/
|
81
|
-
"lib/dm-core/resource/
|
82
|
-
"lib/dm-core/resource/
|
83
|
-
"lib/dm-core/resource/
|
84
|
-
"lib/dm-core/resource/
|
85
|
-
"lib/dm-core/resource/
|
80
|
+
"lib/dm-core/resource/persistence_state.rb",
|
81
|
+
"lib/dm-core/resource/persistence_state/clean.rb",
|
82
|
+
"lib/dm-core/resource/persistence_state/deleted.rb",
|
83
|
+
"lib/dm-core/resource/persistence_state/dirty.rb",
|
84
|
+
"lib/dm-core/resource/persistence_state/immutable.rb",
|
85
|
+
"lib/dm-core/resource/persistence_state/persisted.rb",
|
86
|
+
"lib/dm-core/resource/persistence_state/transient.rb",
|
86
87
|
"lib/dm-core/spec/lib/adapter_helpers.rb",
|
87
88
|
"lib/dm-core/spec/lib/collection_helpers.rb",
|
88
89
|
"lib/dm-core/spec/lib/counter_adapter.rb",
|
@@ -109,7 +110,6 @@ Gem::Specification.new do |s|
|
|
109
110
|
"lib/dm-core/support/ext/try_dup.rb",
|
110
111
|
"lib/dm-core/support/hook.rb",
|
111
112
|
"lib/dm-core/support/inflections.rb",
|
112
|
-
"lib/dm-core/support/inflector.rb",
|
113
113
|
"lib/dm-core/support/inflector/inflections.rb",
|
114
114
|
"lib/dm-core/support/inflector/methods.rb",
|
115
115
|
"lib/dm-core/support/lazy_array.rb",
|
@@ -271,177 +271,31 @@ Gem::Specification.new do |s|
|
|
271
271
|
"tasks/yard.rake",
|
272
272
|
"tasks/yardstick.rake"
|
273
273
|
]
|
274
|
-
s.homepage =
|
274
|
+
s.homepage = "http://github.com/datamapper/dm-core"
|
275
275
|
s.require_paths = ["lib"]
|
276
|
-
s.rubyforge_project =
|
277
|
-
s.rubygems_version =
|
278
|
-
s.summary =
|
279
|
-
s.test_files = [
|
280
|
-
"spec/lib/rspec_immediate_feedback_formatter.rb",
|
281
|
-
"spec/public/associations/many_to_many/read_multiple_join_spec.rb",
|
282
|
-
"spec/public/associations/many_to_many_spec.rb",
|
283
|
-
"spec/public/associations/many_to_one_spec.rb",
|
284
|
-
"spec/public/associations/many_to_one_with_boolean_cpk_spec.rb",
|
285
|
-
"spec/public/associations/many_to_one_with_custom_fk_spec.rb",
|
286
|
-
"spec/public/associations/one_to_many_spec.rb",
|
287
|
-
"spec/public/associations/one_to_one_spec.rb",
|
288
|
-
"spec/public/associations/one_to_one_with_boolean_cpk_spec.rb",
|
289
|
-
"spec/public/collection_spec.rb",
|
290
|
-
"spec/public/finalize_spec.rb",
|
291
|
-
"spec/public/model/hook_spec.rb",
|
292
|
-
"spec/public/model/property_spec.rb",
|
293
|
-
"spec/public/model/relationship_spec.rb",
|
294
|
-
"spec/public/model_spec.rb",
|
295
|
-
"spec/public/property/binary_spec.rb",
|
296
|
-
"spec/public/property/boolean_spec.rb",
|
297
|
-
"spec/public/property/class_spec.rb",
|
298
|
-
"spec/public/property/date_spec.rb",
|
299
|
-
"spec/public/property/date_time_spec.rb",
|
300
|
-
"spec/public/property/decimal_spec.rb",
|
301
|
-
"spec/public/property/discriminator_spec.rb",
|
302
|
-
"spec/public/property/float_spec.rb",
|
303
|
-
"spec/public/property/integer_spec.rb",
|
304
|
-
"spec/public/property/object_spec.rb",
|
305
|
-
"spec/public/property/serial_spec.rb",
|
306
|
-
"spec/public/property/string_spec.rb",
|
307
|
-
"spec/public/property/text_spec.rb",
|
308
|
-
"spec/public/property/time_spec.rb",
|
309
|
-
"spec/public/property_spec.rb",
|
310
|
-
"spec/public/resource_spec.rb",
|
311
|
-
"spec/public/sel_spec.rb",
|
312
|
-
"spec/public/setup_spec.rb",
|
313
|
-
"spec/public/shared/association_collection_shared_spec.rb",
|
314
|
-
"spec/public/shared/collection_finder_shared_spec.rb",
|
315
|
-
"spec/public/shared/collection_shared_spec.rb",
|
316
|
-
"spec/public/shared/finder_shared_spec.rb",
|
317
|
-
"spec/semipublic/adapters/abstract_adapter_spec.rb",
|
318
|
-
"spec/semipublic/adapters/in_memory_adapter_spec.rb",
|
319
|
-
"spec/semipublic/associations/many_to_many_spec.rb",
|
320
|
-
"spec/semipublic/associations/many_to_one_spec.rb",
|
321
|
-
"spec/semipublic/associations/one_to_many_spec.rb",
|
322
|
-
"spec/semipublic/associations/one_to_one_spec.rb",
|
323
|
-
"spec/semipublic/associations/relationship_spec.rb",
|
324
|
-
"spec/semipublic/associations_spec.rb",
|
325
|
-
"spec/semipublic/collection_spec.rb",
|
326
|
-
"spec/semipublic/model_spec.rb",
|
327
|
-
"spec/semipublic/property/binary_spec.rb",
|
328
|
-
"spec/semipublic/property/boolean_spec.rb",
|
329
|
-
"spec/semipublic/property/class_spec.rb",
|
330
|
-
"spec/semipublic/property/date_spec.rb",
|
331
|
-
"spec/semipublic/property/date_time_spec.rb",
|
332
|
-
"spec/semipublic/property/decimal_spec.rb",
|
333
|
-
"spec/semipublic/property/discriminator_spec.rb",
|
334
|
-
"spec/semipublic/property/float_spec.rb",
|
335
|
-
"spec/semipublic/property/integer_spec.rb",
|
336
|
-
"spec/semipublic/property/lookup_spec.rb",
|
337
|
-
"spec/semipublic/property/serial_spec.rb",
|
338
|
-
"spec/semipublic/property/string_spec.rb",
|
339
|
-
"spec/semipublic/property/text_spec.rb",
|
340
|
-
"spec/semipublic/property/time_spec.rb",
|
341
|
-
"spec/semipublic/property_spec.rb",
|
342
|
-
"spec/semipublic/query/conditions/comparison_spec.rb",
|
343
|
-
"spec/semipublic/query/conditions/operation_spec.rb",
|
344
|
-
"spec/semipublic/query/path_spec.rb",
|
345
|
-
"spec/semipublic/query_spec.rb",
|
346
|
-
"spec/semipublic/resource/state/clean_spec.rb",
|
347
|
-
"spec/semipublic/resource/state/deleted_spec.rb",
|
348
|
-
"spec/semipublic/resource/state/dirty_spec.rb",
|
349
|
-
"spec/semipublic/resource/state/immutable_spec.rb",
|
350
|
-
"spec/semipublic/resource/state/transient_spec.rb",
|
351
|
-
"spec/semipublic/resource/state_spec.rb",
|
352
|
-
"spec/semipublic/resource_spec.rb",
|
353
|
-
"spec/semipublic/shared/condition_shared_spec.rb",
|
354
|
-
"spec/semipublic/shared/resource_shared_spec.rb",
|
355
|
-
"spec/semipublic/shared/resource_state_shared_spec.rb",
|
356
|
-
"spec/semipublic/shared/subject_shared_spec.rb",
|
357
|
-
"spec/spec_helper.rb",
|
358
|
-
"spec/support/core_ext/hash.rb",
|
359
|
-
"spec/support/core_ext/inheritable_attributes.rb",
|
360
|
-
"spec/support/properties/huge_integer.rb",
|
361
|
-
"spec/unit/array_spec.rb",
|
362
|
-
"spec/unit/blank_spec.rb",
|
363
|
-
"spec/unit/data_mapper/ordered_set/append_spec.rb",
|
364
|
-
"spec/unit/data_mapper/ordered_set/clear_spec.rb",
|
365
|
-
"spec/unit/data_mapper/ordered_set/delete_spec.rb",
|
366
|
-
"spec/unit/data_mapper/ordered_set/each_spec.rb",
|
367
|
-
"spec/unit/data_mapper/ordered_set/empty_spec.rb",
|
368
|
-
"spec/unit/data_mapper/ordered_set/entries_spec.rb",
|
369
|
-
"spec/unit/data_mapper/ordered_set/eql_spec.rb",
|
370
|
-
"spec/unit/data_mapper/ordered_set/equal_value_spec.rb",
|
371
|
-
"spec/unit/data_mapper/ordered_set/hash_spec.rb",
|
372
|
-
"spec/unit/data_mapper/ordered_set/include_spec.rb",
|
373
|
-
"spec/unit/data_mapper/ordered_set/index_spec.rb",
|
374
|
-
"spec/unit/data_mapper/ordered_set/initialize_spec.rb",
|
375
|
-
"spec/unit/data_mapper/ordered_set/merge_spec.rb",
|
376
|
-
"spec/unit/data_mapper/ordered_set/shared/append_spec.rb",
|
377
|
-
"spec/unit/data_mapper/ordered_set/shared/clear_spec.rb",
|
378
|
-
"spec/unit/data_mapper/ordered_set/shared/delete_spec.rb",
|
379
|
-
"spec/unit/data_mapper/ordered_set/shared/each_spec.rb",
|
380
|
-
"spec/unit/data_mapper/ordered_set/shared/empty_spec.rb",
|
381
|
-
"spec/unit/data_mapper/ordered_set/shared/entries_spec.rb",
|
382
|
-
"spec/unit/data_mapper/ordered_set/shared/include_spec.rb",
|
383
|
-
"spec/unit/data_mapper/ordered_set/shared/index_spec.rb",
|
384
|
-
"spec/unit/data_mapper/ordered_set/shared/initialize_spec.rb",
|
385
|
-
"spec/unit/data_mapper/ordered_set/shared/merge_spec.rb",
|
386
|
-
"spec/unit/data_mapper/ordered_set/shared/size_spec.rb",
|
387
|
-
"spec/unit/data_mapper/ordered_set/shared/to_ary_spec.rb",
|
388
|
-
"spec/unit/data_mapper/ordered_set/size_spec.rb",
|
389
|
-
"spec/unit/data_mapper/ordered_set/to_ary_spec.rb",
|
390
|
-
"spec/unit/data_mapper/subject_set/append_spec.rb",
|
391
|
-
"spec/unit/data_mapper/subject_set/clear_spec.rb",
|
392
|
-
"spec/unit/data_mapper/subject_set/delete_spec.rb",
|
393
|
-
"spec/unit/data_mapper/subject_set/each_spec.rb",
|
394
|
-
"spec/unit/data_mapper/subject_set/empty_spec.rb",
|
395
|
-
"spec/unit/data_mapper/subject_set/entries_spec.rb",
|
396
|
-
"spec/unit/data_mapper/subject_set/get_spec.rb",
|
397
|
-
"spec/unit/data_mapper/subject_set/include_spec.rb",
|
398
|
-
"spec/unit/data_mapper/subject_set/named_spec.rb",
|
399
|
-
"spec/unit/data_mapper/subject_set/shared/append_spec.rb",
|
400
|
-
"spec/unit/data_mapper/subject_set/shared/clear_spec.rb",
|
401
|
-
"spec/unit/data_mapper/subject_set/shared/delete_spec.rb",
|
402
|
-
"spec/unit/data_mapper/subject_set/shared/each_spec.rb",
|
403
|
-
"spec/unit/data_mapper/subject_set/shared/empty_spec.rb",
|
404
|
-
"spec/unit/data_mapper/subject_set/shared/entries_spec.rb",
|
405
|
-
"spec/unit/data_mapper/subject_set/shared/get_spec.rb",
|
406
|
-
"spec/unit/data_mapper/subject_set/shared/include_spec.rb",
|
407
|
-
"spec/unit/data_mapper/subject_set/shared/named_spec.rb",
|
408
|
-
"spec/unit/data_mapper/subject_set/shared/size_spec.rb",
|
409
|
-
"spec/unit/data_mapper/subject_set/shared/to_ary_spec.rb",
|
410
|
-
"spec/unit/data_mapper/subject_set/shared/values_at_spec.rb",
|
411
|
-
"spec/unit/data_mapper/subject_set/size_spec.rb",
|
412
|
-
"spec/unit/data_mapper/subject_set/to_ary_spec.rb",
|
413
|
-
"spec/unit/data_mapper/subject_set/values_at_spec.rb",
|
414
|
-
"spec/unit/hash_spec.rb",
|
415
|
-
"spec/unit/hook_spec.rb",
|
416
|
-
"spec/unit/lazy_array_spec.rb",
|
417
|
-
"spec/unit/mash_spec.rb",
|
418
|
-
"spec/unit/module_spec.rb",
|
419
|
-
"spec/unit/object_spec.rb",
|
420
|
-
"spec/unit/try_dup_spec.rb"
|
421
|
-
]
|
276
|
+
s.rubyforge_project = "datamapper"
|
277
|
+
s.rubygems_version = "1.8.10"
|
278
|
+
s.summary = "An Object/Relational Mapper for Ruby"
|
422
279
|
|
423
280
|
if s.respond_to? :specification_version then
|
424
281
|
s.specification_version = 3
|
425
282
|
|
426
283
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
427
|
-
s.add_runtime_dependency(%q<addressable>, ["~> 2.2.
|
428
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
429
|
-
s.add_development_dependency(%q<rake>, ["~> 0.
|
430
|
-
s.add_development_dependency(%q<rspec>, ["~> 1.3.
|
431
|
-
s.add_development_dependency(%q<yard>, ["~> 0.6"])
|
284
|
+
s.add_runtime_dependency(%q<addressable>, ["~> 2.2.6"])
|
285
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
286
|
+
s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
|
287
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
|
432
288
|
else
|
433
|
-
s.add_dependency(%q<addressable>, ["~> 2.2.
|
434
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
435
|
-
s.add_dependency(%q<rake>, ["~> 0.
|
436
|
-
s.add_dependency(%q<rspec>, ["~> 1.3.
|
437
|
-
s.add_dependency(%q<yard>, ["~> 0.6"])
|
289
|
+
s.add_dependency(%q<addressable>, ["~> 2.2.6"])
|
290
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
291
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
292
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.2"])
|
438
293
|
end
|
439
294
|
else
|
440
|
-
s.add_dependency(%q<addressable>, ["~> 2.2.
|
441
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
442
|
-
s.add_dependency(%q<rake>, ["~> 0.
|
443
|
-
s.add_dependency(%q<rspec>, ["~> 1.3.
|
444
|
-
s.add_dependency(%q<yard>, ["~> 0.6"])
|
295
|
+
s.add_dependency(%q<addressable>, ["~> 2.2.6"])
|
296
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
297
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
298
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.2"])
|
445
299
|
end
|
446
300
|
end
|
447
301
|
|
data/lib/dm-core.rb
CHANGED
@@ -28,7 +28,9 @@ require 'dm-core/support/ext/array'
|
|
28
28
|
require 'dm-core/support/ext/try_dup'
|
29
29
|
|
30
30
|
require 'dm-core/support/mash'
|
31
|
-
require 'dm-core/support/inflector'
|
31
|
+
require 'dm-core/support/inflector/inflections'
|
32
|
+
require 'dm-core/support/inflector/methods'
|
33
|
+
require 'dm-core/support/inflections'
|
32
34
|
require 'dm-core/support/chainable'
|
33
35
|
require 'dm-core/support/deprecate'
|
34
36
|
require 'dm-core/support/descendant_set'
|
@@ -38,10 +40,29 @@ require 'dm-core/support/lazy_array'
|
|
38
40
|
require 'dm-core/support/local_object_space'
|
39
41
|
require 'dm-core/support/hook'
|
40
42
|
require 'dm-core/support/subject'
|
43
|
+
require 'dm-core/support/ordered_set'
|
44
|
+
require 'dm-core/support/subject_set'
|
41
45
|
|
42
|
-
require 'dm-core/
|
46
|
+
require 'dm-core/query'
|
47
|
+
require 'dm-core/query/conditions/operation'
|
48
|
+
require 'dm-core/query/conditions/comparison'
|
49
|
+
require 'dm-core/query/operator'
|
50
|
+
require 'dm-core/query/direction'
|
51
|
+
require 'dm-core/query/path'
|
52
|
+
require 'dm-core/query/sort'
|
53
|
+
|
54
|
+
require 'dm-core/resource'
|
55
|
+
require 'dm-core/resource/persistence_state'
|
56
|
+
require 'dm-core/resource/persistence_state/transient'
|
57
|
+
require 'dm-core/resource/persistence_state/immutable'
|
58
|
+
require 'dm-core/resource/persistence_state/persisted'
|
59
|
+
require 'dm-core/resource/persistence_state/clean'
|
60
|
+
require 'dm-core/resource/persistence_state/deleted'
|
61
|
+
require 'dm-core/resource/persistence_state/dirty'
|
43
62
|
|
44
63
|
require 'dm-core/property'
|
64
|
+
require 'dm-core/property/typecast/numeric'
|
65
|
+
require 'dm-core/property/typecast/time'
|
45
66
|
require 'dm-core/property/object'
|
46
67
|
require 'dm-core/property/string'
|
47
68
|
require 'dm-core/property/binary'
|
@@ -57,7 +78,6 @@ require 'dm-core/property/date_time'
|
|
57
78
|
require 'dm-core/property/time'
|
58
79
|
require 'dm-core/property/class'
|
59
80
|
require 'dm-core/property/discriminator'
|
60
|
-
|
61
81
|
require 'dm-core/property/lookup'
|
62
82
|
require 'dm-core/property_set'
|
63
83
|
|
@@ -68,30 +88,19 @@ require 'dm-core/model/scope'
|
|
68
88
|
require 'dm-core/model/relationship'
|
69
89
|
require 'dm-core/model/property'
|
70
90
|
|
71
|
-
require 'dm-core/
|
72
|
-
require 'dm-core/
|
91
|
+
require 'dm-core/collection'
|
92
|
+
require 'dm-core/relationship_set'
|
73
93
|
require 'dm-core/associations/relationship'
|
74
94
|
require 'dm-core/associations/one_to_many'
|
75
95
|
require 'dm-core/associations/one_to_one'
|
76
96
|
require 'dm-core/associations/many_to_one'
|
77
97
|
require 'dm-core/associations/many_to_many'
|
98
|
+
|
78
99
|
require 'dm-core/identity_map'
|
79
|
-
require 'dm-core/query'
|
80
|
-
require 'dm-core/query/conditions/operation'
|
81
|
-
require 'dm-core/query/conditions/comparison'
|
82
|
-
require 'dm-core/query/operator'
|
83
|
-
require 'dm-core/query/direction'
|
84
|
-
require 'dm-core/query/path'
|
85
|
-
require 'dm-core/query/sort'
|
86
100
|
require 'dm-core/repository'
|
87
|
-
require 'dm-core/
|
88
|
-
require 'dm-core/
|
89
|
-
|
90
|
-
require 'dm-core/resource/state/immutable'
|
91
|
-
require 'dm-core/resource/state/persisted'
|
92
|
-
require 'dm-core/resource/state/clean'
|
93
|
-
require 'dm-core/resource/state/deleted'
|
94
|
-
require 'dm-core/resource/state/dirty'
|
101
|
+
require 'dm-core/adapters'
|
102
|
+
require 'dm-core/adapters/abstract_adapter'
|
103
|
+
|
95
104
|
require 'dm-core/support/logger'
|
96
105
|
require 'dm-core/support/naming_conventions'
|
97
106
|
require 'dm-core/version'
|
@@ -99,6 +108,8 @@ require 'dm-core/version'
|
|
99
108
|
require 'dm-core/core_ext/kernel' # TODO: do not load automatically
|
100
109
|
require 'dm-core/core_ext/symbol' # TODO: do not load automatically
|
101
110
|
|
111
|
+
require 'dm-core/backwards' # TODO: do not load automatically
|
112
|
+
|
102
113
|
# A logger should always be present. Lets be consistent with DO
|
103
114
|
DataMapper::Logger.new(StringIO.new, :fatal)
|
104
115
|
|
@@ -267,54 +278,8 @@ module DataMapper
|
|
267
278
|
#
|
268
279
|
# @api public
|
269
280
|
def self.finalize
|
270
|
-
Model.descendants.each
|
271
|
-
finalize_model(model)
|
272
|
-
end
|
281
|
+
Model.descendants.each { |model| model.finalize }
|
273
282
|
self
|
274
283
|
end
|
275
284
|
|
276
|
-
private
|
277
|
-
|
278
|
-
# @api private
|
279
|
-
def self.finalize_model(model)
|
280
|
-
name = model.name
|
281
|
-
repository_name = model.repository_name
|
282
|
-
relationships = model.relationships(repository_name)
|
283
|
-
|
284
|
-
if name.to_s.strip.empty?
|
285
|
-
raise IncompleteModelError, "#{model.inspect} must have a name"
|
286
|
-
end
|
287
|
-
|
288
|
-
if model.properties(repository_name).empty? &&
|
289
|
-
!relationships.any? { |relationship| relationship.kind_of?(Associations::ManyToOne::Relationship) }
|
290
|
-
raise IncompleteModelError, "#{name} must have at least one property or many to one relationship to be valid"
|
291
|
-
end
|
292
|
-
|
293
|
-
# Initialize all foreign key properties established by relationships
|
294
|
-
relationships.each do |relationship|
|
295
|
-
if relationship.kind_of?(Associations::ManyToOne::Relationship)
|
296
|
-
# Initialize the foreign key property this "many to one"
|
297
|
-
# relationship uses to persist itself
|
298
|
-
relationship.child_key
|
299
|
-
elsif relationship.kind_of?(Associations::ManyToMany::Relationship)
|
300
|
-
# Initialize the chain for "many to many" relationships
|
301
|
-
relationship.through
|
302
|
-
relationship.via
|
303
|
-
else
|
304
|
-
# If this is a "one to one" or "one to many" relationship, initialize
|
305
|
-
# the inverse "many to one" relationships explicitly before initializing
|
306
|
-
# other relationships. This makes sure that foreign key properties always
|
307
|
-
# appear in the order they were declared.
|
308
|
-
relationship.child_model.relationships.each do |remote_relationship|
|
309
|
-
if remote_relationship.kind_of?(Associations::ManyToOne::Relationship)
|
310
|
-
remote_relationship.child_key
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
if model.key(repository_name).empty?
|
317
|
-
raise IncompleteModelError, "#{name} must have a key to be valid"
|
318
|
-
end
|
319
|
-
end
|
320
285
|
end # module DataMapper
|