pluginator 1.2.0 → 1.3.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/Guardfile +2 -2
- data/README.md +20 -18
- data/lib/pluginator.rb +5 -4
- data/lib/pluginator/autodetect.rb +28 -24
- data/lib/pluginator/errors.rb +5 -3
- data/lib/pluginator/extendable_autodetect.rb +5 -4
- data/lib/pluginator/group.rb +1 -0
- data/lib/pluginator/version.rb +1 -1
- data/lib/plugins/pluginator/extensions/conversions.rb +7 -1
- data/lib/plugins/pluginator/extensions/first_ask.rb +6 -1
- data/lib/plugins/pluginator/extensions/first_class.rb +7 -3
- data/lib/plugins/pluginator/extensions/matching.rb +6 -2
- data/pluginator.gemspec +1 -1
- data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/fake-gem-name-activated.rb +1 -0
- data/test/gems/gems/fake-gem-name-activated-1.0.0/lib/plugins/activated/version1/max.rb +29 -0
- data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/fake-gem-name-activated.rb +1 -0
- data/test/gems/gems/fake-gem-name-activated-2.0.0/lib/plugins/activated/version1/max.rb +29 -0
- data/test/gems/specifications/fake-gem-name-activated-1.0.0.gemspec +21 -0
- data/test/gems/specifications/fake-gem-name-activated-2.0.0.gemspec +21 -0
- data/test/pluginator/autodetect_test.rb +29 -10
- data/test/pluginator/extendable_autodetect_test.rb +2 -2
- data/test/pluginator/group_test.rb +2 -2
- data/test/pluginator/name_converter_test.rb +2 -2
- data/test/pluginator_test.rb +30 -11
- data/test/plugins_test/extensions/class_exist_test.rb +3 -3
- data/test/plugins_test/extensions/conversions_test.rb +4 -4
- data/test/plugins_test/extensions/first_ask_test.rb +3 -3
- data/test/plugins_test/extensions/first_class_test.rb +3 -3
- data/test/plugins_test/extensions/matching_test.rb +2 -2
- data/test/plugins_test/extensions/plugins_map_test.rb +2 -2
- data/test/test_helper.rb +10 -7
- metadata +14 -4
- data/test/gems/specifications/pluginator-1.1.0.gemspec +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6ff46b640ad85f210acebe6882c7ea4cbdf1c0c
|
|
4
|
+
data.tar.gz: 447d3308d735dd4383a3300294c67ba065d7b986
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40ea8041c8c585023ef5bc68c623765ca25dc4f002f851bd7a4308f78fd9f6e8865f57f0c6d934720009594e5c6bb05bb2fc4f5539c1f274961212e41e13ce66
|
|
7
|
+
data.tar.gz: 83d9f189e3b9ab2beb65d87b6da06198a191bdf6e3e5841260295273c08180aaa1e783a4c241ba69810de86989e687d820bb05cd6868cecb8c0cd3d122c0fff7
|
data/Guardfile
CHANGED
|
@@ -9,9 +9,9 @@ guard :minitest, :include => %w[lib test], :bundler => false do
|
|
|
9
9
|
"test/#{m[1]}#{m[2]}_test.rb"
|
|
10
10
|
}
|
|
11
11
|
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
|
12
|
-
watch(%r{^test/test_helper\.rb$}) {
|
|
12
|
+
watch(%r{^test/test_helper\.rb$}) { "test" }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
guard
|
|
15
|
+
guard "yard" do
|
|
16
16
|
watch(%r{^lib/.+\.rb})
|
|
17
17
|
end
|
data/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://rubygems.org/gems/pluginator)
|
|
4
4
|
[](https://codeclimate.com/github/rvm/pluginator)
|
|
5
|
-
[](https://coveralls.io/r/rvm/pluginator)
|
|
6
|
+
[](https://travis-ci.org/rvm/pluginator)
|
|
7
7
|
[](https://gemnasium.com/rvm/pluginator)
|
|
8
|
-
[](http://inch-ci.org/github/rvm/pluginator)
|
|
9
|
+
[](http://rubydoc.info/github/rvm/pluginator/master/frames)
|
|
10
|
+
[](https://github.com/rvm/pluginator)
|
|
9
11
|
|
|
10
12
|
Gem plugin system management, detects plugins using `Gem.find_file`.
|
|
11
|
-
Is only supposed with ruby 1.9.3+ (some tests fail on 1.9.2)
|
|
13
|
+
Is only supposed to work with ruby 1.9.3+ (some tests fail on 1.9.2)
|
|
12
14
|
|
|
13
15
|
Pluginator tries to stay out of your way, you do not have to include or inherit anything.
|
|
14
16
|
Pluginator only finds and groups plugins, rest is up to you,
|
|
@@ -42,7 +44,7 @@ types = rvm2plugins.types
|
|
|
42
44
|
|
|
43
45
|
```ruby
|
|
44
46
|
Pluginator.find("<group>") => Pluginator object
|
|
45
|
-
plugins = Pluginator.find("<group>", type: "<type>", extends: %i
|
|
47
|
+
plugins = Pluginator.find("<group>", type: "<type>", extends: %i[<extensions>])
|
|
46
48
|
plugins["<type>"] => Array of plugins
|
|
47
49
|
plugins.type => Array of plugins for type defined with `type: "<type>"`
|
|
48
50
|
plugins.types => Array of types
|
|
@@ -50,7 +52,7 @@ plugins.types => Array of types
|
|
|
50
52
|
|
|
51
53
|
- `"<group>"` - Load plugins for given group.
|
|
52
54
|
- `type: "<type>"` - Load plugins only of given type, makes `type` method accessible.
|
|
53
|
-
- `extends: %i
|
|
55
|
+
- `extends: %i[<extensions>]` - Extend pluginator with given extensions.
|
|
54
56
|
|
|
55
57
|
## Extensions
|
|
56
58
|
|
|
@@ -61,8 +63,8 @@ Pluginator comes with few handful extensions.
|
|
|
61
63
|
Check if plugin with given class name exists.
|
|
62
64
|
|
|
63
65
|
```ruby
|
|
64
|
-
plugins = Pluginator.find("<group>", extends: %i
|
|
65
|
-
plugins.class_exist?(
|
|
66
|
+
plugins = Pluginator.find("<group>", extends: %i[class_exist]})
|
|
67
|
+
plugins.class_exist?("<type>", "<name>") => true or false
|
|
66
68
|
```
|
|
67
69
|
|
|
68
70
|
### First ask
|
|
@@ -70,7 +72,7 @@ plugins.class_exist?( "<type>", "<name>") => true or false
|
|
|
70
72
|
Call a method on plugin and return first one that returns `true`.
|
|
71
73
|
|
|
72
74
|
```ruby
|
|
73
|
-
plugins = Pluginator.find("<group>", extends: %i
|
|
75
|
+
plugins = Pluginator.find("<group>", extends: %i[first_ask])
|
|
74
76
|
plugins.first_ask( "<type>", "method_to_call", *params) => plugin or nil
|
|
75
77
|
plugins.first_ask!("<type>", "method_to_call", *params) => plugin or exception PluginatorError
|
|
76
78
|
```
|
|
@@ -80,7 +82,7 @@ plugins.first_ask!("<type>", "method_to_call", *params) => plugin or exception P
|
|
|
80
82
|
Find first plugin that class matches the given name.
|
|
81
83
|
|
|
82
84
|
```ruby
|
|
83
|
-
plugins = Pluginator.find("<group>", extends: %i
|
|
85
|
+
plugins = Pluginator.find("<group>", extends: %i[first_class])
|
|
84
86
|
plugins.first_class( "<type>", "<name>") => plugin or nil
|
|
85
87
|
plugins.first_class!("<type>", "<name>") => plugin or exception PluginatorError
|
|
86
88
|
```
|
|
@@ -90,7 +92,7 @@ plugins.first_class!("<type>", "<name>") => plugin or exception PluginatorError
|
|
|
90
92
|
Map array of names to available plugins.
|
|
91
93
|
|
|
92
94
|
```ruby
|
|
93
|
-
plugins = Pluginator.find("<group>", extends: %i
|
|
95
|
+
plugins = Pluginator.find("<group>", extends: %i[matching])
|
|
94
96
|
plugins.matching( "<type>", [<array_of_names>]) => [plugins] # nil for missing ones
|
|
95
97
|
plugins.matching!("<type>", [<array_of_names>]) => [plugins] or exception PluginatorError
|
|
96
98
|
```
|
|
@@ -118,7 +120,7 @@ end
|
|
|
118
120
|
And now you can use it:
|
|
119
121
|
|
|
120
122
|
```ruby
|
|
121
|
-
plugins = Pluginator.find("<group>", extends: %i
|
|
123
|
+
plugins = Pluginator.find("<group>", extends: %i[first_one])
|
|
122
124
|
plugins.first_one("<type>") => first_plugin # nil when none
|
|
123
125
|
```
|
|
124
126
|
|
|
@@ -163,11 +165,11 @@ where `question?` and `answer` are user defined methods
|
|
|
163
165
|
Now the plugin can be used:
|
|
164
166
|
|
|
165
167
|
```ruby
|
|
166
|
-
require
|
|
168
|
+
require "pluginator"
|
|
167
169
|
|
|
168
170
|
rvm2plugins = Pluginator.find("rvm2")
|
|
169
171
|
plugin = rvm2plugins["cli"].first{ |plugin|
|
|
170
|
-
plugin.question?(
|
|
172
|
+
plugin.question?("echo")
|
|
171
173
|
}
|
|
172
174
|
plugin.new.answer("Hello world")
|
|
173
175
|
```
|
|
@@ -175,9 +177,9 @@ plugin.new.answer("Hello world")
|
|
|
175
177
|
Or using extensions:
|
|
176
178
|
|
|
177
179
|
```ruby
|
|
178
|
-
require
|
|
180
|
+
require "pluginator"
|
|
179
181
|
|
|
180
|
-
plugin = Pluginator.find("rvm2", extends: %i
|
|
182
|
+
plugin = Pluginator.find("rvm2", extends: %i[first_ask]).first_ask("cli", &:question?, "echo")
|
|
181
183
|
plugin.new.answer("Hello world")
|
|
182
184
|
```
|
|
183
185
|
|
|
@@ -188,7 +190,7 @@ plugin.new.answer("Hello world")
|
|
|
188
190
|
```ruby
|
|
189
191
|
class Rvm2::Hooks::AfterInstall::Show
|
|
190
192
|
def self.execute name, path
|
|
191
|
-
puts "Ruby
|
|
193
|
+
puts "Ruby #{name.inspect} was installed in #{path.inspect}."
|
|
192
194
|
end
|
|
193
195
|
end
|
|
194
196
|
```
|
|
@@ -196,7 +198,7 @@ end
|
|
|
196
198
|
and using hooks:
|
|
197
199
|
|
|
198
200
|
```ruby
|
|
199
|
-
require
|
|
201
|
+
require "pluginator"
|
|
200
202
|
|
|
201
203
|
Pluginator.find("rvm2", type: "hooks/after_install").type.each{ |plugin|
|
|
202
204
|
plugin.execute(name, path)
|
data/lib/pluginator.rb
CHANGED
|
@@ -24,10 +24,11 @@ require "pluginator/version"
|
|
|
24
24
|
module Pluginator
|
|
25
25
|
# Find plugins for the given group
|
|
26
26
|
#
|
|
27
|
-
# @param group
|
|
28
|
-
# @
|
|
29
|
-
# @option
|
|
30
|
-
# @
|
|
27
|
+
# @param group [String] name of plugins group
|
|
28
|
+
# @param options [Hash] options to pass to creating Pluginator instance
|
|
29
|
+
# @option type [String] name of type to load
|
|
30
|
+
# @option extend [Array<Symbol>|Symbol] list of extension to extend into pluginator instance
|
|
31
|
+
# @return [Pluginator::ExtendableAutodetect] instance of Pluginator
|
|
31
32
|
def self.find(group, options = {})
|
|
32
33
|
Pluginator::ExtendableAutodetect.new(group, options)
|
|
33
34
|
end
|
|
@@ -28,8 +28,9 @@ module Pluginator
|
|
|
28
28
|
|
|
29
29
|
# Automatically load plugins for given group (and type)
|
|
30
30
|
#
|
|
31
|
-
# @param group
|
|
32
|
-
# @
|
|
31
|
+
# @param group [String] name of the plugins group
|
|
32
|
+
# @param options [Hash] options to pass to creating Pluginator instance
|
|
33
|
+
# @option type [String] name of the plugin type
|
|
33
34
|
def initialize(group, options = {})
|
|
34
35
|
super(group)
|
|
35
36
|
setup_autodetect(options[:type])
|
|
@@ -67,16 +68,22 @@ module Pluginator
|
|
|
67
68
|
|
|
68
69
|
def unique_gemspec_paths(file_names)
|
|
69
70
|
all = gemspec_and_paths(file_names)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
activated = specs.find(&:activated?)
|
|
74
|
-
activated || specs.sort.last
|
|
71
|
+
selected = active_or_latest_gems_matching(all.map(&:first))
|
|
72
|
+
all.select do |gemspec, path, name, type|
|
|
73
|
+
selected.include?(gemspec)
|
|
75
74
|
end
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# filter active / latest gem versions
|
|
78
|
+
def active_or_latest_gems_matching(specifications)
|
|
79
|
+
specifications.group_by(&:name).map do |name, specifications|
|
|
80
|
+
active_or_latest_gemspec(specifications.sort)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# find active or latest gem in given set
|
|
85
|
+
def active_or_latest_gemspec(specifications)
|
|
86
|
+
specifications.find(&:activated) || specifications.last
|
|
80
87
|
end
|
|
81
88
|
|
|
82
89
|
def gemspec_and_paths(file_names)
|
|
@@ -107,22 +114,19 @@ module Pluginator
|
|
|
107
114
|
end
|
|
108
115
|
|
|
109
116
|
def find_latest_plugin_version(gemspecs, path)
|
|
110
|
-
gemspecs
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if
|
|
117
|
-
(activated.nil? || last == activated) &&
|
|
118
|
-
!best.activated?
|
|
119
|
-
then
|
|
120
|
-
last
|
|
121
|
-
else
|
|
122
|
-
best
|
|
117
|
+
active_or_latest_gemspec(gemspecs_sorted_by_metadata_and_version(gemspecs, path))
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def gemspecs_sorted_by_metadata_and_version(gemspecs, path)
|
|
121
|
+
gemspecs.sort_by do |spec|
|
|
122
|
+
[calculate_plugin_version(spec.metadata, path), spec.name, spec.version]
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
def calculate_plugin_version(metadata, path)
|
|
127
|
+
((metadata||{})[path]||"0").to_i
|
|
128
|
+
end
|
|
129
|
+
|
|
126
130
|
def load_plugin(path)
|
|
127
131
|
require path
|
|
128
132
|
true
|
data/lib/pluginator/errors.rb
CHANGED
|
@@ -23,26 +23,28 @@ module Pluginator
|
|
|
23
23
|
class PluginatorError < RuntimeError
|
|
24
24
|
private
|
|
25
25
|
def list_to_s(list)
|
|
26
|
-
list.map{|e|
|
|
26
|
+
list.map{|e| e.to_s.inspect }.join(", ")
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# raised when plugin can not be found, generated by `*!` methods
|
|
31
31
|
class MissingPlugin < PluginatorError
|
|
32
|
+
# initialize new error
|
|
32
33
|
# @param type [String] type of the loaded plugin
|
|
33
34
|
# @param name [String] name of the loaded plugin
|
|
34
35
|
# @param list [Array] list of available plugins
|
|
35
36
|
def initialize(type, name, list)
|
|
36
|
-
super("Can not find plugin
|
|
37
|
+
super("Can not find plugin #{name.inspect} in #{list_to_s(list)} for type #{type.inspect}.")
|
|
37
38
|
end
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
# raised when type can not be found, generated by `*!` methods
|
|
41
42
|
class MissingType < PluginatorError
|
|
43
|
+
# initialize new error
|
|
42
44
|
# @param type [String] type of the loaded plugin
|
|
43
45
|
# @param list [Array] list of available types
|
|
44
46
|
def initialize(type, list)
|
|
45
|
-
super("Can not find type
|
|
47
|
+
super("Can not find type #{type.inspect} in #{list_to_s(list)}.")
|
|
46
48
|
end
|
|
47
49
|
end
|
|
48
50
|
end
|
|
@@ -34,9 +34,10 @@ module Pluginator
|
|
|
34
34
|
# Automatically load plugins for given group (and type)
|
|
35
35
|
# Extend instance with extensions if given.
|
|
36
36
|
#
|
|
37
|
-
# @param group
|
|
38
|
-
# @
|
|
39
|
-
# @option
|
|
37
|
+
# @param group [String] name of the plugins group
|
|
38
|
+
# @param options [Hash] options to pass to creating Pluginator instance
|
|
39
|
+
# @option type [String] name of type to load
|
|
40
|
+
# @option extends [Array<Symbol>|Symbol] list of extension to extend into pluginator instance
|
|
40
41
|
def initialize(group, options = {})
|
|
41
42
|
super(group, options)
|
|
42
43
|
extend_plugins(options[:extends]||[])
|
|
@@ -44,7 +45,7 @@ module Pluginator
|
|
|
44
45
|
|
|
45
46
|
# Extend pluginator instance with given extensions
|
|
46
47
|
#
|
|
47
|
-
# @param extends list of extension to extend into pluginator instance
|
|
48
|
+
# @param extends [Array<Symbol>|Symbol] list of extension to extend into pluginator instance
|
|
48
49
|
def extend_plugins(extends)
|
|
49
50
|
extensions_matching(extends).each do |plugin|
|
|
50
51
|
extend plugin
|
data/lib/pluginator/group.rb
CHANGED
data/lib/pluginator/version.rb
CHANGED
|
@@ -22,18 +22,24 @@ module Pluginator::Extensions
|
|
|
22
22
|
module Conversions
|
|
23
23
|
|
|
24
24
|
# converts class name to a file name
|
|
25
|
+
# @param klass [String] class like string
|
|
26
|
+
# @return [String] file like string
|
|
25
27
|
def class2string( klass )
|
|
26
28
|
klass.to_s.gsub(/([A-Z])/m){|match| "_#{$1.downcase}" }[1..-1]
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
# converts file name to a class name
|
|
32
|
+
# @param str [String] file like string
|
|
33
|
+
# @return [String] class like string
|
|
30
34
|
def string2class( str )
|
|
31
35
|
str.to_s.capitalize.gsub(/_(.)/){ $1.upcase }
|
|
32
36
|
end
|
|
33
37
|
|
|
34
38
|
# gets class name last part
|
|
39
|
+
# @param klass [Class] class to read
|
|
40
|
+
# @return [String] the class name only without nesting
|
|
35
41
|
def class2name(klass)
|
|
36
|
-
klass.name.split(
|
|
42
|
+
klass.name.split("::").last
|
|
37
43
|
end
|
|
38
44
|
|
|
39
45
|
end
|
|
@@ -30,7 +30,7 @@ module Pluginator::Extensions
|
|
|
30
30
|
# @param type [String] name of type to search for plugins
|
|
31
31
|
# @param method_name [Symbol] name of the method to execute
|
|
32
32
|
# @param params [Array] params to pass to the called method
|
|
33
|
-
# @return The first plugin that method call returns true
|
|
33
|
+
# @return [Class] The first plugin that method call returns true
|
|
34
34
|
def first_ask(type, method_name, *params)
|
|
35
35
|
@plugins[type] or return nil
|
|
36
36
|
try_to_find(type, method_name, params)
|
|
@@ -38,6 +38,11 @@ module Pluginator::Extensions
|
|
|
38
38
|
|
|
39
39
|
# Call a method on plugin and return first one that returns `true`.
|
|
40
40
|
# Behaves like `first_ask` but throws exceptions if can not find anything.
|
|
41
|
+
# @param type [String] name of type to search for plugins
|
|
42
|
+
# @param method_name [Symbol] name of the method to execute
|
|
43
|
+
# @param params [Array] params to pass to the called method
|
|
44
|
+
# @return [Class] The first plugin that method call returns true
|
|
45
|
+
# @raise [Pluginator::MissingPlugin] when can not find plugin
|
|
41
46
|
def first_ask!(type, method_name, *params)
|
|
42
47
|
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
|
|
43
48
|
try_to_find(type, method_name, params) or
|
|
@@ -29,15 +29,19 @@ module Pluginator::Extensions
|
|
|
29
29
|
|
|
30
30
|
# Find first plugin that clas matches the given name.
|
|
31
31
|
#
|
|
32
|
-
# @param type
|
|
33
|
-
# @param klass [Symbol
|
|
34
|
-
# @return The first plugin that matches the klass
|
|
32
|
+
# @param type [String] name of type to search for plugins
|
|
33
|
+
# @param klass [Symbol|String] name of the searched class
|
|
34
|
+
# @return [Class] The first plugin that matches the klass
|
|
35
35
|
def first_class(type, klass)
|
|
36
36
|
(plugins_map(type) || {})[string2class(klass)]
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Find first plugin that clas matches the given name.
|
|
40
40
|
# Behaves like `first_class` but throws exceptions if can not find anything.
|
|
41
|
+
# @param type [String] name of type to search for plugins
|
|
42
|
+
# @param klass [Symbol|String] name of the searched class
|
|
43
|
+
# @return [Class] The first plugin that matches the klass
|
|
44
|
+
# @raise [Pluginator::MissingPlugin] when can not find plugin
|
|
41
45
|
def first_class!(type, klass)
|
|
42
46
|
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
|
|
43
47
|
klass = string2class(klass)
|
|
@@ -29,8 +29,8 @@ module Pluginator::Extensions
|
|
|
29
29
|
# Map array of names to available plugins.
|
|
30
30
|
#
|
|
31
31
|
# @param type [String] name of type to search for plugins
|
|
32
|
-
# @param list [Array]
|
|
33
|
-
# @return
|
|
32
|
+
# @param list [Array] list of plugin names to load
|
|
33
|
+
# @return [Array] list of loaded plugins
|
|
34
34
|
def matching(type, list)
|
|
35
35
|
list.map do |plugin|
|
|
36
36
|
(plugins_map(type) || {})[string2class(plugin)]
|
|
@@ -39,6 +39,10 @@ module Pluginator::Extensions
|
|
|
39
39
|
|
|
40
40
|
# Map array of names to available plugins.
|
|
41
41
|
# Behaves like `matching` but throws exceptions if can not find anything.
|
|
42
|
+
# @param type [String] name of type to search for plugins
|
|
43
|
+
# @param list [Array] list of plugin names to load
|
|
44
|
+
# @return [Array] list of loaded plugins
|
|
45
|
+
# @raise [Pluginator::MissingPlugin] when can not find plugin
|
|
42
46
|
def matching!(type, list)
|
|
43
47
|
@plugins[type] or raise Pluginator::MissingType.new(type, @plugins.keys)
|
|
44
48
|
list.map do |plugin|
|
data/pluginator.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
23
23
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
24
24
|
=end
|
|
25
25
|
|
|
26
|
-
lib = File.expand_path(
|
|
26
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
27
27
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
28
28
|
require "pluginator/version"
|
|
29
29
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
|
3
|
+
|
|
4
|
+
This file is part of pluginator.
|
|
5
|
+
|
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
=end
|
|
19
|
+
|
|
20
|
+
class Activated::Version1::Max
|
|
21
|
+
|
|
22
|
+
def self.handles?(what)
|
|
23
|
+
%w{ max maximum }.include?(what)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.action
|
|
27
|
+
41
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright 2013 Michal Papis <mpapis@gmail.com>
|
|
3
|
+
|
|
4
|
+
This file is part of pluginator.
|
|
5
|
+
|
|
6
|
+
pluginator is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published
|
|
8
|
+
by the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
pluginator is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
=end
|
|
19
|
+
|
|
20
|
+
class Activated::Version1::Max
|
|
21
|
+
|
|
22
|
+
def self.handles?(what)
|
|
23
|
+
%w{ max maximum }.include?(what)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.action
|
|
27
|
+
42
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
# stub: fake-gem-name-activated 1.0.0 ruby lib
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "fake-gem-name-activated"
|
|
6
|
+
s.version = "1.0.0"
|
|
7
|
+
|
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
9
|
+
s.require_paths = ["lib"]
|
|
10
|
+
s.authors = ["Michal Papis"]
|
|
11
|
+
s.date = "2014-09-21"
|
|
12
|
+
s.description = "Do nothing"
|
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
|
15
|
+
s.homepage = "https://rvm.io"
|
|
16
|
+
s.licenses = ["LGPL v3"]
|
|
17
|
+
s.rubygems_version = "2.2.2"
|
|
18
|
+
s.summary = "Do Nothing"
|
|
19
|
+
|
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
# stub: fake-gem-name-activated 2.0.0 ruby lib
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "fake-gem-name-activated"
|
|
6
|
+
s.version = "2.0.0"
|
|
7
|
+
|
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
9
|
+
s.require_paths = ["lib"]
|
|
10
|
+
s.authors = ["Michal Papis"]
|
|
11
|
+
s.date = "2014-09-21"
|
|
12
|
+
s.description = "Do nothing"
|
|
13
|
+
s.email = ["mpapis@gmail.com"]
|
|
14
|
+
s.files = Dir["../../gems/#{s.name}-#{s.version}/lib/**/*.rb"]
|
|
15
|
+
s.homepage = "https://rvm.io"
|
|
16
|
+
s.licenses = ["LGPL v3"]
|
|
17
|
+
s.rubygems_version = "2.2.2"
|
|
18
|
+
s.summary = "Do Nothing"
|
|
19
|
+
|
|
20
|
+
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
|
|
21
|
+
end
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "pluginator/autodetect"
|
|
22
22
|
|
|
23
23
|
def gem_file(path, options = {})
|
|
24
24
|
options.merge!({
|
|
@@ -87,19 +87,38 @@ describe Pluginator::Autodetect do
|
|
|
87
87
|
|
|
88
88
|
it "loads files" do
|
|
89
89
|
@pluginator.send(:load_files, @math_files)
|
|
90
|
-
@pluginator.types.must_include(
|
|
90
|
+
@pluginator.types.must_include("math")
|
|
91
91
|
plugins = @pluginator["math"].map(&:to_s)
|
|
92
92
|
plugins.size.must_equal(2)
|
|
93
93
|
plugins.must_include("Something::Math::Increase")
|
|
94
94
|
plugins.must_include("Something::Math::Decrease")
|
|
95
95
|
plugins.wont_include("Something::Math::Substract")
|
|
96
96
|
end
|
|
97
|
+
|
|
98
|
+
it "finds unique gems for paths" do
|
|
99
|
+
@pluginator.send(:gemspec_and_paths, @math_files).map{ |gemspec, path, name, type|
|
|
100
|
+
[gemspec.name, gemspec.version.to_s, path, name, type]
|
|
101
|
+
}.must_equal([
|
|
102
|
+
["fake-gem-name-a", "1.0.0", "plugins/something/math/decrease.rb", "something/math/decrease", "math"],
|
|
103
|
+
["fake-gem-name-a", "1.0.0", "plugins/something/math/increase.rb", "something/math/increase", "math"],
|
|
104
|
+
])
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it "finds unique gems for paths" do
|
|
108
|
+
@pluginator.send(:unique_gemspec_paths, @math_files).map{ |gemspec, path, name, type|
|
|
109
|
+
[gemspec.name, gemspec.version.to_s, path, name, type]
|
|
110
|
+
}.must_equal([
|
|
111
|
+
["fake-gem-name-a", "1.0.0", "plugins/something/math/decrease.rb", "something/math/decrease", "math"],
|
|
112
|
+
["fake-gem-name-a", "1.0.0", "plugins/something/math/increase.rb", "something/math/increase", "math"],
|
|
113
|
+
])
|
|
114
|
+
end
|
|
115
|
+
|
|
97
116
|
end
|
|
98
117
|
|
|
99
118
|
it "loads plugins automatically for group" do
|
|
100
119
|
pluginator = Pluginator::Autodetect.new("something")
|
|
101
|
-
pluginator.types.must_include(
|
|
102
|
-
pluginator.types.must_include(
|
|
120
|
+
pluginator.types.must_include("stats")
|
|
121
|
+
pluginator.types.must_include("math")
|
|
103
122
|
pluginator.types.size.must_equal(3)
|
|
104
123
|
plugins = pluginator["math"].map(&:to_s)
|
|
105
124
|
plugins.size.must_equal(2)
|
|
@@ -110,13 +129,13 @@ describe Pluginator::Autodetect do
|
|
|
110
129
|
|
|
111
130
|
it "loads plugins automatically for group/type" do
|
|
112
131
|
pluginator = Pluginator::Autodetect.new("something", :type => "stats")
|
|
113
|
-
pluginator.types.must_include(
|
|
132
|
+
pluginator.types.must_include("stats")
|
|
114
133
|
pluginator.types.size.must_equal(1)
|
|
115
134
|
end
|
|
116
135
|
|
|
117
136
|
it "makes group plugins work" do
|
|
118
137
|
pluginator = Pluginator::Autodetect.new("something")
|
|
119
|
-
pluginator.types.must_include(
|
|
138
|
+
pluginator.types.must_include("math")
|
|
120
139
|
pluginator["math"].detect{|plugin| plugin.type == "increase" }.action(2).must_equal(3)
|
|
121
140
|
pluginator["math"].detect{|plugin| plugin.type == "decrease" }.action(5).must_equal(4)
|
|
122
141
|
end
|
|
@@ -130,13 +149,13 @@ describe Pluginator::Autodetect do
|
|
|
130
149
|
end
|
|
131
150
|
|
|
132
151
|
it "defines type method dynamically" do
|
|
133
|
-
pluginator = Pluginator::Autodetect.new("something", :type =>
|
|
134
|
-
pluginator.type.must_equal(pluginator[
|
|
152
|
+
pluginator = Pluginator::Autodetect.new("something", :type => "math")
|
|
153
|
+
pluginator.type.must_equal(pluginator["math"])
|
|
135
154
|
end
|
|
136
155
|
|
|
137
156
|
it "loads self" do
|
|
138
157
|
pluginator = Pluginator::Autodetect.new("pluginator")
|
|
139
|
-
pluginator.types.must_include(
|
|
158
|
+
pluginator.types.must_include("extensions")
|
|
140
159
|
pluginator.types.size.must_equal(1)
|
|
141
160
|
pluginator["extensions"].map(&:to_s).sort.must_equal([
|
|
142
161
|
"Pluginator::Extensions::ClassExist",
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "pluginator/extendable_autodetect"
|
|
22
22
|
|
|
23
23
|
describe Pluginator::ExtendableAutodetect do
|
|
24
24
|
it "loads existing extensions - array" do
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "pluginator/group"
|
|
22
22
|
|
|
23
23
|
describe Pluginator::Group do
|
|
24
24
|
it "has name" do
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "pluginator/name_converter"
|
|
22
22
|
|
|
23
23
|
class Converter
|
|
24
24
|
extend Pluginator::NameConverter
|
data/test/pluginator_test.rb
CHANGED
|
@@ -17,15 +17,15 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "pluginator"
|
|
22
22
|
|
|
23
23
|
describe Pluginator do
|
|
24
24
|
it "loads_plugins_automatically_for_group" do
|
|
25
25
|
pluginator = Pluginator.find("something")
|
|
26
|
-
pluginator.types.must_include(
|
|
27
|
-
pluginator.types.must_include(
|
|
28
|
-
pluginator.types.must_include(
|
|
26
|
+
pluginator.types.must_include("stats")
|
|
27
|
+
pluginator.types.must_include("math")
|
|
28
|
+
pluginator.types.must_include("nested/structure")
|
|
29
29
|
pluginator.types.size.must_equal(3)
|
|
30
30
|
plugins = pluginator["math"].map(&:to_s)
|
|
31
31
|
plugins.size.must_equal(2)
|
|
@@ -36,7 +36,7 @@ describe Pluginator do
|
|
|
36
36
|
|
|
37
37
|
it "loads_plugins_automatically_for_group_type" do
|
|
38
38
|
pluginator = Pluginator.find("something", :type => "stats")
|
|
39
|
-
pluginator.types.must_include(
|
|
39
|
+
pluginator.types.must_include("stats")
|
|
40
40
|
pluginator.types.size.must_equal(1)
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ describe Pluginator do
|
|
|
49
49
|
|
|
50
50
|
it "loads_nested_plugins" do
|
|
51
51
|
pluginator = Pluginator.find("something")
|
|
52
|
-
pluginator.types.must_include(
|
|
52
|
+
pluginator.types.must_include("nested/structure")
|
|
53
53
|
pluginator["nested/structure"].map(&:to_s).must_equal(["Something::Nested::Structure::Test"])
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -67,12 +67,31 @@ describe Pluginator do
|
|
|
67
67
|
active_gems.wont_include("fake-gem-name-latest-1.0.0")
|
|
68
68
|
active_gems.must_include("fake-gem-name-latest-2.0.0")
|
|
69
69
|
|
|
70
|
-
pluginator.types.must_include(
|
|
71
|
-
pluginator.types.wont_include(
|
|
70
|
+
pluginator.types.must_include("version2")
|
|
71
|
+
pluginator.types.wont_include("version1")
|
|
72
72
|
pluginator.types.size.must_equal(1)
|
|
73
73
|
pluginator["version2"].map(&:to_s).must_equal(["Latest::Version2::Max"])
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
it "loads_only_plugins_from_activated_version_of_gem" do
|
|
77
|
+
all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
|
|
78
|
+
all_gems.must_include("fake-gem-name-activated-1.0.0")
|
|
79
|
+
all_gems.must_include("fake-gem-name-activated-2.0.0")
|
|
80
|
+
Gem::Specification._all.find{|s| [s.name, s.version.to_s] == ["fake-gem-name-activated", "1.0.0"] }.activate
|
|
81
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
|
82
|
+
active_gems.must_include("fake-gem-name-activated-1.0.0")
|
|
83
|
+
active_gems.wont_include("fake-gem-name-activated-2.0.0")
|
|
84
|
+
|
|
85
|
+
pluginator = Pluginator.find("activated")
|
|
86
|
+
|
|
87
|
+
active_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" if s.activated? }.compact
|
|
88
|
+
active_gems.must_include("fake-gem-name-activated-1.0.0")
|
|
89
|
+
|
|
90
|
+
pluginator.types.must_include("version1")
|
|
91
|
+
pluginator.types.size.must_equal(1)
|
|
92
|
+
pluginator["version1"].map(&:to_s).must_equal(["Activated::Version1::Max"])
|
|
93
|
+
end
|
|
94
|
+
|
|
76
95
|
it "loads_latest_version_of_plugin_from_two_gems_v1" do
|
|
77
96
|
all_gems = Gem::Specification._all.map{|s| "#{s.name}-#{s.version}" }
|
|
78
97
|
all_gems.must_include("fake-gem-name-v1a-1.0.0")
|
|
@@ -86,7 +105,7 @@ describe Pluginator do
|
|
|
86
105
|
active_gems.wont_include("fake-gem-name-v1a-1.0.0")
|
|
87
106
|
active_gems.must_include("fake-gem-name-v1b-1.0.0")
|
|
88
107
|
|
|
89
|
-
pluginator.types.must_include(
|
|
108
|
+
pluginator.types.must_include("stats")
|
|
90
109
|
pluginator.types.size.must_equal(1)
|
|
91
110
|
pluginator["stats"].map(&:to_s).must_equal(["V1test::Stats::Max"])
|
|
92
111
|
pluginator["stats"].first.action.must_equal(42)
|
|
@@ -105,7 +124,7 @@ describe Pluginator do
|
|
|
105
124
|
active_gems.must_include("fake-gem-name-v2a-1.0.0")
|
|
106
125
|
active_gems.wont_include("fake-gem-name-v2b-1.0.0")
|
|
107
126
|
|
|
108
|
-
pluginator.types.must_include(
|
|
127
|
+
pluginator.types.must_include("stats")
|
|
109
128
|
pluginator.types.size.must_equal(1)
|
|
110
129
|
pluginator["stats"].map(&:to_s).must_equal(["V2test::Stats::Max"])
|
|
111
130
|
pluginator["stats"].first.action.must_equal(41)
|
|
@@ -17,9 +17,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
22
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/class_exist"
|
|
22
|
+
require "plugins/something/stats/max"
|
|
23
23
|
|
|
24
24
|
class ClassExistTester
|
|
25
25
|
attr_accessor :plugins
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/conversions"
|
|
22
22
|
|
|
23
23
|
class ConversionsTester
|
|
24
24
|
extend Pluginator::Extensions::Conversions
|
|
@@ -26,9 +26,9 @@ end
|
|
|
26
26
|
|
|
27
27
|
describe Pluginator::Extensions::Conversions do
|
|
28
28
|
it "class2string" do
|
|
29
|
-
ConversionsTester.class2string(
|
|
29
|
+
ConversionsTester.class2string("SomethingLong").must_match("something_long")
|
|
30
30
|
end
|
|
31
31
|
it "string2class" do
|
|
32
|
-
ConversionsTester.string2class(
|
|
32
|
+
ConversionsTester.string2class("something_long").must_match("SomethingLong")
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -17,9 +17,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
22
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/first_ask"
|
|
22
|
+
require "plugins/something/stats/max"
|
|
23
23
|
|
|
24
24
|
class FirstAskTester
|
|
25
25
|
attr_accessor :plugins
|
|
@@ -17,9 +17,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
22
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/first_class"
|
|
22
|
+
require "plugins/something/stats/max"
|
|
23
23
|
|
|
24
24
|
class FirstClassTester
|
|
25
25
|
attr_accessor :plugins
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/matching"
|
|
22
22
|
|
|
23
23
|
class MatchingTester
|
|
24
24
|
attr_accessor :plugins
|
|
@@ -17,8 +17,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
|
19
19
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
20
|
+
require "test_helper"
|
|
21
|
+
require "plugins/pluginator/extensions/plugins_map"
|
|
22
22
|
|
|
23
23
|
class PluginsMapTester
|
|
24
24
|
attr_accessor :plugins
|
data/test/test_helper.rb
CHANGED
|
@@ -19,11 +19,11 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
19
19
|
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
=end
|
|
21
21
|
|
|
22
|
-
require
|
|
23
|
-
require
|
|
22
|
+
require "rubygems"
|
|
23
|
+
require "minitest"
|
|
24
24
|
|
|
25
25
|
# fix lib in LOAD_PATH and load version for gems manipulation
|
|
26
|
-
lib = File.expand_path(
|
|
26
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
27
27
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
28
28
|
require "pluginator/version"
|
|
29
29
|
|
|
@@ -42,7 +42,7 @@ Gem.refresh
|
|
|
42
42
|
|
|
43
43
|
# make sure pluginator is available as gem for tests of pluginator plugins
|
|
44
44
|
#Gem::Specification.add_spec(Gem::Specification.load(File.expand_path("../gems/specifications/pluginator-#{Pluginator::VERSION}.gemspec", __FILE__)))
|
|
45
|
-
gem
|
|
45
|
+
gem "pluginator"
|
|
46
46
|
|
|
47
47
|
if
|
|
48
48
|
RUBY_VERSION == "2.0.0" && # check Gemfile
|
|
@@ -60,7 +60,7 @@ then
|
|
|
60
60
|
add_filter "/test/"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
Coveralls.noisy = true unless ENV[
|
|
63
|
+
Coveralls.noisy = true unless ENV["CI"]
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
module Something
|
|
@@ -70,6 +70,9 @@ module Something
|
|
|
70
70
|
module Structure; end
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
|
+
module Activated
|
|
74
|
+
module Version1; end
|
|
75
|
+
end
|
|
73
76
|
module Latest
|
|
74
77
|
module Version1; end
|
|
75
78
|
module Version2; end
|
|
@@ -81,5 +84,5 @@ module V2test
|
|
|
81
84
|
module Stats; end
|
|
82
85
|
end
|
|
83
86
|
|
|
84
|
-
require
|
|
85
|
-
require
|
|
87
|
+
require "minitest/autorun" unless $0=="-e" # skip in guard
|
|
88
|
+
require "minitest/unit"
|
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: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Papis
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2014-
|
|
13
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rake
|
|
@@ -78,6 +78,10 @@ files:
|
|
|
78
78
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb
|
|
79
79
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb
|
|
80
80
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb
|
|
81
|
+
- test/gems/gems/fake-gem-name-activated-1.0.0/lib/fake-gem-name-activated.rb
|
|
82
|
+
- test/gems/gems/fake-gem-name-activated-1.0.0/lib/plugins/activated/version1/max.rb
|
|
83
|
+
- test/gems/gems/fake-gem-name-activated-2.0.0/lib/fake-gem-name-activated.rb
|
|
84
|
+
- test/gems/gems/fake-gem-name-activated-2.0.0/lib/plugins/activated/version1/max.rb
|
|
81
85
|
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb
|
|
82
86
|
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb
|
|
83
87
|
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb
|
|
@@ -91,13 +95,14 @@ files:
|
|
|
91
95
|
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb
|
|
92
96
|
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb
|
|
93
97
|
- test/gems/specifications/fake-gem-name-a-1.0.0.gemspec
|
|
98
|
+
- test/gems/specifications/fake-gem-name-activated-1.0.0.gemspec
|
|
99
|
+
- test/gems/specifications/fake-gem-name-activated-2.0.0.gemspec
|
|
94
100
|
- test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec
|
|
95
101
|
- test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec
|
|
96
102
|
- test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec
|
|
97
103
|
- test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec
|
|
98
104
|
- test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec
|
|
99
105
|
- test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec
|
|
100
|
-
- test/gems/specifications/pluginator-1.1.0.gemspec
|
|
101
106
|
- test/pluginator/autodetect_test.rb
|
|
102
107
|
- test/pluginator/extendable_autodetect_test.rb
|
|
103
108
|
- test/pluginator/group_test.rb
|
|
@@ -140,6 +145,10 @@ test_files:
|
|
|
140
145
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/math/increase.rb
|
|
141
146
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/nested/structure/test.rb
|
|
142
147
|
- test/gems/gems/fake-gem-name-a-1.0.0/lib/plugins/something/stats/max.rb
|
|
148
|
+
- test/gems/gems/fake-gem-name-activated-1.0.0/lib/fake-gem-name-activated.rb
|
|
149
|
+
- test/gems/gems/fake-gem-name-activated-1.0.0/lib/plugins/activated/version1/max.rb
|
|
150
|
+
- test/gems/gems/fake-gem-name-activated-2.0.0/lib/fake-gem-name-activated.rb
|
|
151
|
+
- test/gems/gems/fake-gem-name-activated-2.0.0/lib/plugins/activated/version1/max.rb
|
|
143
152
|
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/fake-gem-name-latest.rb
|
|
144
153
|
- test/gems/gems/fake-gem-name-latest-1.0.0/lib/plugins/latest/version1/max.rb
|
|
145
154
|
- test/gems/gems/fake-gem-name-latest-2.0.0/lib/fake-gem-name-latest.rb
|
|
@@ -153,13 +162,14 @@ test_files:
|
|
|
153
162
|
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/fake-gem-name-v2b.rb
|
|
154
163
|
- test/gems/gems/fake-gem-name-v2b-1.0.0/lib/plugins/v2test/stats/max.rb
|
|
155
164
|
- test/gems/specifications/fake-gem-name-a-1.0.0.gemspec
|
|
165
|
+
- test/gems/specifications/fake-gem-name-activated-1.0.0.gemspec
|
|
166
|
+
- test/gems/specifications/fake-gem-name-activated-2.0.0.gemspec
|
|
156
167
|
- test/gems/specifications/fake-gem-name-latest-1.0.0.gemspec
|
|
157
168
|
- test/gems/specifications/fake-gem-name-latest-2.0.0.gemspec
|
|
158
169
|
- test/gems/specifications/fake-gem-name-v1a-1.0.0.gemspec
|
|
159
170
|
- test/gems/specifications/fake-gem-name-v1b-1.0.0.gemspec
|
|
160
171
|
- test/gems/specifications/fake-gem-name-v2a-1.0.0.gemspec
|
|
161
172
|
- test/gems/specifications/fake-gem-name-v2b-1.0.0.gemspec
|
|
162
|
-
- test/gems/specifications/pluginator-1.1.0.gemspec
|
|
163
173
|
- test/pluginator/autodetect_test.rb
|
|
164
174
|
- test/pluginator/extendable_autodetect_test.rb
|
|
165
175
|
- test/pluginator/group_test.rb
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# -*- encoding: utf-8 -*-
|
|
3
|
-
# stub: PLUGINATOR ruby lib
|
|
4
|
-
|
|
5
|
-
=begin
|
|
6
|
-
Copyright 2013
|
|
7
|
-
- Michal Papis <mpapis@gmail.com>
|
|
8
|
-
- Jordon Bedwell <envygeeks@gmail.com>
|
|
9
|
-
|
|
10
|
-
This file is part of pluginator.
|
|
11
|
-
|
|
12
|
-
pluginator is free software: you can redistribute it and/or modify
|
|
13
|
-
it under the terms of the GNU Lesser General Public License as published
|
|
14
|
-
by the Free Software Foundation, either version 3 of the License, or
|
|
15
|
-
(at your option) any later version.
|
|
16
|
-
|
|
17
|
-
pluginator is distributed in the hope that it will be useful,
|
|
18
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
-
GNU Lesser General Public License for more details.
|
|
21
|
-
|
|
22
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
23
|
-
along with pluginator. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
-
=end
|
|
25
|
-
|
|
26
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
27
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
28
|
-
require "pluginator/version"
|
|
29
|
-
|
|
30
|
-
Gem::Specification.new do |s|
|
|
31
|
-
s.email = ["mpapis@gmail.com", "envygeeks@gmail.com", "mose@mose.com"]
|
|
32
|
-
s.authors = ["Michal Papis", "Jordon Bedwell", "Mose"]
|
|
33
|
-
s.name = "pluginator"
|
|
34
|
-
s.version = Pluginator::VERSION
|
|
35
|
-
s.license = "LGPL v3"
|
|
36
|
-
s.files = `git ls-files`.split("\n")
|
|
37
|
-
s.required_ruby_version = ">= 1.8.7"
|
|
38
|
-
s.add_development_dependency("rake")
|
|
39
|
-
s.add_development_dependency("minitest")
|
|
40
|
-
# s.add_development_dependency("smf-gem")
|
|
41
|
-
s.homepage = "https://github.com/rvm/pluginator"
|
|
42
|
-
s.summary = "Rubygems plugin system using Gem.find_files."
|
|
43
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
44
|
-
end
|