rom-repository 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/rom/repository.rb +7 -2
- data/lib/rom/repository/class_interface.rb +12 -7
- data/lib/rom/repository/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d57ced9a95ec63c4c94964e4c2a6bc2fbfefa877
|
4
|
+
data.tar.gz: 16b8106ef4c4072ef9884d341c0ac18e14e145a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1decbd9264793893e240683b50e1c2f99b7c9b901bc766b3170bd25bd86ccc80f41069bc1335788f61af12a93cfdd6c8c7861c0f1409702be750a82d004c3394
|
7
|
+
data.tar.gz: 2106d11f6a02eff602265ee734d9fb5b9614155248472f914abda60e447b066729980de213b8e7c39f0f101093f287392d8ba760396dc7d727cf8177ebe6f230
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# v2.0.2 2017-12-01
|
2
|
+
|
3
|
+
## Added
|
4
|
+
|
5
|
+
* `commands` macro supports passing options for plugins via `plugins_options` (GustavoCaso)
|
6
|
+
|
7
|
+
## Fixed
|
8
|
+
|
9
|
+
* Root repository classes are cached now, which fixes problems with superclass mismatch exceptions (solnic)
|
10
|
+
|
1
11
|
# v2.0.1 2017-11-02
|
2
12
|
|
3
13
|
## Fixed
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Repositories for [rom-rb](https://github.com/rom-rb/rom) with auto-mapping, chan
|
|
11
11
|
Resources:
|
12
12
|
|
13
13
|
* [User documentation](http://rom-rb.org/learn/repositories)
|
14
|
-
* [API documentation](http://
|
14
|
+
* [API documentation](http://api.rom-rb.org/rom/)
|
15
15
|
|
16
16
|
## License
|
17
17
|
|
data/lib/rom/repository.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
require 'dry/core/
|
1
|
+
require 'dry/core/cache'
|
2
|
+
require 'dry/core/class_attributes'
|
2
3
|
|
3
4
|
require 'rom/initializer'
|
5
|
+
require 'rom/struct'
|
6
|
+
require 'rom/container'
|
4
7
|
require 'rom/repository/class_interface'
|
5
8
|
require 'rom/repository/session'
|
6
9
|
|
@@ -48,9 +51,11 @@ module ROM
|
|
48
51
|
#
|
49
52
|
# @api public
|
50
53
|
class Repository
|
54
|
+
extend Dry::Core::Cache
|
55
|
+
extend Dry::Core::ClassAttributes
|
56
|
+
|
51
57
|
extend ClassInterface
|
52
58
|
extend Initializer
|
53
|
-
extend Dry::Core::ClassAttributes
|
54
59
|
|
55
60
|
# @!method self.auto_struct
|
56
61
|
# Get or set auto_struct setting
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'dry/core/cache'
|
2
|
+
|
1
3
|
require 'rom/repository/relation_reader'
|
2
4
|
|
3
5
|
module ROM
|
@@ -19,9 +21,11 @@ module ROM
|
|
19
21
|
#
|
20
22
|
# @api public
|
21
23
|
def [](name)
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
fetch_or_store(name) do
|
25
|
+
klass = Class.new(self < Repository::Root ? self : Repository::Root)
|
26
|
+
klass.root(name)
|
27
|
+
klass
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
# Initialize a new repository object
|
@@ -50,6 +54,7 @@ module ROM
|
|
50
54
|
|
51
55
|
return if self === Repository
|
52
56
|
|
57
|
+
klass.extend(Dry::Core::Cache)
|
53
58
|
klass.commands(*commands)
|
54
59
|
end
|
55
60
|
|
@@ -62,7 +67,7 @@ module ROM
|
|
62
67
|
#
|
63
68
|
# # with custom command plugin
|
64
69
|
# class UserRepo < ROM::Repository[:users]
|
65
|
-
# commands :create,
|
70
|
+
# commands :create, use: :my_command_plugin
|
66
71
|
# end
|
67
72
|
#
|
68
73
|
# # with custom mapper
|
@@ -77,7 +82,7 @@ module ROM
|
|
77
82
|
# @return [Array<Symbol>] A list of defined command names
|
78
83
|
#
|
79
84
|
# @api public
|
80
|
-
def commands(*names, mapper: nil, use: nil, **opts)
|
85
|
+
def commands(*names, mapper: nil, use: nil, plugins_options: EMPTY_HASH, **opts)
|
81
86
|
if names.any? || opts.any?
|
82
87
|
@commands = names + opts.to_a
|
83
88
|
|
@@ -85,9 +90,9 @@ module ROM
|
|
85
90
|
type, *view = Array(spec).flatten
|
86
91
|
|
87
92
|
if view.size > 0
|
88
|
-
define_restricted_command_method(type, view, mapper: mapper, use: use)
|
93
|
+
define_restricted_command_method(type, view, mapper: mapper, use: use, plugins_options: plugins_options)
|
89
94
|
else
|
90
|
-
define_command_method(type, mapper: mapper, use: use)
|
95
|
+
define_command_method(type, mapper: mapper, use: use, plugins_options: plugins_options)
|
91
96
|
end
|
92
97
|
end
|
93
98
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-repository
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-initializer
|