pluginator 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/README.md +15 -7
- data/demo/plugins/{pluginator → something}/math/decrease.rb +1 -1
- data/demo/plugins/{pluginator → something}/math/increase.rb +1 -1
- data/demo/plugins/something/stats/max.rb +10 -0
- data/lib/pluginator/autodetect.rb +16 -7
- data/lib/pluginator/errors.rb +18 -0
- data/lib/pluginator/extendable_autodetect.rb +37 -0
- data/lib/pluginator/group.rb +2 -2
- data/lib/pluginator/version.rb +1 -1
- data/lib/pluginator.rb +7 -1
- data/lib/plugins/pluginator/extensions/conversions.rb +10 -0
- data/lib/plugins/pluginator/extensions/first_ask.rb +23 -0
- data/lib/plugins/pluginator/extensions/matching.rb +24 -0
- data/lib/plugins/pluginator/extensions/plugins_map.rb +9 -0
- data/test/autodetect_test.rb +28 -21
- data/test/extendable_autodetect_test.rb +24 -0
- data/test/plugins/extensions/conversions_test.rb +15 -0
- data/test/plugins/extensions/first_ask_test.rb +39 -0
- data/test/plugins/extensions/matching_test.rb +36 -0
- data/test/plugins/extensions/plugins_map_test.rb +16 -0
- metadata +22 -5
- data/demo/plugins/pluginator/stats/max.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0db9991966679d973e056d3fc78fdc31f6ee06ba
|
4
|
+
data.tar.gz: 8e7f9c12a90c8799dc1b8cb901ccda0a3794bddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c4125ef8eb09e0b54d4c01be7c836310ed687874ab9c6cf09d20df00e972975b6a8581a836bcc5adcef4d6dce973da82e2602cd91039379a567164ec55a1bc
|
7
|
+
data.tar.gz: d782e278f8563218cabacab95c09c259b98dec719dc532ecb3edc8656b5e54ded69a4457ba7f5b572ccd8b5128e5828c616645566c8f91b2dd05841035c84c8d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/rvm/pluginator.png)](https://gemnasium.com/rvm/pluginator)
|
6
6
|
|
7
7
|
Gem plugin system management, detects plugins using `Gem.find_file`.
|
8
|
-
Is only supposed with ruby
|
8
|
+
Is only supposed with ruby 2.0.0+ (requires keyword arguments)
|
9
9
|
|
10
10
|
Pluginator tries to stay out of your way, you do not have to include or inherit anything.
|
11
11
|
Pluginator only finds and groups plugins, rest is up to you,
|
@@ -30,7 +30,7 @@ where `<type>` can be nested
|
|
30
30
|
## Loading plugins
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
rvm2plugins = Pluginator
|
33
|
+
rvm2plugins = Pluginator.find("<group>")
|
34
34
|
type_plugins = rvm2plugins["<type>"]
|
35
35
|
types = rvm2plugins.types
|
36
36
|
```
|
@@ -38,9 +38,9 @@ types = rvm2plugins.types
|
|
38
38
|
## Loading plugins of single type
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
rvm2plugins = Pluginator
|
41
|
+
rvm2plugins = Pluginator.find("<group>", "<type>")
|
42
42
|
type_plugins = rvm2plugins["<type>"]
|
43
|
-
types
|
43
|
+
rvm2plugins.types => ["<type>"]
|
44
44
|
```
|
45
45
|
|
46
46
|
## Examples
|
@@ -67,13 +67,22 @@ Now the plugin can be used:
|
|
67
67
|
```ruby
|
68
68
|
require 'pluginator'
|
69
69
|
|
70
|
-
rvm2plugins = Pluginator
|
70
|
+
rvm2plugins = Pluginator.find("rvm2")
|
71
71
|
plugin = rvm2plugins["cli"].first{ |plugin|
|
72
72
|
plugin.question?('echo')
|
73
73
|
}
|
74
74
|
plugin.new.answer("Hello world")
|
75
75
|
```
|
76
76
|
|
77
|
+
Or using extensions:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
require 'pluginator'
|
81
|
+
|
82
|
+
plugin = Pluginator.find("rvm2", extends: %i{first_ask}).first_ask("cli", &:question?, 'echo')
|
83
|
+
plugin.new.answer("Hello world")
|
84
|
+
```
|
85
|
+
|
77
86
|
### Example 2 - hook plugins
|
78
87
|
|
79
88
|
`plugins/rvm2/hooks/after_install/show.rb`:
|
@@ -91,8 +100,7 @@ and using hooks:
|
|
91
100
|
```ruby
|
92
101
|
require 'pluginator'
|
93
102
|
|
94
|
-
|
95
|
-
plugin = rvm2plugins["hooks/after_install"].each{ |plugin|
|
103
|
+
Pluginator.find("rvm2", type: "hooks/after_install").type.each{ |plugin|
|
96
104
|
plugin.execute(name, path)
|
97
105
|
}
|
98
106
|
```
|
@@ -1,19 +1,32 @@
|
|
1
|
+
require_relative "errors"
|
1
2
|
require_relative "group"
|
2
3
|
require_relative "name_converter"
|
3
4
|
|
4
5
|
module Pluginator
|
5
6
|
class Autodetect < Group
|
6
7
|
|
7
|
-
def initialize(group, type
|
8
|
+
def initialize(group, type: nil)
|
8
9
|
super(group)
|
9
|
-
|
10
|
-
|
10
|
+
setup_autodetect(type)
|
11
|
+
end
|
12
|
+
|
13
|
+
def type
|
14
|
+
@plugins[@force_type]
|
11
15
|
end
|
12
16
|
|
13
17
|
private
|
14
18
|
|
15
19
|
include NameConverter
|
16
20
|
|
21
|
+
def setup_autodetect(type)
|
22
|
+
@force_type = type
|
23
|
+
load_files(find_files)
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_files
|
27
|
+
Gem.find_files(file_name_pattern(@group, @force_type))
|
28
|
+
end
|
29
|
+
|
17
30
|
def load_files(file_names)
|
18
31
|
file_names.each do |file_name|
|
19
32
|
path, name, type = split_file_name(file_name, @group)
|
@@ -22,10 +35,6 @@ module Pluginator
|
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
25
|
-
def find_files
|
26
|
-
Gem.find_files(file_name_pattern(@group, @force_type))
|
27
|
-
end
|
28
|
-
|
29
38
|
def load_plugin(path)
|
30
39
|
gemspec = Gem::Specification.find_by_path(path)
|
31
40
|
gemspec.activate if gemspec && !gemspec.activated?
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Pluginator
|
2
|
+
class PluginatorError < RuntimeError
|
3
|
+
end
|
4
|
+
|
5
|
+
class MissingPlugin < PluginatorError
|
6
|
+
def initialize(type, name, list)
|
7
|
+
list = list.map{|e| "'#{e}'" }.join(", ")
|
8
|
+
super("Can not find plugin '#{name}' in #{list} for type '#{type}'.")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class MissingType < PluginatorError
|
13
|
+
def initialize(type, list)
|
14
|
+
list = list.map{|e| "'#{e}'" }.join(", ")
|
15
|
+
super("Can not find type '#{type}' in #{list}.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "autodetect"
|
2
|
+
|
3
|
+
module Pluginator
|
4
|
+
class ExtendableAutodetect < Autodetect
|
5
|
+
|
6
|
+
def initialize(group, type: nil, extends: [])
|
7
|
+
super(group, type: type)
|
8
|
+
extend_plugins(extends)
|
9
|
+
end
|
10
|
+
|
11
|
+
def extend_plugins(extends)
|
12
|
+
extensions_matching(extends).each do |plugin|
|
13
|
+
extend plugin
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def flatten_and_stringify(extends)
|
20
|
+
extends = [extends].flatten.map(&:to_s)
|
21
|
+
extends
|
22
|
+
end
|
23
|
+
|
24
|
+
def pluginator_plugins
|
25
|
+
@pluginator_plugins ||= begin
|
26
|
+
plugins = Pluginator::Autodetect.new("pluginator")
|
27
|
+
plugins.extend(Pluginator::Extensions::Matching)
|
28
|
+
plugins
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def extensions_matching(extends)
|
33
|
+
pluginator_plugins.filter!("extensions", flatten_and_stringify(extends))
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/pluginator/group.rb
CHANGED
@@ -3,7 +3,7 @@ module Pluginator
|
|
3
3
|
attr_reader :group
|
4
4
|
|
5
5
|
def initialize(group)
|
6
|
-
|
6
|
+
setup_group(group)
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](type)
|
@@ -22,7 +22,7 @@ module Pluginator
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def
|
25
|
+
def setup_group(group)
|
26
26
|
@plugins = {}
|
27
27
|
@group = group
|
28
28
|
end
|
data/lib/pluginator/version.rb
CHANGED
data/lib/pluginator.rb
CHANGED
@@ -1,2 +1,8 @@
|
|
1
|
-
require_relative "pluginator/
|
1
|
+
require_relative "pluginator/extendable_autodetect"
|
2
2
|
require_relative "pluginator/version"
|
3
|
+
|
4
|
+
module Pluginator
|
5
|
+
def self.group(group, type: nil, extends: [])
|
6
|
+
Pluginator::ExtendableAutodetect.new(group, type: type, extends: extends)
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "plugins_map"
|
2
|
+
|
3
|
+
module Pluginator::Extensions
|
4
|
+
module FirstAsk
|
5
|
+
include PluginsMap
|
6
|
+
|
7
|
+
def first_ask(type, method_name, *params)
|
8
|
+
@plugins[type] or return nil
|
9
|
+
@plugins[type].detect do |plugin|
|
10
|
+
plugin.public_send(method_name, *params)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def first_ask!(type, method_name, *params)
|
15
|
+
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.types)
|
16
|
+
@plugins[type].detect do |plugin|
|
17
|
+
plugin.public_send(method_name, *params)
|
18
|
+
end or
|
19
|
+
raise Pluginator::MissingPlugin.new(type, "first_ask: #{method_name}", plugins_map(type).keys)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "plugins_map"
|
2
|
+
require_relative "conversions"
|
3
|
+
|
4
|
+
module Pluginator::Extensions
|
5
|
+
module Matching
|
6
|
+
include PluginsMap
|
7
|
+
include Conversions
|
8
|
+
|
9
|
+
def filter(type, list)
|
10
|
+
list.map do |plugin|
|
11
|
+
(plugins_map(type) || {})[string2class(plugin)]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def filter!(type, list)
|
16
|
+
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.types)
|
17
|
+
list.map do |plugin|
|
18
|
+
plugin = string2class(plugin)
|
19
|
+
plugins_map(type)[plugin] or
|
20
|
+
raise Pluginator::MissingPlugin.new(type, plugin, plugins_map(type).keys)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/test/autodetect_test.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'pluginator/autodetect'
|
3
3
|
|
4
|
-
module
|
5
|
-
module
|
4
|
+
module Something
|
5
|
+
module Math; end
|
6
|
+
module Stats; end
|
7
|
+
end
|
6
8
|
|
7
9
|
def demo_file(path)
|
8
10
|
File.expand_path(File.join("..", "..", "demo", path), __FILE__)
|
@@ -14,40 +16,45 @@ end
|
|
14
16
|
|
15
17
|
describe Pluginator::Autodetect do
|
16
18
|
before do
|
17
|
-
@math_files = demo_files("plugins/
|
18
|
-
@all_files = demo_files("plugins/
|
19
|
+
@math_files = demo_files("plugins/something/math/increase.rb", "plugins/something/math/decrease.rb")
|
20
|
+
@all_files = demo_files("plugins/something/math/increase.rb", "plugins/something/math/decrease.rb", "plugins/something/stats/max.rb")
|
19
21
|
end
|
20
22
|
|
21
23
|
describe "separate" do
|
22
24
|
before do
|
23
25
|
@pluginator = Pluginator::Autodetect.allocate
|
24
|
-
@pluginator.send(:
|
26
|
+
@pluginator.send(:setup_group, "something")
|
25
27
|
end
|
26
28
|
|
27
29
|
it "has name" do
|
28
|
-
@pluginator.group.must_equal("
|
30
|
+
@pluginator.group.must_equal("something")
|
29
31
|
end
|
30
32
|
|
31
33
|
it "has demo file" do
|
32
|
-
File.exists?(demo_file("plugins/
|
34
|
+
File.exists?(demo_file("plugins/something/math/increase.rb")).must_equal(true)
|
33
35
|
end
|
34
36
|
|
35
37
|
it "loads plugin" do
|
36
|
-
@pluginator.send(:load_plugin, "plugins/
|
38
|
+
@pluginator.send(:load_plugin, "plugins/something/math/increase.rb")
|
37
39
|
end
|
38
40
|
|
39
41
|
it "finds files existing group" do
|
40
42
|
@pluginator.send(:find_files).sort.must_equal(@all_files.sort)
|
41
43
|
end
|
42
44
|
|
45
|
+
it "finds files group and missing type" do
|
46
|
+
@pluginator.instance_variable_set(:@force_type, "none")
|
47
|
+
@pluginator.send(:find_files).must_equal([])
|
48
|
+
end
|
49
|
+
|
43
50
|
it "finds files group and existing type" do
|
44
51
|
@pluginator.instance_variable_set(:@force_type, "math")
|
45
52
|
@pluginator.send(:find_files).sort.must_equal(@math_files.sort)
|
46
53
|
end
|
47
54
|
|
48
|
-
it "finds files group and
|
49
|
-
@pluginator.instance_variable_set(:@force_type, "
|
50
|
-
@pluginator.
|
55
|
+
it "finds files group and existing type" do
|
56
|
+
@pluginator.instance_variable_set(:@force_type, "math")
|
57
|
+
@pluginator.type.must_equal( @pluginator["math"] )
|
51
58
|
end
|
52
59
|
|
53
60
|
it "loads files" do
|
@@ -55,38 +62,38 @@ describe Pluginator::Autodetect do
|
|
55
62
|
@pluginator.types.must_include('math')
|
56
63
|
plugins = @pluginator["math"].map(&:to_s)
|
57
64
|
plugins.size.must_equal(2)
|
58
|
-
plugins.must_include("
|
59
|
-
plugins.must_include("
|
60
|
-
plugins.wont_include("
|
65
|
+
plugins.must_include("Something::Math::Increase")
|
66
|
+
plugins.must_include("Something::Math::Decrease")
|
67
|
+
plugins.wont_include("Something::Math::Substract")
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
64
71
|
it "loads plugins automatically for group" do
|
65
|
-
pluginator = Pluginator::Autodetect.new("
|
72
|
+
pluginator = Pluginator::Autodetect.new("something")
|
66
73
|
pluginator.types.must_include('stats')
|
67
74
|
pluginator.types.must_include('math')
|
68
75
|
pluginator.types.size.must_equal(2)
|
69
76
|
plugins = pluginator["math"].map(&:to_s)
|
70
77
|
plugins.size.must_equal(2)
|
71
|
-
plugins.must_include("
|
72
|
-
plugins.must_include("
|
73
|
-
plugins.wont_include("
|
78
|
+
plugins.must_include("Something::Math::Increase")
|
79
|
+
plugins.must_include("Something::Math::Decrease")
|
80
|
+
plugins.wont_include("Something::Math::Add")
|
74
81
|
end
|
75
82
|
|
76
83
|
it "loads plugins automatically for group/type" do
|
77
|
-
pluginator = Pluginator::Autodetect.new("
|
84
|
+
pluginator = Pluginator::Autodetect.new("something", type: "stats")
|
78
85
|
pluginator.types.must_include('stats')
|
79
86
|
pluginator.types.size.must_equal(1)
|
80
87
|
end
|
81
88
|
|
82
89
|
it "makes group plugins work" do
|
83
|
-
pluginator = Pluginator::Autodetect.new("
|
90
|
+
pluginator = Pluginator::Autodetect.new("something")
|
84
91
|
pluginator["math"].detect{|plugin| plugin.type == "increase" }.action(2).must_equal(3)
|
85
92
|
pluginator["math"].detect{|plugin| plugin.type == "decrease" }.action(5).must_equal(4)
|
86
93
|
end
|
87
94
|
|
88
95
|
it "hides methods" do
|
89
|
-
pluginator = Pluginator::Autodetect.new("
|
96
|
+
pluginator = Pluginator::Autodetect.new("something")
|
90
97
|
pluginator.public_methods.must_include(:register_plugin)
|
91
98
|
pluginator.public_methods.wont_include(:load_plugins)
|
92
99
|
pluginator.public_methods.wont_include(:split_file_name)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'pluginator/extendable_autodetect'
|
3
|
+
|
4
|
+
describe Pluginator::ExtendableAutodetect do
|
5
|
+
it "loads existing extensions - array" do
|
6
|
+
pluginator = Pluginator::ExtendableAutodetect.new("something", extends: %i{conversions})
|
7
|
+
pluginator.public_methods.must_include(:class2string)
|
8
|
+
pluginator.public_methods.must_include(:string2class)
|
9
|
+
pluginator.public_methods.wont_include(:plugins_map)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "loads existing extensions - symbol" do
|
13
|
+
pluginator = Pluginator::ExtendableAutodetect.new("something", extends: :conversions)
|
14
|
+
pluginator.public_methods.must_include(:class2string)
|
15
|
+
pluginator.public_methods.must_include(:string2class)
|
16
|
+
pluginator.public_methods.wont_include(:plugins_map)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "fails to load missing extension" do
|
20
|
+
lambda {
|
21
|
+
Pluginator::ExtendableAutodetect.new("something", extends: %i{missing_conversions})
|
22
|
+
}.must_raise(Pluginator::MissingPlugin)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'plugins/pluginator/extensions/conversions'
|
3
|
+
|
4
|
+
class ConversionsTester
|
5
|
+
extend Pluginator::Extensions::Conversions
|
6
|
+
end
|
7
|
+
|
8
|
+
describe Pluginator::Extensions::Conversions do
|
9
|
+
it "class2string" do
|
10
|
+
ConversionsTester.class2string('SomethingLong').must_match('something_long')
|
11
|
+
end
|
12
|
+
it "string2class" do
|
13
|
+
ConversionsTester.string2class('something_long').must_match('SomethingLong')
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'plugins/pluginator/extensions/first_ask'
|
3
|
+
require 'plugins/something/stats/max'
|
4
|
+
|
5
|
+
module Something
|
6
|
+
module Stats; end
|
7
|
+
end
|
8
|
+
|
9
|
+
class FirstAskTester
|
10
|
+
attr_accessor :plugins
|
11
|
+
include Pluginator::Extensions::FirstAsk
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Pluginator::Extensions::FirstAsk do
|
15
|
+
before do
|
16
|
+
@tester = FirstAskTester.new
|
17
|
+
@tester.plugins = { "stats" => [
|
18
|
+
Something::Stats::Max
|
19
|
+
] }
|
20
|
+
end
|
21
|
+
|
22
|
+
it "finds existing plugin" do
|
23
|
+
@tester.first_ask("stats", "handles?", "max").must_equal( Something::Stats::Max )
|
24
|
+
end
|
25
|
+
|
26
|
+
it "finds existing plugin - no exception" do
|
27
|
+
@tester.first_ask!("stats", "handles?", "max").must_equal( Something::Stats::Max )
|
28
|
+
end
|
29
|
+
|
30
|
+
it "does not find missing plugin - no exception" do
|
31
|
+
@tester.first_ask("stats", "handles?", "min").must_equal( nil )
|
32
|
+
end
|
33
|
+
|
34
|
+
it "finds existing plugin" do
|
35
|
+
lambda {
|
36
|
+
@tester.first_ask!("stats", "handles?", "min")
|
37
|
+
}.must_raise(Pluginator::MissingPlugin)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'plugins/pluginator/extensions/matching'
|
3
|
+
|
4
|
+
class MatchingTester
|
5
|
+
attr_accessor :plugins
|
6
|
+
include Pluginator::Extensions::Matching
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Pluginator::Extensions::Matching do
|
10
|
+
before do
|
11
|
+
@tester = MatchingTester.new
|
12
|
+
@tester.plugins = { "extensions" => [
|
13
|
+
Pluginator::Extensions::PluginsMap,
|
14
|
+
Pluginator::Extensions::Conversions,
|
15
|
+
Pluginator::Extensions::Matching
|
16
|
+
] }
|
17
|
+
end
|
18
|
+
|
19
|
+
it "finds existing plugin" do
|
20
|
+
@tester.filter("extensions", ["plugins_map"]).must_equal( [Pluginator::Extensions::PluginsMap] )
|
21
|
+
end
|
22
|
+
|
23
|
+
it "finds existing plugin - no exception" do
|
24
|
+
@tester.filter!("extensions", ["plugins_map"]).must_equal( [Pluginator::Extensions::PluginsMap] )
|
25
|
+
end
|
26
|
+
|
27
|
+
it "does not find missing plugin - no exception" do
|
28
|
+
@tester.filter("extensions", ["plugins_map2"]).must_equal( [nil] )
|
29
|
+
end
|
30
|
+
|
31
|
+
it "finds existing plugin" do
|
32
|
+
lambda {
|
33
|
+
@tester.filter!("extensions", ["plugins_map2"])
|
34
|
+
}.must_raise(Pluginator::MissingPlugin)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'plugins/pluginator/extensions/plugins_map'
|
3
|
+
|
4
|
+
class PluginsMapTester
|
5
|
+
attr_accessor :plugins
|
6
|
+
include Pluginator::Extensions::PluginsMap
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Pluginator::Extensions::PluginsMap do
|
10
|
+
it "creates map" do
|
11
|
+
tester = PluginsMapTester.new
|
12
|
+
tester.plugins = { "extensions" => [Pluginator::Extensions::PluginsMap] }
|
13
|
+
expected = { "PluginsMap" => Pluginator::Extensions::PluginsMap }
|
14
|
+
tester.plugins_map("extensions").must_equal( expected )
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -50,18 +50,29 @@ files:
|
|
50
50
|
- Gemfile
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
-
- demo/plugins/
|
54
|
-
- demo/plugins/
|
55
|
-
- demo/plugins/
|
53
|
+
- demo/plugins/something/math/decrease.rb
|
54
|
+
- demo/plugins/something/math/increase.rb
|
55
|
+
- demo/plugins/something/stats/max.rb
|
56
56
|
- lib/pluginator.rb
|
57
57
|
- lib/pluginator/autodetect.rb
|
58
|
+
- lib/pluginator/errors.rb
|
59
|
+
- lib/pluginator/extendable_autodetect.rb
|
58
60
|
- lib/pluginator/group.rb
|
59
61
|
- lib/pluginator/name_converter.rb
|
60
62
|
- lib/pluginator/version.rb
|
63
|
+
- lib/plugins/pluginator/extensions/conversions.rb
|
64
|
+
- lib/plugins/pluginator/extensions/first_ask.rb
|
65
|
+
- lib/plugins/pluginator/extensions/matching.rb
|
66
|
+
- lib/plugins/pluginator/extensions/plugins_map.rb
|
61
67
|
- pluginator.gemspec
|
62
68
|
- test/autodetect_test.rb
|
69
|
+
- test/extendable_autodetect_test.rb
|
63
70
|
- test/group_test.rb
|
64
71
|
- test/name_converter_test.rb
|
72
|
+
- test/plugins/extensions/conversions_test.rb
|
73
|
+
- test/plugins/extensions/first_ask_test.rb
|
74
|
+
- test/plugins/extensions/matching_test.rb
|
75
|
+
- test/plugins/extensions/plugins_map_test.rb
|
65
76
|
homepage: https://github.com/rvm/pluginator
|
66
77
|
licenses: []
|
67
78
|
metadata: {}
|
@@ -87,5 +98,11 @@ specification_version: 4
|
|
87
98
|
summary: Rubygems plugin system using Gem.find_files.
|
88
99
|
test_files:
|
89
100
|
- test/autodetect_test.rb
|
101
|
+
- test/extendable_autodetect_test.rb
|
90
102
|
- test/group_test.rb
|
91
103
|
- test/name_converter_test.rb
|
104
|
+
- test/plugins/extensions/conversions_test.rb
|
105
|
+
- test/plugins/extensions/first_ask_test.rb
|
106
|
+
- test/plugins/extensions/matching_test.rb
|
107
|
+
- test/plugins/extensions/plugins_map_test.rb
|
108
|
+
has_rdoc:
|