pluggability 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data/ChangeLog +29 -2
- data/History.rdoc +5 -0
- data/README.rdoc +169 -159
- data/Rakefile +2 -0
- data/lib/pluggability.rb +6 -9
- data/spec/pluggability_spec.rb +8 -2
- data.tar.gz.sig +0 -0
- metadata +53 -76
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e540538307554e6530b3aceb32cdcc5943819fb5
|
4
|
+
data.tar.gz: 7c1548aa2c9959d938bcfebfd62896727a9f02f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2a7beb87ff1f941522f4467db3caf61bac30f3d520962bce63c2a029f97f3d04ab6d4294e315f6c6349899afa3f766ef7b905d41564514ba08d38c807ff5c0a
|
7
|
+
data.tar.gz: 3a717ceb7a3d075691c36e0a520d8de3ca416bb25e2e13f59d560aa852a904fbe34392bd4e1ed3d685ff8d90e8fe833771fbe4b9d6e72666636cc62fb0906938
|
checksums.yaml.gz.sig
ADDED
data/ChangeLog
CHANGED
@@ -1,13 +1,40 @@
|
|
1
|
+
2013-03-01 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .rvmrc, History.rdoc, lib/pluggability.rb:
|
4
|
+
Bump patch version, update history.
|
5
|
+
[41c55c0e6830] [tip]
|
6
|
+
|
7
|
+
2012-08-13 Michael Granger <ged@FaerieMUD.org>
|
8
|
+
|
9
|
+
* lib/pluggability.rb, spec/pluggability_spec.rb:
|
10
|
+
Simplify Pluggability#derivatives.
|
11
|
+
[7feffaf62b71]
|
12
|
+
|
13
|
+
2012-08-06 Michael Granger <ged@FaerieMUD.org>
|
14
|
+
|
15
|
+
* README.rdoc, Rakefile, experiments/logger_output.rb:
|
16
|
+
Update docs.
|
17
|
+
[2ae57144e2df]
|
18
|
+
|
1
19
|
2012-08-03 Michael Granger <ged@FaerieMUD.org>
|
2
20
|
|
21
|
+
* .hgtags:
|
22
|
+
Added tag v0.0.1 for changeset 379015772893
|
23
|
+
[f66a50774525]
|
24
|
+
|
25
|
+
* lib/pluggability.rb, spec/pluggability_spec.rb:
|
26
|
+
Fix specs for FactoryError changes; add backward-compatibility
|
27
|
+
constant.
|
28
|
+
[379015772893] [v0.0.1]
|
29
|
+
|
3
30
|
* .rvm.gems, History.rdoc, Rakefile, lib/pluggability.rb,
|
4
31
|
spec/pluggability_spec.rb:
|
5
32
|
Finish up conversion to Pluggability
|
6
|
-
[
|
33
|
+
[a5ca03df63cf]
|
7
34
|
|
8
35
|
* .hgtags:
|
9
36
|
Removed tag release
|
10
|
-
[71aae8059784]
|
37
|
+
[71aae8059784]
|
11
38
|
|
12
39
|
* .hgtags:
|
13
40
|
Removed tag RELEASE_0_01
|
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,187 +1,197 @@
|
|
1
1
|
= pluggability
|
2
2
|
|
3
|
-
|
3
|
+
project:: https://bitbucket.org/ged/pluggability
|
4
|
+
docs :: http://deveiate.org/code/pluggability
|
5
|
+
github :: http://github.com/ged/pluggability
|
4
6
|
|
5
7
|
|
6
8
|
== Description
|
7
9
|
|
8
|
-
Pluggability is a mixin module that turns an including class into a
|
9
|
-
its derivatives, capable of searching for and loading them
|
10
|
-
useful when you have an abstract base class which
|
11
|
-
functionality for a part of a larger
|
12
|
-
which implement the interface for
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
10
|
+
Pluggability is a mixin module that turns an including class into a
|
11
|
+
factory for its derivatives, capable of searching for and loading them
|
12
|
+
by name. This is useful when you have an abstract base class which
|
13
|
+
defines an interface and basic functionality for a part of a larger
|
14
|
+
system, and a collection of subclasses which implement the interface for
|
15
|
+
different underlying functionality.
|
16
|
+
|
17
|
+
An example of where this might be useful is in a program which generates
|
18
|
+
output with a 'driver' object, which provides a unified interface but
|
19
|
+
generates different kinds of output.
|
20
|
+
|
21
|
+
First the abstract base class, which is extended with Pluggability:
|
22
|
+
|
23
|
+
# in mygem/driver.rb:
|
24
|
+
require 'pluggability'
|
25
|
+
require 'mygem' unless defined?( MyGem )
|
26
|
+
|
27
|
+
class MyGem::Driver
|
28
|
+
extend Pluggability
|
29
|
+
plugin_prefixes "drivers", "drivers/compat"
|
30
|
+
end
|
31
|
+
|
32
|
+
We can have one driver that outputs PDF documents:
|
33
|
+
|
34
|
+
# mygem/drivers/pdf.rb:
|
35
|
+
require 'mygem/driver' unless defined?( MyGem::Driver )
|
36
|
+
|
37
|
+
class MyGem::Driver::PDF < Driver
|
38
|
+
...implementation...
|
39
|
+
end
|
40
|
+
|
41
|
+
and another that outputs plain ascii text:
|
42
|
+
|
43
|
+
#mygem/drivers/ascii.rb:
|
44
|
+
require 'mygem/driver' unless defined?( MyGem::Driver )
|
45
|
+
|
46
|
+
class MyGem::Driver::ASCII < Driver
|
47
|
+
...implementation...
|
48
|
+
end
|
49
|
+
|
50
|
+
Now the driver is configurable by the end-user, who can just set
|
51
|
+
it by its short name:
|
52
|
+
|
53
|
+
require 'mygem'
|
54
|
+
|
55
|
+
config[:driver_type] #=> "pdf"
|
56
|
+
driver = MyGem::Driver.create( config[:driver_type] )
|
57
|
+
driver.class #=> MyGem::Driver::PDF
|
58
|
+
|
59
|
+
# You can also pass arguments to the constructor, too:
|
60
|
+
ascii_driver = MyGem::Driver.create( :ascii, :columns => 80 )
|
61
|
+
|
59
62
|
|
60
63
|
=== How Plugins Are Loaded
|
61
64
|
|
62
|
-
The +create+ class method added to your class by Pluggability searches
|
63
|
-
module using several different strategies. It tries various
|
64
|
-
base class's name in combination with the derivative
|
65
|
-
assume we want to make a +
|
66
|
-
|
65
|
+
The +create+ class method added to your class by Pluggability searches
|
66
|
+
for your module using several different strategies. It tries various
|
67
|
+
permutations of the base class's name in combination with the derivative
|
68
|
+
requested. For example, assume we want to make a +LogReader+ base
|
69
|
+
class, and then use plugins to define readers for different log
|
70
|
+
formats:
|
71
|
+
|
72
|
+
require 'pluggability'
|
73
|
+
|
74
|
+
class LogReader
|
75
|
+
extend Pluggability
|
67
76
|
|
68
|
-
|
69
|
-
|
70
|
-
class DataDriver
|
71
|
-
include Pluggability
|
72
|
-
end
|
77
|
+
def read_from_file( path ); end
|
78
|
+
end
|
73
79
|
|
74
|
-
When you attempt to load the '
|
80
|
+
When you attempt to load the 'apache' data-driver class like so:
|
75
81
|
|
76
|
-
|
82
|
+
LogReader.create( 'apache' )
|
77
83
|
|
78
84
|
Pluggability searches for modules with the following names:
|
79
85
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
Obviously the last one will load something other than what is intended,
|
90
|
-
can also tell Pluggability that plugins should be loaded from a
|
91
|
-
declaring
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
86
|
+
'apachedatadriver'
|
87
|
+
'apache_datadriver'
|
88
|
+
'apacheLogReader'
|
89
|
+
'apache_LogReader'
|
90
|
+
'ApacheLogReader'
|
91
|
+
'Apache_LogReader'
|
92
|
+
'apache'
|
93
|
+
'Apache'
|
94
|
+
|
95
|
+
Obviously the last one will load something other than what is intended,
|
96
|
+
so you can also tell Pluggability that plugins should be loaded from a
|
97
|
+
subdirectory by declaring one or more +plugin_prefixes+ in the base
|
98
|
+
class. Each prefix will be tried (in the order they're declared) when
|
99
|
+
searching for a subclass:
|
100
|
+
|
101
|
+
class LogReader
|
102
|
+
extend Pluggability
|
103
|
+
plugin_prefixes 'drivers'
|
104
|
+
end
|
101
105
|
|
102
106
|
This will change the list that is required to:
|
103
107
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
If you return more than one subdirectory, each of them will be tried in
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
108
|
+
'drivers/apachedatadriver'
|
109
|
+
'drivers/apache_datadriver'
|
110
|
+
'drivers/apacheLogReader'
|
111
|
+
'drivers/apache_LogReader'
|
112
|
+
'drivers/ApacheLogReader'
|
113
|
+
'drivers/Apache_LogReader'
|
114
|
+
'drivers/apache'
|
115
|
+
'drivers/Apache'
|
116
|
+
|
117
|
+
If you return more than one subdirectory, each of them will be tried in
|
118
|
+
turn:
|
119
|
+
|
120
|
+
class LogReader
|
121
|
+
extend Pluggability
|
122
|
+
plugin_prefixes 'drivers', 'datadriver'
|
123
|
+
end
|
122
124
|
|
123
125
|
will change the search to include:
|
124
126
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
If the plugin is not found, a FactoryError is raised, and
|
143
|
-
all the permutations that were tried.
|
127
|
+
'drivers/apachedatadriver'
|
128
|
+
'drivers/apache_datadriver'
|
129
|
+
'drivers/apacheLogReader'
|
130
|
+
'drivers/apache_LogReader'
|
131
|
+
'drivers/ApacheLogReader'
|
132
|
+
'drivers/Apache_LogReader'
|
133
|
+
'drivers/apache'
|
134
|
+
'drivers/Apache'
|
135
|
+
'datadriver/apachedatadriver'
|
136
|
+
'datadriver/apache_datadriver'
|
137
|
+
'datadriver/apacheLogReader'
|
138
|
+
'datadriver/apache_LogReader'
|
139
|
+
'datadriver/ApacheLogReader'
|
140
|
+
'datadriver/Apache_LogReader'
|
141
|
+
'datadriver/apache'
|
142
|
+
'datadriver/Apache'
|
143
|
+
|
144
|
+
If the plugin is not found, a Pluggability::FactoryError is raised, and
|
145
|
+
the message will list all the permutations that were tried.
|
146
|
+
|
144
147
|
|
145
148
|
=== Logging
|
146
149
|
|
147
|
-
If you need a little more insight into what's going on, Pluggability
|
148
|
-
|
149
|
-
log
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
150
|
+
If you need a little more insight into what's going on, Pluggability
|
151
|
+
uses the "Loggability":https://rubygems.org/gems/loggability library.
|
152
|
+
Just set the log level to 'debug' and it'll explain what's going on:
|
153
|
+
|
154
|
+
require 'pluggability'
|
155
|
+
require 'loggability'
|
156
|
+
|
157
|
+
class LogReader
|
158
|
+
extend Pluggability
|
159
|
+
end
|
160
|
+
|
161
|
+
# Global level
|
162
|
+
Loggability.level = :debug
|
163
|
+
|
164
|
+
# Or just Pluggability's level:
|
165
|
+
Pluggability.logger.level = :debug
|
166
|
+
|
167
|
+
LogReader.create( 'ringbuffer' )
|
165
168
|
|
166
169
|
this might generate a log that looks like:
|
167
170
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
171
|
+
[...] debug {} -- Loading derivative ringbuffer
|
172
|
+
[...] debug {} -- Subdirs are: [""]
|
173
|
+
[...] debug {} -- Path is: ["ringbuffer_datadriver",
|
174
|
+
"ringbuffer_LogReader", "ringbufferdatadriver",
|
175
|
+
"ringbufferLogReader", "ringbuffer"]...
|
176
|
+
[...] debug {} -- Trying ringbuffer_datadriver...
|
177
|
+
[...] debug {} -- No module at 'ringbuffer_datadriver', trying the
|
178
|
+
next alternative: 'cannot load such file -- ringbuffer_datadriver'
|
179
|
+
[...] debug {} -- Trying ringbuffer_LogReader...
|
180
|
+
[...] debug {} -- No module at 'ringbuffer_LogReader', trying the
|
181
|
+
next alternative: 'cannot load such file -- ringbuffer_LogReader'
|
182
|
+
[...] debug {} -- Trying ringbufferdatadriver...
|
183
|
+
[...] debug {} -- No module at 'ringbufferdatadriver', trying the
|
184
|
+
next alternative: 'cannot load such file -- ringbufferdatadriver'
|
185
|
+
[...] debug {} -- Trying ringbufferLogReader...
|
186
|
+
[...] debug {} -- No module at 'ringbufferLogReader', trying the
|
187
|
+
next alternative: 'cannot load such file -- ringbufferLogReader'
|
188
|
+
[...] debug {} -- Trying ringbuffer...
|
189
|
+
[...] debug {} -- No module at 'ringbuffer', trying the next
|
190
|
+
alternative: 'cannot load such file -- ringbuffer'
|
191
|
+
[...] debug {} -- fatals = []
|
192
|
+
[...] error {} -- Couldn't find a LogReader named 'ringbuffer':
|
193
|
+
tried ["ringbuffer_datadriver", "ringbuffer_LogReader",
|
194
|
+
"ringbufferdatadriver", "ringbufferLogReader", "ringbuffer"]
|
185
195
|
|
186
196
|
|
187
197
|
== Installation
|
@@ -192,8 +202,8 @@ this might generate a log that looks like:
|
|
192
202
|
== Contributing
|
193
203
|
|
194
204
|
You can check out the current development source with Mercurial via its
|
195
|
-
{Mercurial repo}[
|
196
|
-
Git, via {its Github mirror}[https://github.com/ged/pluggability].
|
205
|
+
{Mercurial repo}[https://bitbucket.org/ged/pluggability]. Or if you
|
206
|
+
prefer Git, via {its Github mirror}[https://github.com/ged/pluggability].
|
197
207
|
|
198
208
|
After checking out the source, run:
|
199
209
|
|
data/Rakefile
CHANGED
@@ -22,6 +22,8 @@ hoespec = Hoe.spec 'pluggability' do
|
|
22
22
|
self.dependency 'hoe-deveiate', '~> 0.1', :development
|
23
23
|
|
24
24
|
self.spec_extras[:licenses] = ["BSD"]
|
25
|
+
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
26
|
+
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
25
27
|
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
26
28
|
end
|
27
29
|
|
data/lib/pluggability.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
2
3
|
|
3
4
|
require 'loggability' unless defined?( Loggability )
|
4
5
|
|
5
|
-
|
6
6
|
# The Pluggability module
|
7
7
|
module Pluggability
|
8
8
|
extend Loggability
|
@@ -12,7 +12,7 @@ module Pluggability
|
|
12
12
|
|
13
13
|
|
14
14
|
# Library version
|
15
|
-
VERSION = '0.0.
|
15
|
+
VERSION = '0.0.2'
|
16
16
|
|
17
17
|
|
18
18
|
### An exception class for Pluggability specific errors.
|
@@ -49,12 +49,8 @@ module Pluggability
|
|
49
49
|
### Return the Hash of derivative classes, keyed by various versions of
|
50
50
|
### the class name.
|
51
51
|
def derivatives
|
52
|
-
|
53
|
-
|
54
|
-
klass.instance_variables.include?( "@derivatives" )
|
55
|
-
return klass.instance_variable_get( :@derivatives )
|
56
|
-
end
|
57
|
-
end
|
52
|
+
return super unless defined?( @derivatives )
|
53
|
+
return @derivatives
|
58
54
|
end
|
59
55
|
|
60
56
|
|
@@ -83,6 +79,7 @@ module Pluggability
|
|
83
79
|
### Inheritance callback -- Register subclasses in the derivatives hash
|
84
80
|
### so that ::create knows about them.
|
85
81
|
def inherited( subclass )
|
82
|
+
Pluggability.logger.debug "%p inherited by %p" % [ self, subclass ]
|
86
83
|
keys = [ subclass ]
|
87
84
|
|
88
85
|
# If it's not an anonymous class, make some keys out of variants of its name
|
data/spec/pluggability_spec.rb
CHANGED
@@ -11,11 +11,14 @@ BEGIN {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
require 'rspec'
|
14
|
-
require 'logger'
|
15
14
|
require 'pluggability'
|
16
|
-
|
17
15
|
require 'spec/lib/helpers'
|
18
16
|
|
17
|
+
|
18
|
+
#
|
19
|
+
# Testing classes
|
20
|
+
#
|
21
|
+
|
19
22
|
class Plugin
|
20
23
|
extend Pluggability
|
21
24
|
plugin_prefixes 'plugins', 'plugins/private'
|
@@ -29,6 +32,9 @@ module Test
|
|
29
32
|
end
|
30
33
|
|
31
34
|
|
35
|
+
#
|
36
|
+
# Examples
|
37
|
+
#
|
32
38
|
describe Pluggability do
|
33
39
|
|
34
40
|
before( :each ) do
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluggability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Martin Chase
|
@@ -10,39 +9,33 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain:
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
RGVyQ0FhZ01WdURRClUwQkxtV0RGelBHR1dsUGVRQ3JZSENyK0FjSnorTlJu
|
37
|
-
YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
|
38
|
-
Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
|
39
|
-
cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
40
|
-
date: 2012-08-03 00:00:00.000000000 Z
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
|
15
|
+
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
16
|
+
HhcNMTMwMjI3MTY0ODU4WhcNMTQwMjI3MTY0ODU4WjA+MQwwCgYDVQQDDANnZWQx
|
17
|
+
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
18
|
+
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDb92mkyYwuGBg1oRxt2tkH
|
19
|
+
+Uo3LAsaL/APBfSLzy8o3+B3AUHKCjMUaVeBoZdWtMHB75X3VQlvXfZMyBxj59Vo
|
20
|
+
cDthr3zdao4HnyrzAIQf7BO5Y8KBwVD+yyXCD/N65TTwqsQnO3ie7U5/9ut1rnNr
|
21
|
+
OkOzAscMwkfQxBkXDzjvAWa6UF4c5c9kR/T79iA21kDx9+bUMentU59aCJtUcbxa
|
22
|
+
7kcKJhPEYsk4OdxR9q2dphNMFDQsIdRO8rywX5FRHvcb+qnXC17RvxLHtOjysPtp
|
23
|
+
EWsYoZMxyCDJpUqbwoeiM+tAHoz2ABMv3Ahie3Qeb6+MZNAtMmaWfBx3dg2u+/WN
|
24
|
+
AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSZ0hCV
|
25
|
+
qoHr122fGKelqffzEQBhszAcBgNVHREEFTATgRFnZWRARmFlcmllTVVELm9yZzAc
|
26
|
+
BgNVHRIEFTATgRFnZWRARmFlcmllTVVELm9yZzANBgkqhkiG9w0BAQUFAAOCAQEA
|
27
|
+
Vlcfyq6GwyE8i0QuFPCeVOwJaneSvcwx316DApjy9/tt2YD2HomLbtpXtji5QXor
|
28
|
+
ON6oln4tWBIB3Klbr3szq5oR3Rc1D02SaBTalxSndp4M6UkW9hRFu5jn98pDB4fq
|
29
|
+
5l8wMMU0Xdmqx1VYvysVAjVFVC/W4NNvlmg+2mEgSVZP5K6Tc9qDh3eMQInoYw6h
|
30
|
+
t1YA6RsUJHp5vGQyhP1x34YpLAaly8icbns/8PqOf7Osn9ztmg8bOMJCeb32eQLj
|
31
|
+
6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
|
32
|
+
/YSusaiDXHKU2O3Akc3htA==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
41
35
|
dependencies:
|
42
36
|
- !ruby/object:Gem::Dependency
|
43
37
|
name: loggability
|
44
38
|
requirement: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
39
|
requirements:
|
47
40
|
- - ~>
|
48
41
|
- !ruby/object:Gem::Version
|
@@ -50,7 +43,6 @@ dependencies:
|
|
50
43
|
type: :runtime
|
51
44
|
prerelease: false
|
52
45
|
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
46
|
requirements:
|
55
47
|
- - ~>
|
56
48
|
- !ruby/object:Gem::Version
|
@@ -58,7 +50,6 @@ dependencies:
|
|
58
50
|
- !ruby/object:Gem::Dependency
|
59
51
|
name: hoe-mercurial
|
60
52
|
requirement: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
53
|
requirements:
|
63
54
|
- - ~>
|
64
55
|
- !ruby/object:Gem::Version
|
@@ -66,7 +57,6 @@ dependencies:
|
|
66
57
|
type: :development
|
67
58
|
prerelease: false
|
68
59
|
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
60
|
requirements:
|
71
61
|
- - ~>
|
72
62
|
- !ruby/object:Gem::Version
|
@@ -74,7 +64,6 @@ dependencies:
|
|
74
64
|
- !ruby/object:Gem::Dependency
|
75
65
|
name: hoe-highline
|
76
66
|
requirement: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
67
|
requirements:
|
79
68
|
- - ~>
|
80
69
|
- !ruby/object:Gem::Version
|
@@ -82,7 +71,6 @@ dependencies:
|
|
82
71
|
type: :development
|
83
72
|
prerelease: false
|
84
73
|
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
74
|
requirements:
|
87
75
|
- - ~>
|
88
76
|
- !ruby/object:Gem::Version
|
@@ -90,7 +78,6 @@ dependencies:
|
|
90
78
|
- !ruby/object:Gem::Dependency
|
91
79
|
name: rdoc
|
92
80
|
requirement: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
81
|
requirements:
|
95
82
|
- - ~>
|
96
83
|
- !ruby/object:Gem::Version
|
@@ -98,7 +85,6 @@ dependencies:
|
|
98
85
|
type: :development
|
99
86
|
prerelease: false
|
100
87
|
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
88
|
requirements:
|
103
89
|
- - ~>
|
104
90
|
- !ruby/object:Gem::Version
|
@@ -106,7 +92,6 @@ dependencies:
|
|
106
92
|
- !ruby/object:Gem::Dependency
|
107
93
|
name: hoe-deveiate
|
108
94
|
requirement: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
95
|
requirements:
|
111
96
|
- - ~>
|
112
97
|
- !ruby/object:Gem::Version
|
@@ -114,7 +99,6 @@ dependencies:
|
|
114
99
|
type: :development
|
115
100
|
prerelease: false
|
116
101
|
version_requirements: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
102
|
requirements:
|
119
103
|
- - ~>
|
120
104
|
- !ruby/object:Gem::Version
|
@@ -122,44 +106,38 @@ dependencies:
|
|
122
106
|
- !ruby/object:Gem::Dependency
|
123
107
|
name: hoe
|
124
108
|
requirement: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
109
|
requirements:
|
127
110
|
- - ~>
|
128
111
|
- !ruby/object:Gem::Version
|
129
|
-
version: '3.
|
112
|
+
version: '3.5'
|
130
113
|
type: :development
|
131
114
|
prerelease: false
|
132
115
|
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
116
|
requirements:
|
135
117
|
- - ~>
|
136
118
|
- !ruby/object:Gem::Version
|
137
|
-
version: '3.
|
138
|
-
description:
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
Pluggability, too, you can add new drivers simply by dropping them in a
|
161
|
-
|
162
|
-
directory and using the Driver''s `create` method to instantiate them:'
|
119
|
+
version: '3.5'
|
120
|
+
description: "Pluggability is a mixin module that turns an including class into a\nfactory
|
121
|
+
for its derivatives, capable of searching for and loading them\nby name. This is
|
122
|
+
useful when you have an abstract base class which\ndefines an interface and basic
|
123
|
+
functionality for a part of a larger\nsystem, and a collection of subclasses which
|
124
|
+
implement the interface for\ndifferent underlying functionality.\n\nAn example of
|
125
|
+
where this might be useful is in a program which generates\noutput with a 'driver'
|
126
|
+
object, which provides a unified interface but\ngenerates different kinds of output.\n\nFirst
|
127
|
+
the abstract base class, which is extended with Pluggability:\n\n # in mygem/driver.rb:\n
|
128
|
+
\ require 'pluggability'\n require 'mygem' unless defined?( MyGem )\n \n
|
129
|
+
\ class MyGem::Driver\n extend Pluggability\n plugin_prefixes \"drivers\",
|
130
|
+
\"drivers/compat\"\n end\n\nWe can have one driver that outputs PDF documents:\n\n
|
131
|
+
\ # mygem/drivers/pdf.rb:\n require 'mygem/driver' unless defined?( MyGem::Driver
|
132
|
+
)\n \n class MyGem::Driver::PDF < Driver\n ...implementation...\n end\n\nand
|
133
|
+
another that outputs plain ascii text:\n\n #mygem/drivers/ascii.rb:\n require
|
134
|
+
'mygem/driver' unless defined?( MyGem::Driver )\n \n class MyGem::Driver::ASCII
|
135
|
+
< Driver\n ...implementation...\n end\n\nNow the driver is configurable
|
136
|
+
by the end-user, who can just set\nit by its short name:\n\n require 'mygem'\n
|
137
|
+
\ \n config[:driver_type] #=> \"pdf\"\n driver = MyGem::Driver.create( config[:driver_type]
|
138
|
+
)\n driver.class #=> MyGem::Driver::PDF\n\n # You can also pass arguments
|
139
|
+
to the constructor, too:\n ascii_driver = MyGem::Driver.create( :ascii, :columns
|
140
|
+
=> 80 )"
|
163
141
|
email:
|
164
142
|
- stillflame@FaerieMUD.org
|
165
143
|
- ged@FaerieMUD.org
|
@@ -179,9 +157,10 @@ files:
|
|
179
157
|
- spec/lib/helpers.rb
|
180
158
|
- spec/pluggability_spec.rb
|
181
159
|
- .gemtest
|
182
|
-
homepage:
|
160
|
+
homepage: https://bitbucket.org/ged/pluggability
|
183
161
|
licenses:
|
184
162
|
- BSD
|
163
|
+
metadata: {}
|
185
164
|
post_install_message:
|
186
165
|
rdoc_options:
|
187
166
|
- -f
|
@@ -191,22 +170,20 @@ rdoc_options:
|
|
191
170
|
require_paths:
|
192
171
|
- lib
|
193
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
-
none: false
|
195
173
|
requirements:
|
196
|
-
- -
|
174
|
+
- - '>='
|
197
175
|
- !ruby/object:Gem::Version
|
198
176
|
version: '0'
|
199
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
|
-
none: false
|
201
178
|
requirements:
|
202
|
-
- -
|
179
|
+
- - '>='
|
203
180
|
- !ruby/object:Gem::Version
|
204
181
|
version: '0'
|
205
182
|
requirements: []
|
206
183
|
rubyforge_project: pluggability
|
207
|
-
rubygems_version:
|
184
|
+
rubygems_version: 2.0.0
|
208
185
|
signing_key:
|
209
|
-
specification_version:
|
186
|
+
specification_version: 4
|
210
187
|
summary: Pluggability is a mixin module that turns an including class into a factory
|
211
188
|
for its derivatives, capable of searching for and loading them by name
|
212
189
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|