ddplugin 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/NEWS.md +11 -0
- data/README.md +3 -9
- data/lib/ddplugin/registry.rb +1 -1
- data/lib/ddplugin/version.rb +1 -1
- data/test/test_plugin.rb +13 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d0ae996f2999cccb30bc44777e07a1b0c04f1e
|
4
|
+
data.tar.gz: 8b0bda0c3d2bf442a8e1e8d49313c8b57ff44498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4eb79aa5c0cd23076cf4b32fe37ee40357bf77cf2c6b72929999c1af65f48a44ca29cada37632cebeb53177b694bc9500b9c5dd3c0c9f0bb16a2da4d1334d51
|
7
|
+
data.tar.gz: 39fe5a9c5b28043cc0c218bed98a2125e100660511a86ddf68e95dfe57fce1cc0902413f3fd05e5660b9a09474bfd2503eb7878b269cef04b1311a56bd87dc61
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ddplugin (1.0.
|
4
|
+
ddplugin (1.0.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.3.0)
|
10
|
-
coveralls (0.8.
|
10
|
+
coveralls (0.8.19)
|
11
11
|
json (>= 1.8, < 3)
|
12
12
|
simplecov (~> 0.12.0)
|
13
|
-
term-ansicolor (~> 1.3
|
13
|
+
term-ansicolor (~> 1.3)
|
14
14
|
thor (~> 0.19.1)
|
15
|
-
tins (
|
15
|
+
tins (~> 1.6)
|
16
16
|
docile (1.1.5)
|
17
|
-
json (2.0.
|
18
|
-
minitest (5.
|
19
|
-
parser (2.
|
17
|
+
json (2.0.3)
|
18
|
+
minitest (5.10.1)
|
19
|
+
parser (2.4.0.0)
|
20
20
|
ast (~> 2.2)
|
21
21
|
powerpack (0.1.1)
|
22
|
-
rainbow (2.1
|
23
|
-
rake (
|
24
|
-
rubocop (0.
|
25
|
-
parser (>= 2.3.
|
22
|
+
rainbow (2.2.1)
|
23
|
+
rake (12.0.0)
|
24
|
+
rubocop (0.47.1)
|
25
|
+
parser (>= 2.3.3.1, < 3.0)
|
26
26
|
powerpack (~> 0.1)
|
27
27
|
rainbow (>= 1.99.1, < 3.0)
|
28
28
|
ruby-progressbar (~> 1.7)
|
@@ -33,11 +33,11 @@ GEM
|
|
33
33
|
json (>= 1.8, < 3)
|
34
34
|
simplecov-html (~> 0.10.0)
|
35
35
|
simplecov-html (0.10.0)
|
36
|
-
term-ansicolor (1.
|
36
|
+
term-ansicolor (1.4.0)
|
37
37
|
tins (~> 1.0)
|
38
|
-
thor (0.19.
|
39
|
-
tins (1.13.
|
40
|
-
unicode-display_width (1.1.
|
38
|
+
thor (0.19.4)
|
39
|
+
tins (1.13.2)
|
40
|
+
unicode-display_width (1.1.3)
|
41
41
|
|
42
42
|
PLATFORMS
|
43
43
|
ruby
|
@@ -51,4 +51,4 @@ DEPENDENCIES
|
|
51
51
|
rubocop
|
52
52
|
|
53
53
|
BUNDLED WITH
|
54
|
-
1.
|
54
|
+
1.14.5
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
Designing a library so that third parties can easily extend it greatly improves its usefulness. *ddplugin* helps solve this problem using *plugins*, which are classes of a certain type and with a given identifier (Ruby symbol).
|
11
11
|
|
12
|
-
This code was extracted from
|
12
|
+
This code was extracted from Nanoc, where it has been in production for years.
|
13
13
|
|
14
14
|
## Use case
|
15
15
|
|
@@ -27,9 +27,9 @@ In *ddplugin*, the filters, connectors and data sources would be *plugin types*,
|
|
27
27
|
|
28
28
|
A typical way to use plugins would be to store the plugin names in a configuration file, so that the actual plugin implementations can be discovered at runtime.
|
29
29
|
|
30
|
-
##
|
30
|
+
## Requirements
|
31
31
|
|
32
|
-
*ddplugin* requires Ruby 1
|
32
|
+
*ddplugin* requires Ruby 2.1 or higher.
|
33
33
|
|
34
34
|
## Versioning
|
35
35
|
|
@@ -37,8 +37,6 @@ A typical way to use plugins would be to store the plugin names in a configurati
|
|
37
37
|
|
38
38
|
## Installation
|
39
39
|
|
40
|
-
**NOTE:** *ddplugin* has not been released as a gem yet, so these installation instructions are not usable yet.
|
41
|
-
|
42
40
|
If your library where you want to use *ddplugin* has a gemspec, add *ddplugin* as a runtime dependency to the gemspec:
|
43
41
|
|
44
42
|
```ruby
|
@@ -132,7 +130,3 @@ To run the tests, execute `rake`:
|
|
132
130
|
```
|
133
131
|
% rake
|
134
132
|
```
|
135
|
-
|
136
|
-
## Contact
|
137
|
-
|
138
|
-
*ddplugin* is written by Denis Defreyne <denis.defreyne@stoneship.org>
|
data/lib/ddplugin/registry.rb
CHANGED
@@ -64,7 +64,7 @@ module DDPlugin
|
|
64
64
|
# @return [Enumerable<Class>] A collection of registered classes
|
65
65
|
def find_all(root_class)
|
66
66
|
@identifiers_to_classes[root_class] ||= {}
|
67
|
-
@identifiers_to_classes[root_class].values
|
67
|
+
@identifiers_to_classes[root_class].values.uniq
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
data/lib/ddplugin/version.rb
CHANGED
data/test/test_plugin.rb
CHANGED
@@ -73,4 +73,17 @@ class DDPlugin::PluginTest < Minitest::Test
|
|
73
73
|
|
74
74
|
assert_equal [klass1, klass2], AllSample.all
|
75
75
|
end
|
76
|
+
|
77
|
+
def test_all_with_multiple_identifiers
|
78
|
+
parent_class = Class.new { extend DDPlugin::Plugin }
|
79
|
+
|
80
|
+
klass1 = Class.new(parent_class)
|
81
|
+
klass1.identifier :one_a
|
82
|
+
klass1.identifier :one_b
|
83
|
+
|
84
|
+
klass2 = Class.new(parent_class)
|
85
|
+
klass2.identifier :two
|
86
|
+
|
87
|
+
assert_equal [klass1, klass2], parent_class.all
|
88
|
+
end
|
76
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddplugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.6.
|
71
|
+
rubygems_version: 2.6.10
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Plugins for Ruby apps
|