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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 269f25b8dc7f6a80bd90455bc6370e527d0226a1
4
- data.tar.gz: c4b61c021bdef84f3f3de9025b1dd73e94e32d3c
3
+ metadata.gz: d57ced9a95ec63c4c94964e4c2a6bc2fbfefa877
4
+ data.tar.gz: 16b8106ef4c4072ef9884d341c0ac18e14e145a5
5
5
  SHA512:
6
- metadata.gz: 86e6430e2f474ba5f9e94bc82482daee62b87096d8c8a9b1aeae6ce4456589cbcf6691f95816cb8ebf275c012c9489ad3f213805f8647e9df5644ee5b14f5444
7
- data.tar.gz: 0ac0ffa90d7f54accf11d57c47d8461b963dd160071dd79151b7c6e9e7529f346609926ba32812a28343e2f26aa971992bdbcf4368ece34a1b5024b9df6774fe
6
+ metadata.gz: 1decbd9264793893e240683b50e1c2f99b7c9b901bc766b3170bd25bd86ccc80f41069bc1335788f61af12a93cfdd6c8c7861c0f1409702be750a82d004c3394
7
+ data.tar.gz: 2106d11f6a02eff602265ee734d9fb5b9614155248472f914abda60e447b066729980de213b8e7c39f0f101093f287392d8ba760396dc7d727cf8177ebe6f230
@@ -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://rubydoc.info/gems/rom-repository)
14
+ * [API documentation](http://api.rom-rb.org/rom/)
15
15
 
16
16
  ## License
17
17
 
@@ -1,6 +1,9 @@
1
- require 'dry/core/deprecations'
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
- klass = Class.new(self < Repository::Root ? self : Repository::Root)
23
- klass.root(name)
24
- klass
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, plugin: :my_command_plugin
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
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  class Repository
3
- VERSION = '2.0.1'.freeze
3
+ VERSION = '2.0.2'.freeze
4
4
  end
5
5
  end
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.1
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-02 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer