ks_faster_require 0.9.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/faster_require.rb +5 -3
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
2.0.0
|
data/lib/faster_require.rb
CHANGED
@@ -14,6 +14,7 @@ require 'rbconfig' # maybe could cache this one's loc, too? probably not...
|
|
14
14
|
module FastRequire
|
15
15
|
|
16
16
|
$FAST_REQUIRE_DEBUG ||= $DEBUG # can set this via $DEBUG, or on its own previously
|
17
|
+
|
17
18
|
VERSION = File.read(File.dirname(__FILE__) + "/../VERSION")
|
18
19
|
|
19
20
|
def self.sanitize filename
|
@@ -224,12 +225,12 @@ module FastRequire
|
|
224
225
|
return false
|
225
226
|
end
|
226
227
|
@@already_loaded[known_loc] = true
|
227
|
-
if known_loc =~ /\.#{RbConfig::CONFIG['DLEXT']}$/
|
228
|
+
if known_loc =~ /\.#{RbConfig::CONFIG['DLEXT']}$/
|
228
229
|
puts 'doing original_non_cached_require on .so full path ' + known_loc if $FAST_REQUIRE_DEBUG
|
229
230
|
original_non_cached_require known_loc # not much we can do there...too bad...well at least we pass it a full path though :P
|
230
231
|
else
|
231
232
|
unless $LOADED_FEATURES.include? known_loc
|
232
|
-
if known_loc =~ /rubygems.rb$/
|
233
|
+
if known_loc =~ /rubygems.rb$/
|
233
234
|
puts 'requiring rubygems ' + lib if $FAST_REQUIRE_DEBUG
|
234
235
|
original_non_cached_require(lib) # revert to normal require so rubygems doesn't freak out when it finds itself already in $LOADED_FEATURES with rubygems > 1.6 :P
|
235
236
|
else
|
@@ -256,7 +257,8 @@ module FastRequire
|
|
256
257
|
# load(known_loc, false) # too slow
|
257
258
|
|
258
259
|
# use eval: if this fails to load breaks re-save the offending file in binary mode, or file an issue on the faster_require tracker...
|
259
|
-
contents = File.open(known_loc, 'rb:utf-8') {|f| f.read} # read only costs 0.34/10.0 s...
|
260
|
+
# contents = File.open(known_loc, 'rb:utf-8') {|f| f.read} # read only costs 0.34/10.0 s...
|
261
|
+
content = File.read(known_loc)
|
260
262
|
if contents =~ /require_relative/ # =~ is faster apparently faster than .include?
|
261
263
|
load(known_loc, false) # load is slow, but overcomes a ruby core bug: http://redmine.ruby-lang.org/issues/4487
|
262
264
|
else
|