ddplugin 0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +37 -23
- data/README.md +2 -1
- data/Rakefile +7 -3
- data/ddplugin.gemspec +3 -6
- data/lib/ddplugin/plugin.rb +3 -9
- data/lib/ddplugin/registry.rb +3 -9
- data/lib/ddplugin/version.rb +1 -5
- data/lib/ddplugin.rb +0 -2
- data/test/helper.rb +0 -2
- data/test/test_plugin.rb +4 -8
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cb5ed133200502a15fec93f8b2058ed7a01008b
|
4
|
+
data.tar.gz: d24a3bb4dd0d7ebfda7b34ab5b41afc40d4afe28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c21e116c84b17e3d7f90e9b9f3115f19700da029f6d0a56236ab003f4c49e733488ca61f0a7039a1b8cb1176bbe5997e1b56ed2eae016528c75d87c4e793f1d9
|
7
|
+
data.tar.gz: 18fe5cd2da62d2cfa01f28d3e1531356f077e5495abc20f2c9f8356752c48a06ffafa068330f10c6b2b6b862fef4753b31671a8f72b38bfd8043163ed7514cbe
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,40 +1,54 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ddplugin (0.
|
4
|
+
ddplugin (1.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
simplecov (
|
13
|
-
term-ansicolor
|
14
|
-
thor
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
ast (2.3.0)
|
10
|
+
coveralls (0.8.16)
|
11
|
+
json (>= 1.8, < 3)
|
12
|
+
simplecov (~> 0.12.0)
|
13
|
+
term-ansicolor (~> 1.3.0)
|
14
|
+
thor (~> 0.19.1)
|
15
|
+
tins (>= 1.6.0, < 2)
|
16
|
+
docile (1.1.5)
|
17
|
+
json (2.0.2)
|
18
|
+
minitest (5.9.1)
|
19
|
+
parser (2.3.2.0)
|
20
|
+
ast (~> 2.2)
|
21
|
+
powerpack (0.1.1)
|
22
|
+
rainbow (2.1.0)
|
23
|
+
rake (11.3.0)
|
24
|
+
rubocop (0.45.0)
|
25
|
+
parser (>= 2.3.1.1, < 3.0)
|
26
|
+
powerpack (~> 0.1)
|
27
|
+
rainbow (>= 1.99.1, < 3.0)
|
28
|
+
ruby-progressbar (~> 1.7)
|
29
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
30
|
+
ruby-progressbar (1.8.1)
|
31
|
+
simplecov (0.12.0)
|
23
32
|
docile (~> 1.1.0)
|
24
|
-
|
25
|
-
simplecov-html (~> 0.
|
26
|
-
simplecov-html (0.
|
27
|
-
term-ansicolor (1.
|
28
|
-
tins (~> 0
|
29
|
-
thor (0.
|
30
|
-
tins (
|
33
|
+
json (>= 1.8, < 3)
|
34
|
+
simplecov-html (~> 0.10.0)
|
35
|
+
simplecov-html (0.10.0)
|
36
|
+
term-ansicolor (1.3.2)
|
37
|
+
tins (~> 1.0)
|
38
|
+
thor (0.19.3)
|
39
|
+
tins (1.13.0)
|
40
|
+
unicode-display_width (1.1.1)
|
31
41
|
|
32
42
|
PLATFORMS
|
33
43
|
ruby
|
34
44
|
|
35
45
|
DEPENDENCIES
|
36
|
-
bundler
|
46
|
+
bundler (~> 1.13)
|
37
47
|
coveralls
|
38
48
|
ddplugin!
|
39
49
|
minitest
|
40
50
|
rake
|
51
|
+
rubocop
|
52
|
+
|
53
|
+
BUNDLED WITH
|
54
|
+
1.13.6
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
[](https://travis-ci.org/ddfreyne/ddplugin)
|
2
2
|
[](https://codeclimate.com/github/ddfreyne/ddplugin)
|
3
3
|
[](https://coveralls.io/r/ddfreyne/ddplugin)
|
4
|
+
[](http://inch-ci.org/github/ddfreyne/ddplugin)
|
4
5
|
|
5
6
|
# ddplugin
|
6
7
|
|
@@ -41,7 +42,7 @@ A typical way to use plugins would be to store the plugin names in a configurati
|
|
41
42
|
If your library where you want to use *ddplugin* has a gemspec, add *ddplugin* as a runtime dependency to the gemspec:
|
42
43
|
|
43
44
|
```ruby
|
44
|
-
spec.add_runtime_dependency 'ddplugin' '~> 1.0'
|
45
|
+
spec.add_runtime_dependency 'ddplugin', '~> 1.0'
|
45
46
|
```
|
46
47
|
|
47
48
|
If you use Bundler instead, add it to the `Gemfile`:
|
data/Rakefile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'rake/testtask'
|
2
|
+
require 'rubocop/rake_task'
|
4
3
|
|
5
4
|
Rake::TestTask.new do |t|
|
6
5
|
t.libs = %w( lib test )
|
7
6
|
t.test_files = FileList['test/**/test_*.rb', 'test/**/*_spec.rb']
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
RuboCop::RakeTask.new do |task|
|
10
|
+
task.options = %w(--display-cop-names --format simple)
|
11
|
+
task.patterns = ['lib/**/*.rb', 'test/**/*.rb']
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => [:test, :rubocop]
|
data/ddplugin.gemspec
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
|
4
|
-
require 'ddplugin/version'
|
1
|
+
require_relative 'lib/ddplugin/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |s|
|
7
4
|
s.name = 'ddplugin'
|
@@ -14,7 +11,7 @@ Gem::Specification.new do |s|
|
|
14
11
|
s.email = 'denis.defreyne@stoneship.org'
|
15
12
|
s.license = 'MIT'
|
16
13
|
|
17
|
-
s.required_ruby_version = '>= 1.
|
14
|
+
s.required_ruby_version = '>= 2.1.0'
|
18
15
|
|
19
16
|
s.files = Dir['[A-Z]*'] +
|
20
17
|
Dir['{lib,test}/**/*'] +
|
@@ -24,5 +21,5 @@ Gem::Specification.new do |s|
|
|
24
21
|
s.rdoc_options = [ '--main', 'README.md' ]
|
25
22
|
s.extra_rdoc_files = [ 'LICENSE', 'README.md', 'NEWS.md' ]
|
26
23
|
|
27
|
-
s.add_development_dependency('bundler')
|
24
|
+
s.add_development_dependency('bundler', '~> 1.13')
|
28
25
|
end
|
data/lib/ddplugin/plugin.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module DDPlugin
|
4
|
-
|
5
2
|
# A module that contains class methods for plugins. It provides functions
|
6
3
|
# for setting identifiers and finding plugins. Plugin classes should extend
|
7
4
|
# this module.
|
8
5
|
module Plugin
|
9
|
-
|
10
6
|
# @overload identifiers(*identifiers)
|
11
7
|
#
|
12
8
|
# Sets the identifiers for this class.
|
@@ -45,11 +41,11 @@ module DDPlugin
|
|
45
41
|
# @overload identifier
|
46
42
|
#
|
47
43
|
# @return [Symbol] The first identifier for this class
|
48
|
-
def identifier(identifier=nil)
|
44
|
+
def identifier(identifier = nil)
|
49
45
|
if identifier
|
50
|
-
|
46
|
+
identifiers(identifier)
|
51
47
|
else
|
52
|
-
|
48
|
+
identifiers.first
|
53
49
|
end
|
54
50
|
end
|
55
51
|
|
@@ -64,7 +60,5 @@ module DDPlugin
|
|
64
60
|
def named(identifier)
|
65
61
|
DDPlugin::Registry.instance.find(self, identifier)
|
66
62
|
end
|
67
|
-
|
68
63
|
end
|
69
|
-
|
70
64
|
end
|
data/lib/ddplugin/registry.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module DDPlugin
|
4
|
-
|
5
2
|
# The registry is responsible for keeping track of all loaded plugins.
|
6
3
|
class Registry
|
7
|
-
|
8
4
|
# Returns the shared {DDPlugin::Registry} instance, creating it if none
|
9
5
|
# exists yet.
|
10
6
|
#
|
11
7
|
# @return [DDPlugin::Registry] The shared plugin registry
|
12
8
|
def self.instance
|
13
|
-
@instance ||=
|
9
|
+
@instance ||= new
|
14
10
|
end
|
15
11
|
|
16
12
|
# @api private
|
17
13
|
def initialize
|
18
|
-
@identifiers_to_classes = Hash.new { |h,k| h[k] = {}.dup }
|
19
|
-
@classes_to_identifiers = Hash.new { |h,k| h[k] = {}.dup }
|
14
|
+
@identifiers_to_classes = Hash.new { |h, k| h[k] = {}.dup }
|
15
|
+
@classes_to_identifiers = Hash.new { |h, k| h[k] = {}.dup }
|
20
16
|
end
|
21
17
|
|
22
18
|
# Registers the given class as a plugin.
|
@@ -70,7 +66,5 @@ module DDPlugin
|
|
70
66
|
@identifiers_to_classes[root_class] ||= {}
|
71
67
|
@identifiers_to_classes[root_class].values
|
72
68
|
end
|
73
|
-
|
74
69
|
end
|
75
|
-
|
76
70
|
end
|
data/lib/ddplugin/version.rb
CHANGED
data/lib/ddplugin.rb
CHANGED
data/test/helper.rb
CHANGED
data/test/test_plugin.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'helper'
|
4
2
|
|
5
3
|
class DDPlugin::PluginTest < Minitest::Test
|
6
|
-
|
7
4
|
class IdentifierSample
|
8
5
|
extend DDPlugin::Plugin
|
9
6
|
end
|
@@ -36,10 +33,10 @@ class DDPlugin::PluginTest < Minitest::Test
|
|
36
33
|
assert_empty klass.identifiers
|
37
34
|
|
38
35
|
klass.identifiers :foo1, :foo2
|
39
|
-
assert_equal [
|
36
|
+
assert_equal [:foo1, :foo2], klass.identifiers
|
40
37
|
|
41
38
|
klass.identifiers :bar1, :bar2
|
42
|
-
assert_equal [
|
39
|
+
assert_equal [:foo1, :foo2, :bar1, :bar2], klass.identifiers
|
43
40
|
end
|
44
41
|
|
45
42
|
def test_root
|
@@ -53,7 +50,7 @@ class DDPlugin::PluginTest < Minitest::Test
|
|
53
50
|
assert_equal subklass, InheritanceSample.named(:sub)
|
54
51
|
|
55
52
|
assert_equal :sub, subklass.identifier
|
56
|
-
assert_equal [
|
53
|
+
assert_equal [:sub, :also_sub], subklass.identifiers
|
57
54
|
|
58
55
|
assert_equal InheritanceSample, superklass.root_class
|
59
56
|
assert_equal InheritanceSample, subklass.root_class
|
@@ -74,7 +71,6 @@ class DDPlugin::PluginTest < Minitest::Test
|
|
74
71
|
klass2 = Class.new(AllSample)
|
75
72
|
klass2.identifier :two
|
76
73
|
|
77
|
-
assert_equal [
|
74
|
+
assert_equal [klass1, klass2], AllSample.all
|
78
75
|
end
|
79
|
-
|
80
76
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddplugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
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: 2016-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.13'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.13'
|
27
27
|
description: Provides plugin management for Ruby projects
|
28
28
|
email: denis.defreyne@stoneship.org
|
29
29
|
executables: []
|
@@ -37,15 +37,15 @@ files:
|
|
37
37
|
- Gemfile.lock
|
38
38
|
- LICENSE
|
39
39
|
- NEWS.md
|
40
|
-
- Rakefile
|
41
40
|
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- ddplugin.gemspec
|
43
|
+
- lib/ddplugin.rb
|
42
44
|
- lib/ddplugin/plugin.rb
|
43
45
|
- lib/ddplugin/registry.rb
|
44
46
|
- lib/ddplugin/version.rb
|
45
|
-
- lib/ddplugin.rb
|
46
47
|
- test/helper.rb
|
47
48
|
- test/test_plugin.rb
|
48
|
-
- ddplugin.gemspec
|
49
49
|
homepage: http://github.com/ddfreyne/ddplugin/
|
50
50
|
licenses:
|
51
51
|
- MIT
|
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 1.
|
63
|
+
version: 2.1.0
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
@@ -68,9 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.6.8
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Plugins for Ruby apps
|
75
75
|
test_files: []
|
76
|
-
has_rdoc:
|