dry-plugins 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dry/plugins/dsl.rb +5 -0
- data/lib/dry/plugins/registry.rb +5 -1
- data/lib/dry/plugins/version.rb +1 -1
- data/lib/rspec/dry-plugins.rb +8 -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: 87c1ce9cf0a9d4ee9f93bd6b1b42f18a370e0659
|
4
|
+
data.tar.gz: 7606f33ed7c15bd0f5d466f72760ef4d286839a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4c39a6968931fb5d41c74d7428b687988134fff8896368f3385604b274e616e8842134c5536bd4140529559e5c896ac6e250878ad83179fcd301a92ecb08bfd
|
7
|
+
data.tar.gz: eddbe4ae671b400a08918755fe01cc5abafb7e3b5510b566f07c2664273d781015b6c7636561f0076a605a892ae54f52a0705d600a347f3e93eeb8c37136a888
|
data/Gemfile.lock
CHANGED
data/lib/dry/plugins/dsl.rb
CHANGED
data/lib/dry/plugins/registry.rb
CHANGED
@@ -32,7 +32,11 @@ module Dry
|
|
32
32
|
# @param plugin [Module, Plugin]
|
33
33
|
#
|
34
34
|
# @return [Plugin]
|
35
|
-
def register(key, plugin)
|
35
|
+
def register(key, plugin = nil)
|
36
|
+
if key.is_a?(Module)
|
37
|
+
plugin = key
|
38
|
+
key = Inflecto.underscore(Inflecto.demodulize(plugin.name))
|
39
|
+
end
|
36
40
|
key = key.to_s
|
37
41
|
plugin = plugin.plugin if plugin.is_a? Plugin
|
38
42
|
if key?(key) && resolve(key) != plugin
|
data/lib/dry/plugins/version.rb
CHANGED
data/lib/rspec/dry-plugins.rb
CHANGED
@@ -25,7 +25,7 @@ module Dry
|
|
25
25
|
module Plugins
|
26
26
|
# RSpec helpers for plug-ins
|
27
27
|
module RSpec
|
28
|
-
def
|
28
|
+
def an_example_class(name: :Example, parent: nil, &block)
|
29
29
|
class_builder = Dry::Core::ClassBuilder.new(
|
30
30
|
name: name,
|
31
31
|
namespace: ::Object,
|
@@ -35,6 +35,13 @@ module Dry
|
|
35
35
|
host.module_eval(&block) if block_given?
|
36
36
|
host
|
37
37
|
end
|
38
|
+
|
39
|
+
def a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block)
|
40
|
+
an_example_class(name: name, parent: parent) do
|
41
|
+
extend Dry::Plugins
|
42
|
+
instance_exec(&block)
|
43
|
+
end
|
44
|
+
end
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Semyonov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|