pluggability 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7600ea51c42f4decce2b6402e83f70aa7b12d5c2
4
- data.tar.gz: cee2efb2884df9d5f930d6bb284d6c8e7fce3668
3
+ metadata.gz: 57a5c158471203e554e57614f2a9bfac315e5e17
4
+ data.tar.gz: 0462302cec53ea0e65b248027405a1c1ba7bef9e
5
5
  SHA512:
6
- metadata.gz: 7889a6316ded531e79c33b91f84537e0ecbd848e52f25eb51df7346d2b9d351758e4608f128c163d0e84aeb1672e7201dcc115f4c1af0bf8e86e4e12c9dcead6
7
- data.tar.gz: 0dc094f630d4dcb4b6a4ca50ea311a56c83e3980fecff63fe44f58e8b67859d7f3864d9f0191885dc643ff8f6741b6cff21b2461b687388eca440962c55079d5
6
+ metadata.gz: 2574d3c990583c90c43bacbba19738c34365070e6cd1f85daa05001c56274855923276c1d09401098cf4eb465a32e607e266fedc45596f6347f851b6a5ce8acc
7
+ data.tar.gz: 2282bb1dfcc0bc3b73df5142e396e47889e61cf6a7d32207eb0e7ab797f17fd79b3cf941204ae60f48c9f48541a27bd234a202df3473c7540ca1457e8c24ae5a
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,8 @@
1
+ == v0.4.0 [2014-01-08] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add a name attribute to plugins for introspection.
4
+
5
+
1
6
  == v0.3.0 [2013-09-25] Michael Granger <ged@FaerieMUD.org>
2
7
 
3
8
  - Add plugin exclusion patterns
@@ -12,7 +12,7 @@ module Pluggability
12
12
 
13
13
 
14
14
  # Library version
15
- VERSION = '0.3.0'
15
+ VERSION = '0.4.0'
16
16
 
17
17
 
18
18
  # An exception class for Pluggability specific errors.
@@ -143,12 +143,22 @@ module Pluggability
143
143
  Pluggability.log.debug " no name-based variants for anonymous subclass %p" % [ subclass ]
144
144
  end
145
145
 
146
- keys.compact.uniq.each do |key|
146
+ keys.compact!
147
+ keys.uniq!
148
+
149
+ # Register it under each of its name variants
150
+ keys.each do |key|
147
151
  Pluggability.log.info "Registering %s derivative of %s as %p" %
148
152
  [ subclass.name, plugin_class.name, key ]
149
153
  plugin_class.derivatives[ key ] = subclass
150
154
  end
151
155
 
156
+ # Add a name attribute to it
157
+ class << subclass
158
+ attr_reader :plugin_name
159
+ end
160
+ subclass.instance_variable_set( :@plugin_name, keys.last )
161
+
152
162
  super
153
163
  end
154
164
 
@@ -207,6 +207,10 @@ describe Pluggability do
207
207
  TestingPlugin.plugin_type
208
208
  }.to raise_error( Pluggability::PluginError, /couldn't find plugin base/i )
209
209
  end
210
+
211
+ it "knows what the simplest version of its plugin name is" do
212
+ expect( TestingPlugin.plugin_name ).to eq( 'testing' )
213
+ end
210
214
  end
211
215
 
212
216
 
@@ -220,6 +224,9 @@ describe Pluggability do
220
224
  expect( Plugin.create('black_sheep') ).to be_an_instance_of( BlackSheep )
221
225
  end
222
226
 
227
+ it "knows what the simplest version of its plugin name is" do
228
+ expect( BlackSheep.plugin_name ).to eq( 'black_sheep' )
229
+ end
223
230
  end
224
231
 
225
232
 
@@ -229,6 +236,9 @@ describe Pluggability do
229
236
  expect( Plugin.create('loadable') ).to be_an_instance_of( Test::LoadablePlugin )
230
237
  end
231
238
 
239
+ it "still knows what the simplest version of its plugin name is" do
240
+ expect( Test::LoadablePlugin.plugin_name ).to eq( 'loadable' )
241
+ end
232
242
  end
233
243
 
234
244
 
@@ -238,6 +248,9 @@ describe Pluggability do
238
248
  expect( Plugin.derivatives['subsub'] ).to eq( SubSubPlugin )
239
249
  end
240
250
 
251
+ it "still knows what the simplest version of its plugin name is" do
252
+ expect( SubSubPlugin.plugin_name ).to eq( 'subsub' )
253
+ end
241
254
  end
242
255
 
243
256
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluggability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Chase
@@ -31,7 +31,7 @@ cert_chain:
31
31
  6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
32
32
  /YSusaiDXHKU2O3Akc3htA==
33
33
  -----END CERTIFICATE-----
34
- date: 2013-09-26 00:00:00.000000000 Z
34
+ date: 2014-01-08 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: loggability
@@ -176,6 +176,7 @@ extra_rdoc_files:
176
176
  - Manifest.txt
177
177
  - README.rdoc
178
178
  files:
179
+ - .gemtest
179
180
  - ChangeLog
180
181
  - History.rdoc
181
182
  - Manifest.txt
@@ -184,7 +185,6 @@ files:
184
185
  - lib/pluggability.rb
185
186
  - spec/helpers.rb
186
187
  - spec/pluggability_spec.rb
187
- - .gemtest
188
188
  homepage: https://bitbucket.org/ged/pluggability
189
189
  licenses:
190
190
  - BSD
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project: pluggability
210
- rubygems_version: 2.1.4
210
+ rubygems_version: 2.2.1
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Pluggability is a mixin module that turns an including class into a factory
metadata.gz.sig CHANGED
Binary file