pluggability 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.md +5 -0
- data/lib/pluggability.rb +4 -5
- data/spec/pluggability_spec.rb +15 -15
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e23ede1e5fd763077f3a64da3b661d1f769da80c52e951d251e49bff33a20cc8
|
4
|
+
data.tar.gz: 77cc7a5f4b8454d0575ca95f3f4da6d41b6788348a5cbab058a30bda6bcc587c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e5e411c4e132b979edf119454c3c92bdc6964d25a49ad7e1571a52321b2bb9a29d91d50817138af9a6337553b3a16fc6d9703a9066bdae5a632356a2ec2353
|
7
|
+
data.tar.gz: c0e57bc0cf6f70345fe4bc247501a78d2dba35c602bfa640c54cd1e7babe74592467fb0999d91baae30ebf6b8faeef2f420486aa107aa8077df16e36456adc28
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.md
CHANGED
data/lib/pluggability.rb
CHANGED
@@ -12,7 +12,7 @@ module Pluggability
|
|
12
12
|
|
13
13
|
|
14
14
|
# Library version
|
15
|
-
VERSION = '0.
|
15
|
+
VERSION = '0.6.0'
|
16
16
|
|
17
17
|
|
18
18
|
# An exception class for Pluggability specific errors.
|
@@ -279,7 +279,7 @@ module Pluggability
|
|
279
279
|
|
280
280
|
candidates.each do |path|
|
281
281
|
next if self.is_excluded_path?( path )
|
282
|
-
Kernel.
|
282
|
+
Kernel.require( path )
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
@@ -333,8 +333,7 @@ module Pluggability
|
|
333
333
|
|
334
334
|
|
335
335
|
### Search for the module with the specified <tt>mod_name</tt>, using any
|
336
|
-
### #plugin_prefixes that have been set. Return the
|
337
|
-
### the first candidate.
|
336
|
+
### #plugin_prefixes that have been set. Return the path that was required.
|
338
337
|
def require_derivative( mod_name )
|
339
338
|
plugin_path = self.find_plugin_path( mod_name )
|
340
339
|
unless plugin_path
|
@@ -347,7 +346,7 @@ module Pluggability
|
|
347
346
|
raise Pluggability::PluginError, errmsg
|
348
347
|
end
|
349
348
|
|
350
|
-
Kernel.
|
349
|
+
Kernel.require( plugin_path.untaint )
|
351
350
|
|
352
351
|
return plugin_path
|
353
352
|
end
|
data/spec/pluggability_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe Pluggability do
|
|
51
51
|
|
52
52
|
it "returns derivatives directly if they're already loaded" do
|
53
53
|
class AlreadyLoadedPlugin < Plugin; end
|
54
|
-
expect( Kernel ).to_not receive( :
|
54
|
+
expect( Kernel ).to_not receive( :require )
|
55
55
|
expect( Plugin.create('alreadyloaded') ).to be_an_instance_of( AlreadyLoadedPlugin )
|
56
56
|
expect( Plugin.create('AlreadyLoaded') ).to be_an_instance_of( AlreadyLoadedPlugin )
|
57
57
|
expect( Plugin.create('AlreadyLoadedPlugin') ).to be_an_instance_of( AlreadyLoadedPlugin )
|
@@ -94,7 +94,7 @@ describe Pluggability do
|
|
94
94
|
expect( Gem ).to receive( :find_latest_files ).
|
95
95
|
at_least( :once ).
|
96
96
|
and_return( ['/some/path/to/plugins/dazzle.rb'] )
|
97
|
-
expect( Kernel ).to receive( :
|
97
|
+
expect( Kernel ).to receive( :require ).with( '/some/path/to/plugins/dazzle.rb' ) do |*args|
|
98
98
|
loaded_class = Class.new( Plugin )
|
99
99
|
# Simulate a named class, since we're not really requiring
|
100
100
|
Plugin.derivatives['dazzle'] = loaded_class
|
@@ -122,7 +122,7 @@ describe Pluggability do
|
|
122
122
|
expect( Gem ).to receive( :find_latest_files ).
|
123
123
|
at_least( :once ).
|
124
124
|
and_return( ['/some/path/to/corruscating.rb'] )
|
125
|
-
expect( Kernel ).to receive( :
|
125
|
+
expect( Kernel ).to receive( :require ).
|
126
126
|
with( '/some/path/to/corruscating.rb' ).
|
127
127
|
and_return( true )
|
128
128
|
|
@@ -136,7 +136,7 @@ describe Pluggability do
|
|
136
136
|
expect( Gem ).to receive( :find_latest_files ).
|
137
137
|
at_least( :once ).
|
138
138
|
and_return( ['/some/path/to/portable.rb'] )
|
139
|
-
expect( Kernel ).to receive( :
|
139
|
+
expect( Kernel ).to receive( :require ).
|
140
140
|
with( '/some/path/to/portable.rb' ).
|
141
141
|
and_raise( ScriptError.new("error while parsing path") )
|
142
142
|
|
@@ -152,8 +152,8 @@ describe Pluggability do
|
|
152
152
|
and_return( ['/some/path/to/portable', '/some/path/to/portable.rb'] )
|
153
153
|
expect( File ).to receive( :file? ).and_return( false )
|
154
154
|
|
155
|
-
expect( Kernel ).to_not receive( :
|
156
|
-
expect( Kernel ).to receive( :
|
155
|
+
expect( Kernel ).to_not receive( :require ).with( '/some/path/to/portable' )
|
156
|
+
expect( Kernel ).to receive( :require ).
|
157
157
|
with( '/some/path/to/portable.rb' ).
|
158
158
|
and_return( true )
|
159
159
|
|
@@ -169,11 +169,11 @@ describe Pluggability do
|
|
169
169
|
expect( Gem ).to receive( :find_latest_files ).with( 'plugins/private/*.rb' ).
|
170
170
|
and_return([ 'plugins/private/second.rb', 'plugins/private/third.rb' ])
|
171
171
|
|
172
|
-
expect( Kernel ).to receive( :
|
172
|
+
expect( Kernel ).to receive( :require ).with( 'plugins/first.rb' ).
|
173
173
|
and_return( true )
|
174
|
-
expect( Kernel ).to receive( :
|
174
|
+
expect( Kernel ).to receive( :require ).with( 'plugins/private/second.rb' ).
|
175
175
|
and_return( true )
|
176
|
-
expect( Kernel ).to receive( :
|
176
|
+
expect( Kernel ).to receive( :require ).with( 'plugins/private/third.rb' ).
|
177
177
|
and_return( true )
|
178
178
|
|
179
179
|
Plugin.load_all
|
@@ -185,10 +185,10 @@ describe Pluggability do
|
|
185
185
|
expect( Gem ).to receive( :find_latest_files ).with( 'plugins/private/*.rb' ).
|
186
186
|
and_return([ '/path/to/plugins/private/second.rb', '/path/to/plugins/private/third.rb' ])
|
187
187
|
|
188
|
-
expect( Kernel ).to receive( :
|
188
|
+
expect( Kernel ).to receive( :require ).with( '/path/to/plugins/first.rb' ).
|
189
189
|
and_return( true )
|
190
|
-
expect( Kernel ).to_not receive( :
|
191
|
-
expect( Kernel ).to_not receive( :
|
190
|
+
expect( Kernel ).to_not receive( :require ).with( '/path/to/plugins/private/second.rb' )
|
191
|
+
expect( Kernel ).to_not receive( :require ).with( '/path/to/plugins/private/third.rb' )
|
192
192
|
|
193
193
|
Plugin.plugin_exclusions( %r{/private} )
|
194
194
|
Plugin.load_all
|
@@ -201,11 +201,11 @@ describe Pluggability do
|
|
201
201
|
expect( Gem ).to receive( :find_latest_files ).with( 'plugins/private/*.rb' ).
|
202
202
|
and_return([ 'plugins/private/second.rb', 'plugins/private/third.rb' ])
|
203
203
|
|
204
|
-
expect( Kernel ).to receive( :
|
204
|
+
expect( Kernel ).to receive( :require ).with( 'plugins/first.rb' ).
|
205
205
|
and_return( true )
|
206
|
-
expect( Kernel ).to receive( :
|
206
|
+
expect( Kernel ).to receive( :require ).with( 'plugins/private/second.rb' ).
|
207
207
|
and_return( true )
|
208
|
-
expect( Kernel ).to_not receive( :
|
208
|
+
expect( Kernel ).to_not receive( :require ).with( 'plugins/private/third.rb' )
|
209
209
|
|
210
210
|
Plugin.plugin_exclusions( '**/third.rb' )
|
211
211
|
Plugin.load_all
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Chase
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
37
37
|
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2018-
|
39
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: loggability
|
metadata.gz.sig
CHANGED
Binary file
|