pluginator 0.11.0 → 0.11.1
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/.gitignore +3 -2
- data/Rakefile +1 -1
- data/lib/pluginator/errors.rb +6 -4
- data/lib/pluginator/version.rb +1 -1
- data/lib/plugins/pluginator/extensions/first_ask.rb +1 -1
- data/pluginator.gemspec +1 -0
- data/test/autodetect_test.rb +1 -1
- data/test/extendable_autodetect_test.rb +1 -1
- data/test/group_test.rb +1 -1
- data/test/name_converter_test.rb +1 -1
- data/test/plugins/extensions/conversions_test.rb +1 -1
- data/test/plugins/extensions/first_ask_test.rb +11 -2
- data/test/plugins/extensions/matching_test.rb +1 -1
- data/test/plugins/extensions/plugins_map_test.rb +1 -1
- data/test/test_helper.rb +8 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 177ed9844b5c23c064d42ea785fd4aa27a5a3b2a
|
4
|
+
data.tar.gz: 59b7f79ca608cfa3471462d527f9e6c85a8de2ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17326a839cf7457e8d29096404a28f543340e44693a8615fb59b2eeb45676b56d47fbb97b8d3c463c5c97b67a454eb3fa08dcef4fb27edd88545d10480b735a8
|
7
|
+
data.tar.gz: f19ec0686a73d26bf399dc3ccfd0969fbddef6a0156e000573187dc3334bd32e3e250ae325bbe5a547716c4a62bd51c43830dafceaf55d380f78687fd7a14b70
|
data/.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
Gemfile.lock
|
1
|
+
/*.gem
|
2
|
+
/Gemfile.lock
|
3
|
+
/coverage
|
data/Rakefile
CHANGED
data/lib/pluginator/errors.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
module Pluginator
|
2
2
|
class PluginatorError < RuntimeError
|
3
|
+
private
|
4
|
+
def list_to_s(list)
|
5
|
+
list.map{|e| "'#{e}'" }.join(", ")
|
6
|
+
end
|
3
7
|
end
|
4
8
|
|
5
9
|
class MissingPlugin < PluginatorError
|
6
10
|
def initialize(type, name, list)
|
7
|
-
|
8
|
-
super("Can not find plugin '#{name}' in #{list} for type '#{type}'.")
|
11
|
+
super("Can not find plugin '#{name}' in #{list_to_s(list)} for type '#{type}'.")
|
9
12
|
end
|
10
13
|
end
|
11
14
|
|
12
15
|
class MissingType < PluginatorError
|
13
16
|
def initialize(type, list)
|
14
|
-
|
15
|
-
super("Can not find type '#{type}' in #{list}.")
|
17
|
+
super("Can not find type '#{type}' in #{list_to_s(list)}.")
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/lib/pluginator/version.rb
CHANGED
@@ -12,7 +12,7 @@ module Pluginator::Extensions
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def first_ask!(type, method_name, *params)
|
15
|
-
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.
|
15
|
+
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
|
16
16
|
@plugins[type].detect do |plugin|
|
17
17
|
plugin.public_send(method_name, *params)
|
18
18
|
end or
|
data/pluginator.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.required_ruby_version = ">= 1.9.3"
|
13
13
|
s.add_development_dependency("rake")
|
14
14
|
s.add_development_dependency("minitest")
|
15
|
+
s.add_development_dependency("simplecov")
|
15
16
|
# s.add_development_dependency("smf-gem")
|
16
17
|
s.homepage = "https://github.com/rvm/pluginator"
|
17
18
|
s.summary = "Rubygems plugin system using Gem.find_files."
|
data/test/autodetect_test.rb
CHANGED
data/test/group_test.rb
CHANGED
data/test/name_converter_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_helper'
|
2
2
|
require 'plugins/pluginator/extensions/first_ask'
|
3
3
|
require 'plugins/something/stats/max'
|
4
4
|
|
@@ -23,6 +23,10 @@ describe Pluginator::Extensions::FirstAsk do
|
|
23
23
|
@tester.first_ask("stats", "handles?", "max").must_equal( Something::Stats::Max )
|
24
24
|
end
|
25
25
|
|
26
|
+
it "finds proper plugin" do
|
27
|
+
@tester.first_ask("stats", "handles?", "max").action.must_equal( 42 )
|
28
|
+
end
|
29
|
+
|
26
30
|
it "finds existing plugin - no exception" do
|
27
31
|
@tester.first_ask!("stats", "handles?", "max").must_equal( Something::Stats::Max )
|
28
32
|
end
|
@@ -31,9 +35,14 @@ describe Pluginator::Extensions::FirstAsk do
|
|
31
35
|
@tester.first_ask("stats", "handles?", "min").must_equal( nil )
|
32
36
|
end
|
33
37
|
|
34
|
-
it "
|
38
|
+
it "does not find missing plugin - exception plugin" do
|
35
39
|
lambda {
|
36
40
|
@tester.first_ask!("stats", "handles?", "min")
|
37
41
|
}.must_raise(Pluginator::MissingPlugin)
|
38
42
|
end
|
43
|
+
it "does not find missing plugin - exception type" do
|
44
|
+
lambda {
|
45
|
+
@tester.first_ask!("stats2", "handles?", "max")
|
46
|
+
}.must_raise(Pluginator::MissingType)
|
47
|
+
end
|
39
48
|
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description:
|
42
56
|
email:
|
43
57
|
- mpapis@gmail.com
|
@@ -73,6 +87,7 @@ files:
|
|
73
87
|
- test/plugins/extensions/first_ask_test.rb
|
74
88
|
- test/plugins/extensions/matching_test.rb
|
75
89
|
- test/plugins/extensions/plugins_map_test.rb
|
90
|
+
- test/test_helper.rb
|
76
91
|
homepage: https://github.com/rvm/pluginator
|
77
92
|
licenses: []
|
78
93
|
metadata: {}
|
@@ -105,4 +120,5 @@ test_files:
|
|
105
120
|
- test/plugins/extensions/first_ask_test.rb
|
106
121
|
- test/plugins/extensions/matching_test.rb
|
107
122
|
- test/plugins/extensions/plugins_map_test.rb
|
123
|
+
- test/test_helper.rb
|
108
124
|
has_rdoc:
|