pluginator 0.11.6 → 0.12.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 +11 -0
- data/Gemfile +11 -1
- data/README.md +5 -5
- data/lib/pluginator/autodetect.rb +2 -2
- data/lib/pluginator/extendable_autodetect.rb +4 -4
- data/lib/pluginator/version.rb +1 -1
- data/lib/pluginator.rb +2 -2
- data/pluginator.gemspec +2 -2
- data/test/pluginator/extendable_autodetect_test.rb +3 -3
- metadata +16 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8c056877e89594061c2e405b67949407eeb21e
|
4
|
+
data.tar.gz: 2d5d6f563ce00c70ca1b580ba21e70aa6098d5d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f01770108770ca11337f9c4f0eb4fcc62671ff1339c34263854b72def4a7cf99a61a89e1a5dc43f07ed2b172b51fde14b9805ef61ce94f4e554cdb0190d28665
|
7
|
+
data.tar.gz: 93ba1b89cd686ee8e2db580610eb048b17648d1ec0bced4870f25b22d7c582168ccca81a0b7559adabdfc2cdaca263845dd8d95b0ff34138fcac76f6c9dfc1e9
|
data/.travis.yml
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- jruby
|
4
|
+
- ruby-head
|
5
|
+
- 2.1.0
|
3
6
|
- 2.0.0
|
7
|
+
- 1.9.3
|
8
|
+
- 1.9.2
|
9
|
+
- rbx
|
4
10
|
notifications:
|
5
11
|
irc:
|
6
12
|
channels:
|
@@ -9,3 +15,8 @@ notifications:
|
|
9
15
|
recipients:
|
10
16
|
- mpapis@gmail.com
|
11
17
|
on_failure: change
|
18
|
+
matrix:
|
19
|
+
allow_failures:
|
20
|
+
- rvm: 1.9.2
|
21
|
+
- rvm: rbx
|
22
|
+
fast_finish: true
|
data/Gemfile
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
#ruby=2.
|
3
|
+
#ruby=2.1.0
|
4
4
|
|
5
5
|
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
# documentation formatting
|
9
|
+
gem "redcarpet", :platforms => [:ruby]
|
10
|
+
|
11
|
+
# rubinius support
|
12
|
+
gem "rubysl-json", :platforms => [:rbx]
|
13
|
+
gem "rubysl-mutex_m", :platforms => [:rbx]
|
14
|
+
gem "rubysl-singleton", :platforms => [:rbx]
|
15
|
+
end
|
data/README.md
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/rvm/pluginator/badge.png?branch=master)](https://coveralls.io/r/rvm/pluginator?branch=master)
|
6
6
|
[![Build Status](https://travis-ci.org/rvm/pluginator.png?branch=master)](https://travis-ci.org/rvm/pluginator)
|
7
7
|
[![Dependency Status](https://gemnasium.com/rvm/pluginator.png)](https://gemnasium.com/rvm/pluginator)
|
8
|
-
[Documentation](http://rubydoc.info/gems/pluginator/frames)
|
8
|
+
[![Documentation](http://b.repl.ca/v1/yard-docs-blue.png)](http://rubydoc.info/gems/pluginator/frames)
|
9
9
|
|
10
10
|
Gem plugin system management, detects plugins using `Gem.find_file`.
|
11
|
-
Is only supposed with ruby
|
11
|
+
Is only supposed with ruby 1.9.3+ (some tests fail on 1.9.2)
|
12
12
|
|
13
13
|
Pluginator tries to stay out of your way, you do not have to include or inherit anything.
|
14
14
|
Pluginator only finds and groups plugins, rest is up to you,
|
@@ -16,7 +16,7 @@ you decide what methods to define and how to find them.
|
|
16
16
|
|
17
17
|
## Defining plugins
|
18
18
|
|
19
|
-
|
19
|
+
create a gem with a path:
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
plugins/<group>/<type>/<name>.rb
|
@@ -58,7 +58,7 @@ Pluginator comes with few handful extensions.
|
|
58
58
|
|
59
59
|
### Class exist
|
60
60
|
|
61
|
-
Check if plugin with given class name
|
61
|
+
Check if plugin with given class name exists.
|
62
62
|
|
63
63
|
```ruby
|
64
64
|
plugins = Pluginator.find("<group>", extends: %i{class_exist})
|
@@ -77,7 +77,7 @@ plugins.first_ask!("<type>", "method_to_call", *params) => plugin or exception P
|
|
77
77
|
|
78
78
|
### First class
|
79
79
|
|
80
|
-
Find first plugin that
|
80
|
+
Find first plugin that class matches the given name.
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
plugins = Pluginator.find("<group>", extends: %i{first_class})
|
@@ -11,9 +11,9 @@ module Pluginator
|
|
11
11
|
#
|
12
12
|
# @param group [String] name of the plugins group
|
13
13
|
# @option type [String] name of the plugin type
|
14
|
-
def initialize(group,
|
14
|
+
def initialize(group, options = {})
|
15
15
|
super(group)
|
16
|
-
setup_autodetect(type)
|
16
|
+
setup_autodetect(options[:type])
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -17,10 +17,10 @@ module Pluginator
|
|
17
17
|
#
|
18
18
|
# @param group [String] name of the plugins group
|
19
19
|
# @option type [String] name of type to load
|
20
|
-
# @option
|
21
|
-
def initialize(group,
|
22
|
-
super(group,
|
23
|
-
extend_plugins(extends)
|
20
|
+
# @option extends [Array of/or Symbol] list of extension to extend into pluginator instance
|
21
|
+
def initialize(group, options = {})
|
22
|
+
super(group, options)
|
23
|
+
extend_plugins(options[:extends]||[])
|
24
24
|
end
|
25
25
|
|
26
26
|
# Extend pluginator instance with given extensions
|
data/lib/pluginator/version.rb
CHANGED
data/lib/pluginator.rb
CHANGED
@@ -9,7 +9,7 @@ module Pluginator
|
|
9
9
|
# @option type [String] name of type to load
|
10
10
|
# @option extend [Array of/or Symbol] list of extension to extend into pluginator instance
|
11
11
|
# @return instance of Pluginator
|
12
|
-
def self.find(group,
|
13
|
-
Pluginator::ExtendableAutodetect.new(group,
|
12
|
+
def self.find(group, options = {})
|
13
|
+
Pluginator::ExtendableAutodetect.new(group, options)
|
14
14
|
end
|
15
15
|
end
|
data/pluginator.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.name = "pluginator"
|
10
10
|
s.version = Pluginator::VERSION
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
|
-
s.required_ruby_version = ">= 1.9.
|
13
|
-
%w{rake minitest simplecov coveralls
|
12
|
+
s.required_ruby_version = ">= 1.9.2"
|
13
|
+
%w{rake minitest simplecov coveralls}.each do |name|
|
14
14
|
s.add_development_dependency(name)
|
15
15
|
end
|
16
16
|
# s.add_development_dependency("smf-gem")
|
@@ -3,14 +3,14 @@ require 'pluginator/extendable_autodetect'
|
|
3
3
|
|
4
4
|
describe Pluginator::ExtendableAutodetect do
|
5
5
|
it "loads existing extensions - array" do
|
6
|
-
pluginator = Pluginator::ExtendableAutodetect.new("something", extends:
|
6
|
+
pluginator = Pluginator::ExtendableAutodetect.new("something", :extends => [:conversions])
|
7
7
|
pluginator.public_methods.must_include(:class2string)
|
8
8
|
pluginator.public_methods.must_include(:string2class)
|
9
9
|
pluginator.public_methods.wont_include(:plugins_map)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "loads existing extensions - symbol" do
|
13
|
-
pluginator = Pluginator::ExtendableAutodetect.new("something", extends
|
13
|
+
pluginator = Pluginator::ExtendableAutodetect.new("something", :extends => :conversions)
|
14
14
|
pluginator.public_methods.must_include(:class2string)
|
15
15
|
pluginator.public_methods.must_include(:string2class)
|
16
16
|
pluginator.public_methods.wont_include(:plugins_map)
|
@@ -18,7 +18,7 @@ describe Pluginator::ExtendableAutodetect do
|
|
18
18
|
|
19
19
|
it "fails to load missing extension" do
|
20
20
|
lambda {
|
21
|
-
Pluginator::ExtendableAutodetect.new("something", extends:
|
21
|
+
Pluginator::ExtendableAutodetect.new("something", :extends => [:missing_conversions])
|
22
22
|
}.must_raise(Pluginator::MissingPlugin)
|
23
23
|
end
|
24
24
|
end
|
metadata
CHANGED
@@ -1,83 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.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-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
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
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: redcarpet
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
description:
|
@@ -87,8 +73,8 @@ executables: []
|
|
87
73
|
extensions: []
|
88
74
|
extra_rdoc_files: []
|
89
75
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
92
78
|
- Gemfile
|
93
79
|
- README.md
|
94
80
|
- Rakefile
|
@@ -130,17 +116,17 @@ require_paths:
|
|
130
116
|
- lib
|
131
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
118
|
requirements:
|
133
|
-
- -
|
119
|
+
- - ">="
|
134
120
|
- !ruby/object:Gem::Version
|
135
|
-
version: 1.9.
|
121
|
+
version: 1.9.2
|
136
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
123
|
requirements:
|
138
|
-
- -
|
124
|
+
- - ">="
|
139
125
|
- !ruby/object:Gem::Version
|
140
126
|
version: '0'
|
141
127
|
requirements: []
|
142
128
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.0
|
129
|
+
rubygems_version: 2.2.0
|
144
130
|
signing_key:
|
145
131
|
specification_version: 4
|
146
132
|
summary: Rubygems plugin system using Gem.find_files.
|
@@ -157,4 +143,3 @@ test_files:
|
|
157
143
|
- test/plugins/extensions/matching_test.rb
|
158
144
|
- test/plugins/extensions/plugins_map_test.rb
|
159
145
|
- test/test_helper.rb
|
160
|
-
has_rdoc:
|