cuprum-collections 0.3.0 → 0.4.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/DEVELOPMENT.md +2 -2
- data/README.md +13 -11
- data/lib/cuprum/collections/association.rb +256 -0
- data/lib/cuprum/collections/associations/belongs_to.rb +32 -0
- data/lib/cuprum/collections/associations/has_many.rb +23 -0
- data/lib/cuprum/collections/associations/has_one.rb +23 -0
- data/lib/cuprum/collections/associations.rb +10 -0
- data/lib/cuprum/collections/basic/collection.rb +39 -74
- data/lib/cuprum/collections/basic/commands/find_many.rb +1 -1
- data/lib/cuprum/collections/basic/commands/find_matching.rb +1 -1
- data/lib/cuprum/collections/basic/repository.rb +9 -33
- data/lib/cuprum/collections/basic.rb +1 -0
- data/lib/cuprum/collections/collection.rb +154 -0
- data/lib/cuprum/collections/commands/associations/find_many.rb +161 -0
- data/lib/cuprum/collections/commands/associations/require_many.rb +48 -0
- data/lib/cuprum/collections/commands/associations.rb +13 -0
- data/lib/cuprum/collections/commands/find_one_matching.rb +1 -1
- data/lib/cuprum/collections/commands.rb +1 -0
- data/lib/cuprum/collections/errors/abstract_find_error.rb +1 -1
- data/lib/cuprum/collections/relation.rb +401 -0
- data/lib/cuprum/collections/repository.rb +71 -4
- data/lib/cuprum/collections/resource.rb +65 -0
- data/lib/cuprum/collections/rspec/contracts/association_contracts.rb +2137 -0
- data/lib/cuprum/collections/rspec/contracts/basic/command_contracts.rb +484 -0
- data/lib/cuprum/collections/rspec/contracts/basic.rb +11 -0
- data/lib/cuprum/collections/rspec/contracts/collection_contracts.rb +429 -0
- data/lib/cuprum/collections/rspec/contracts/command_contracts.rb +1462 -0
- data/lib/cuprum/collections/rspec/contracts/query_contracts.rb +1093 -0
- data/lib/cuprum/collections/rspec/contracts/relation_contracts.rb +1381 -0
- data/lib/cuprum/collections/rspec/contracts/repository_contracts.rb +605 -0
- data/lib/cuprum/collections/rspec/contracts.rb +23 -0
- data/lib/cuprum/collections/rspec/fixtures.rb +85 -82
- data/lib/cuprum/collections/rspec.rb +4 -1
- data/lib/cuprum/collections/version.rb +3 -3
- data/lib/cuprum/collections.rb +9 -4
- metadata +25 -21
- data/lib/cuprum/collections/base.rb +0 -11
- data/lib/cuprum/collections/basic/rspec/command_contract.rb +0 -392
- data/lib/cuprum/collections/rspec/assign_one_command_contract.rb +0 -168
- data/lib/cuprum/collections/rspec/build_one_command_contract.rb +0 -93
- data/lib/cuprum/collections/rspec/collection_contract.rb +0 -190
- data/lib/cuprum/collections/rspec/destroy_one_command_contract.rb +0 -108
- data/lib/cuprum/collections/rspec/find_many_command_contract.rb +0 -407
- data/lib/cuprum/collections/rspec/find_matching_command_contract.rb +0 -194
- data/lib/cuprum/collections/rspec/find_one_command_contract.rb +0 -157
- data/lib/cuprum/collections/rspec/insert_one_command_contract.rb +0 -84
- data/lib/cuprum/collections/rspec/query_builder_contract.rb +0 -92
- data/lib/cuprum/collections/rspec/query_contract.rb +0 -650
- data/lib/cuprum/collections/rspec/querying_contract.rb +0 -298
- data/lib/cuprum/collections/rspec/repository_contract.rb +0 -235
- data/lib/cuprum/collections/rspec/update_one_command_contract.rb +0 -80
- data/lib/cuprum/collections/rspec/validate_one_command_contract.rb +0 -96
@@ -4,86 +4,89 @@ require 'cuprum/collections/rspec'
|
|
4
4
|
|
5
5
|
module Cuprum::Collections::RSpec
|
6
6
|
# Sample data for validating collection implementations.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
7
|
+
module Fixtures
|
8
|
+
# Sample data for Book objects.
|
9
|
+
BOOKS_FIXTURES = [
|
10
|
+
{
|
11
|
+
'id' => 0,
|
12
|
+
'title' => 'The Hobbit',
|
13
|
+
'author' => 'J.R.R. Tolkien',
|
14
|
+
'series' => nil,
|
15
|
+
'category' => 'Science Fiction and Fantasy',
|
16
|
+
'published_at' => '1937-09-21'
|
17
|
+
},
|
18
|
+
{
|
19
|
+
'id' => 1,
|
20
|
+
'title' => 'The Silmarillion',
|
21
|
+
'author' => 'J.R.R. Tolkien',
|
22
|
+
'series' => nil,
|
23
|
+
'category' => 'Science Fiction and Fantasy',
|
24
|
+
'published_at' => '1977-09-15'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
'id' => 2,
|
28
|
+
'title' => 'The Fellowship of the Ring',
|
29
|
+
'author' => 'J.R.R. Tolkien',
|
30
|
+
'series' => 'The Lord of the Rings',
|
31
|
+
'category' => 'Science Fiction and Fantasy',
|
32
|
+
'published_at' => '1954-07-29'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
'id' => 3,
|
36
|
+
'title' => 'The Two Towers',
|
37
|
+
'author' => 'J.R.R. Tolkien',
|
38
|
+
'series' => 'The Lord of the Rings',
|
39
|
+
'category' => 'Science Fiction and Fantasy',
|
40
|
+
'published_at' => '1954-11-11'
|
41
|
+
},
|
42
|
+
{
|
43
|
+
'id' => 4,
|
44
|
+
'title' => 'The Return of the King',
|
45
|
+
'author' => 'J.R.R. Tolkien',
|
46
|
+
'series' => 'The Lord of the Rings',
|
47
|
+
'category' => 'Science Fiction and Fantasy',
|
48
|
+
'published_at' => '1955-10-20'
|
49
|
+
},
|
50
|
+
{
|
51
|
+
'id' => 5,
|
52
|
+
'title' => 'The Word for World is Forest',
|
53
|
+
'author' => 'Ursula K. LeGuin',
|
54
|
+
'series' => nil,
|
55
|
+
'category' => 'Science Fiction and Fantasy',
|
56
|
+
'published_at' => '1972-03-13'
|
57
|
+
},
|
58
|
+
{
|
59
|
+
'id' => 6,
|
60
|
+
'title' => 'The Ones Who Walk Away From Omelas',
|
61
|
+
'author' => 'Ursula K. LeGuin',
|
62
|
+
'series' => nil,
|
63
|
+
'category' => 'Science Fiction and Fantasy',
|
64
|
+
'published_at' => '1973-10-01'
|
65
|
+
},
|
66
|
+
{
|
67
|
+
'id' => 7,
|
68
|
+
'title' => 'A Wizard of Earthsea',
|
69
|
+
'author' => 'Ursula K. LeGuin',
|
70
|
+
'series' => 'Earthsea',
|
71
|
+
'category' => 'Science Fiction and Fantasy',
|
72
|
+
'published_at' => '1968-11-01'
|
73
|
+
},
|
74
|
+
{
|
75
|
+
'id' => 8,
|
76
|
+
'title' => 'The Tombs of Atuan',
|
77
|
+
'author' => 'Ursula K. LeGuin',
|
78
|
+
'series' => 'Earthsea',
|
79
|
+
'category' => 'Science Fiction and Fantasy',
|
80
|
+
'published_at' => '1970-12-01'
|
81
|
+
},
|
82
|
+
{
|
83
|
+
'id' => 9,
|
84
|
+
'title' => 'The Farthest Shore',
|
85
|
+
'author' => 'Ursula K. LeGuin',
|
86
|
+
'series' => 'Earthsea',
|
87
|
+
'category' => 'Science Fiction and Fantasy',
|
88
|
+
'published_at' => '1972-09-01'
|
89
|
+
}
|
90
|
+
].map(&:freeze).freeze
|
91
|
+
end
|
89
92
|
end
|
@@ -4,5 +4,8 @@ require 'cuprum/collections'
|
|
4
4
|
|
5
5
|
module Cuprum::Collections
|
6
6
|
# Namespace for RSpec contracts, which validate collection implementations.
|
7
|
-
module RSpec
|
7
|
+
module RSpec
|
8
|
+
autoload :Contracts, 'cuprum/collections/rspec/contracts'
|
9
|
+
autoload :Fixtures, 'cuprum/collections/rspec/fixtures'
|
10
|
+
end
|
8
11
|
end
|
@@ -11,13 +11,13 @@ module Cuprum
|
|
11
11
|
# Major version.
|
12
12
|
MAJOR = 0
|
13
13
|
# Minor version.
|
14
|
-
MINOR =
|
14
|
+
MINOR = 4
|
15
15
|
# Patch version.
|
16
16
|
PATCH = 0
|
17
17
|
# Prerelease version.
|
18
|
-
PRERELEASE =
|
18
|
+
PRERELEASE = 'rc'
|
19
19
|
# Build metadata.
|
20
|
-
BUILD =
|
20
|
+
BUILD = 0
|
21
21
|
|
22
22
|
class << self
|
23
23
|
# Generates the gem version string from the Version constants.
|
data/lib/cuprum/collections.rb
CHANGED
@@ -6,10 +6,15 @@ require 'cuprum'
|
|
6
6
|
module Cuprum
|
7
7
|
# A data abstraction layer based on the Cuprum library.
|
8
8
|
module Collections
|
9
|
-
autoload :
|
10
|
-
autoload :
|
11
|
-
autoload :
|
12
|
-
autoload :
|
9
|
+
autoload :Association, 'cuprum/collections/association'
|
10
|
+
autoload :Associations, 'cuprum/collections/associations'
|
11
|
+
autoload :Basic, 'cuprum/collections/basic'
|
12
|
+
autoload :Collection, 'cuprum/collections/collection'
|
13
|
+
autoload :Command, 'cuprum/collections/command'
|
14
|
+
autoload :Errors, 'cuprum/collections/errors'
|
15
|
+
autoload :Relation, 'cuprum/collections/relation'
|
16
|
+
autoload :Repository, 'cuprum/collections/repository'
|
17
|
+
autoload :Resource, 'cuprum/collections/resource'
|
13
18
|
|
14
19
|
# @return [String] the absolute path to the gem directory.
|
15
20
|
def self.gem_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuprum-collections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.rc.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob "Merlin" Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cuprum
|
@@ -51,7 +51,11 @@ files:
|
|
51
51
|
- LICENSE
|
52
52
|
- README.md
|
53
53
|
- lib/cuprum/collections.rb
|
54
|
-
- lib/cuprum/collections/
|
54
|
+
- lib/cuprum/collections/association.rb
|
55
|
+
- lib/cuprum/collections/associations.rb
|
56
|
+
- lib/cuprum/collections/associations/belongs_to.rb
|
57
|
+
- lib/cuprum/collections/associations/has_many.rb
|
58
|
+
- lib/cuprum/collections/associations/has_one.rb
|
55
59
|
- lib/cuprum/collections/basic.rb
|
56
60
|
- lib/cuprum/collections/basic/collection.rb
|
57
61
|
- lib/cuprum/collections/basic/command.rb
|
@@ -69,12 +73,15 @@ files:
|
|
69
73
|
- lib/cuprum/collections/basic/query_builder.rb
|
70
74
|
- lib/cuprum/collections/basic/repository.rb
|
71
75
|
- lib/cuprum/collections/basic/rspec.rb
|
72
|
-
- lib/cuprum/collections/
|
76
|
+
- lib/cuprum/collections/collection.rb
|
73
77
|
- lib/cuprum/collections/command.rb
|
74
78
|
- lib/cuprum/collections/commands.rb
|
75
79
|
- lib/cuprum/collections/commands/abstract_find_many.rb
|
76
80
|
- lib/cuprum/collections/commands/abstract_find_matching.rb
|
77
81
|
- lib/cuprum/collections/commands/abstract_find_one.rb
|
82
|
+
- lib/cuprum/collections/commands/associations.rb
|
83
|
+
- lib/cuprum/collections/commands/associations/find_many.rb
|
84
|
+
- lib/cuprum/collections/commands/associations/require_many.rb
|
78
85
|
- lib/cuprum/collections/commands/create.rb
|
79
86
|
- lib/cuprum/collections/commands/find_one_matching.rb
|
80
87
|
- lib/cuprum/collections/commands/update.rb
|
@@ -106,23 +113,20 @@ files:
|
|
106
113
|
- lib/cuprum/collections/queries/parse_strategy.rb
|
107
114
|
- lib/cuprum/collections/query.rb
|
108
115
|
- lib/cuprum/collections/query_builder.rb
|
116
|
+
- lib/cuprum/collections/relation.rb
|
109
117
|
- lib/cuprum/collections/repository.rb
|
118
|
+
- lib/cuprum/collections/resource.rb
|
110
119
|
- lib/cuprum/collections/rspec.rb
|
111
|
-
- lib/cuprum/collections/rspec/
|
112
|
-
- lib/cuprum/collections/rspec/
|
113
|
-
- lib/cuprum/collections/rspec/
|
114
|
-
- lib/cuprum/collections/rspec/
|
115
|
-
- lib/cuprum/collections/rspec/
|
116
|
-
- lib/cuprum/collections/rspec/
|
117
|
-
- lib/cuprum/collections/rspec/
|
120
|
+
- lib/cuprum/collections/rspec/contracts.rb
|
121
|
+
- lib/cuprum/collections/rspec/contracts/association_contracts.rb
|
122
|
+
- lib/cuprum/collections/rspec/contracts/basic.rb
|
123
|
+
- lib/cuprum/collections/rspec/contracts/basic/command_contracts.rb
|
124
|
+
- lib/cuprum/collections/rspec/contracts/collection_contracts.rb
|
125
|
+
- lib/cuprum/collections/rspec/contracts/command_contracts.rb
|
126
|
+
- lib/cuprum/collections/rspec/contracts/query_contracts.rb
|
127
|
+
- lib/cuprum/collections/rspec/contracts/relation_contracts.rb
|
128
|
+
- lib/cuprum/collections/rspec/contracts/repository_contracts.rb
|
118
129
|
- lib/cuprum/collections/rspec/fixtures.rb
|
119
|
-
- lib/cuprum/collections/rspec/insert_one_command_contract.rb
|
120
|
-
- lib/cuprum/collections/rspec/query_builder_contract.rb
|
121
|
-
- lib/cuprum/collections/rspec/query_contract.rb
|
122
|
-
- lib/cuprum/collections/rspec/querying_contract.rb
|
123
|
-
- lib/cuprum/collections/rspec/repository_contract.rb
|
124
|
-
- lib/cuprum/collections/rspec/update_one_command_contract.rb
|
125
|
-
- lib/cuprum/collections/rspec/validate_one_command_contract.rb
|
126
130
|
- lib/cuprum/collections/version.rb
|
127
131
|
homepage: http://sleepingkingstudios.com
|
128
132
|
licenses:
|
@@ -142,11 +146,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
146
|
version: 2.7.0
|
143
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
148
|
requirements:
|
145
|
-
- - "
|
149
|
+
- - ">"
|
146
150
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
151
|
+
version: 1.3.1
|
148
152
|
requirements: []
|
149
|
-
rubygems_version: 3.4.
|
153
|
+
rubygems_version: 3.4.21
|
150
154
|
signing_key:
|
151
155
|
specification_version: 4
|
152
156
|
summary: A data abstraction layer based on the Cuprum library.
|