faster_require 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +51 -0
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/bin/fast_require +4 -0
- data/lib/faster_require.rb +213 -0
- data/lib/rubygems_plugin.rb +5 -0
- data/spec/files/a_requires_b.rb +1 -0
- data/spec/files/attempt_double_load.rb +4 -0
- data/spec/files/b.rb +4 -0
- data/spec/files/c.rb +5 -0
- data/spec/files/d.rb +1 -0
- data/spec/files/e.rb +1 -0
- data/spec/files/fast.rb +4 -0
- data/spec/files/gem_after.rb +8 -0
- data/spec/files/gem_before.rb +9 -0
- data/spec/files/large.rb +5 -0
- data/spec/files/non_dot_rb.rb +0 -0
- data/spec/files/require_full_path.rb +6 -0
- data/spec/files/require_non_dot_rb_fails.rb +6 -0
- data/spec/files/require_twice_in_dir_pwd.rb +6 -0
- data/spec/files/requires_itself.rb +4 -0
- data/spec/files/slow.rb +3 -0
- data/spec/spec.fast_require.rb +153 -0
- metadata +122 -0
data/README
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
A little utility to make
|
2
|
+
|
3
|
+
require 'xxx'
|
4
|
+
|
5
|
+
take much less time.
|
6
|
+
|
7
|
+
Well, mostly on windows--on linux it's a speedup of only 0.41 to 0.45s, or so. [1]
|
8
|
+
|
9
|
+
If you've ever wondered why ruby feels slow on doze...sometimes it's just the startup time. This helps.
|
10
|
+
|
11
|
+
Benchmarks:
|
12
|
+
|
13
|
+
loading a spec file:
|
14
|
+
|
15
|
+
1.9.1
|
16
|
+
without 3.20s
|
17
|
+
with 0.34s (10x improvement)
|
18
|
+
|
19
|
+
1.8.6
|
20
|
+
without 3.6s
|
21
|
+
with 1.25s
|
22
|
+
|
23
|
+
|
24
|
+
rails app, running script/console "puts 333"
|
25
|
+
|
26
|
+
1.9.1
|
27
|
+
without:
|
28
|
+
20s
|
29
|
+
with:
|
30
|
+
10s
|
31
|
+
|
32
|
+
1.8.6
|
33
|
+
without:
|
34
|
+
9s
|
35
|
+
with:
|
36
|
+
6s
|
37
|
+
|
38
|
+
rake -T
|
39
|
+
|
40
|
+
1.9.1
|
41
|
+
without: 3.75s
|
42
|
+
with: 1.5s
|
43
|
+
|
44
|
+
1.8.6
|
45
|
+
without: 1.37s
|
46
|
+
with: 1.25s
|
47
|
+
|
48
|
+
Note: in reality what we should do is fix core so that it doesn't have such awful I/O time in windows. There may be some gross inefficiency in there. For now, this is a work-around.
|
49
|
+
|
50
|
+
[1] A sister project to this one, faster_gem_script, can make ruby scripts in linux run faster by 0.1s :) http://github.com/rdp/faster_gem_script
|
51
|
+
(in windows it's a much higher gain). Eventually they'll be combined into one "gem optimizer" gem.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'faster_rubygems' if RUBY_VERSION < "1.9'"
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |s|
|
4
|
+
s.name = "faster_require"
|
5
|
+
s.summary = "A tool designed to speedup library loading in Ruby by caching library locations"
|
6
|
+
s.email = "rogerdpack@gmail.com"
|
7
|
+
s.homepage = "http://github.com/rdp/faster_require"
|
8
|
+
s.authors = ["Roger Pack"]
|
9
|
+
s.add_development_dependency 'rspec'
|
10
|
+
s.add_development_dependency 'sane'
|
11
|
+
s.add_development_dependency 'ruby-prof'
|
12
|
+
# s.add_dependency
|
13
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.0
|
data/bin/fast_require
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
module FastRequire
|
2
|
+
$FAST_REQUIRE_DEBUG ||= false
|
3
|
+
|
4
|
+
def self.setup
|
5
|
+
@@dir = File.expand_path('~/.ruby_faster_require_cache')
|
6
|
+
|
7
|
+
Dir.mkdir @@dir unless File.directory?(@@dir)
|
8
|
+
@@loc = @@dir + '/' + RUBY_VERSION + '-' + RUBY_PLATFORM + '-' +
|
9
|
+
sanitize(File.expand_path($0).gsub(/[\/:]/, '_')) +
|
10
|
+
sanitize(Dir.pwd)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.sanitize filename
|
14
|
+
filename.gsub(/[\/:]/, '_')
|
15
|
+
end
|
16
|
+
|
17
|
+
FastRequire.setup
|
18
|
+
|
19
|
+
def self.load filename
|
20
|
+
@@require_locs = Marshal.restore( File.open(filename, 'rb') {|f| f.read})
|
21
|
+
end
|
22
|
+
|
23
|
+
if File.exist?(@@loc)
|
24
|
+
FastRequire.load @@loc
|
25
|
+
else
|
26
|
+
@@require_locs = {}
|
27
|
+
end
|
28
|
+
|
29
|
+
@@already_loaded = {}
|
30
|
+
|
31
|
+
# try to see where this file was loaded from, from $:
|
32
|
+
# partial_name might be abc.rb, or might be abc
|
33
|
+
# partial_name might be a full path, too
|
34
|
+
def self.guess_discover partial_name, add_dot_rb = false
|
35
|
+
|
36
|
+
# test for full path first
|
37
|
+
# unfortunately it has to be a full separate test
|
38
|
+
# for windoze sake, as drive letter could be different than slapping a '/' on the dir to test list...
|
39
|
+
tests = [partial_name]
|
40
|
+
|
41
|
+
if add_dot_rb
|
42
|
+
tests << partial_name + '.rb'
|
43
|
+
tests << partial_name + '.so'
|
44
|
+
end
|
45
|
+
|
46
|
+
tests.each{|b|
|
47
|
+
# assume that .rb.rb is...valid...
|
48
|
+
if File.file?(b) && ((b[-3..-1] == '.rb') || (b[-3..-1] == '.so'))
|
49
|
+
return File.expand_path(b)
|
50
|
+
end
|
51
|
+
}
|
52
|
+
|
53
|
+
for dir in $:
|
54
|
+
if File.file?(b = (dir + '/' + partial_name))
|
55
|
+
# make sure we require a file that has the right suffix...
|
56
|
+
if (b[-3..-1] == '.rb') || (b[-3..-1] == '.so')
|
57
|
+
return File.expand_path(b)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if add_dot_rb && (partial_name[-3..-1] != '.rb') && (partial_name[-3..-1] != '.so')
|
64
|
+
guess_discover(partial_name + '.rb') || guess_discover(partial_name + '.so')
|
65
|
+
else
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
$LOADED_FEATURES.each{|already_loaded|
|
71
|
+
# in 1.8 they might be partial paths
|
72
|
+
# in 1.9, they might be non collapsed paths
|
73
|
+
# so we have to sanitize them here...
|
74
|
+
# XXXX File.exist? is a bit too loose, here...
|
75
|
+
if File.exist?(already_loaded)
|
76
|
+
key = File.expand_path(already_loaded)
|
77
|
+
else
|
78
|
+
key = FastRequire.guess_discover(already_loaded) || already_loaded
|
79
|
+
end
|
80
|
+
@@already_loaded[key] = true
|
81
|
+
}
|
82
|
+
|
83
|
+
@@already_loaded[File.expand_path(__FILE__)] = true # this file itself isn't in loaded features, yet, but very soon will be..
|
84
|
+
# special case--I hope...
|
85
|
+
|
86
|
+
# disallow re-requiring $0
|
87
|
+
@@require_locs[$0] = File.expand_path($0) # so when we run into it on a require, we will skip it...
|
88
|
+
@@already_loaded[File.expand_path($0)] = true
|
89
|
+
|
90
|
+
|
91
|
+
# XXXX within a very long depth to require fast_require,
|
92
|
+
# require 'a' => 'b' => 'c' => 'd' & fast_require
|
93
|
+
# then
|
94
|
+
# => 'b.rb'
|
95
|
+
# it works always
|
96
|
+
|
97
|
+
def self.already_loaded
|
98
|
+
@@already_loaded
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.require_locs
|
102
|
+
@@require_locs
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.dir
|
106
|
+
@@dir
|
107
|
+
end
|
108
|
+
|
109
|
+
at_exit {
|
110
|
+
FastRequire.default_save
|
111
|
+
}
|
112
|
+
|
113
|
+
def self.default_save
|
114
|
+
self.save @@loc
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.save to_file
|
118
|
+
File.open(to_file, 'wb'){|f| f.write Marshal.dump(@@require_locs)}
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.clear_all!
|
122
|
+
require 'fileutils'
|
123
|
+
FileUtils.rm_rf @@dir if File.exist? @@dir
|
124
|
+
@@require_locs.clear
|
125
|
+
setup
|
126
|
+
end
|
127
|
+
|
128
|
+
def require_cached lib
|
129
|
+
lib = lib.to_s unless lib.is_a?(String) # might not be zactly 1.9 compat...
|
130
|
+
if known_loc = @@require_locs[lib]
|
131
|
+
return false if @@already_loaded[known_loc]
|
132
|
+
@@already_loaded[known_loc] = true
|
133
|
+
if known_loc =~ /.so$/
|
134
|
+
puts 'doing original_non_cached_require on .so full path ' + known_loc if $FAST_REQUIRE_DEBUG
|
135
|
+
original_non_cached_require known_loc # not much we can do there...too bad...
|
136
|
+
else
|
137
|
+
puts 'doing eval on ' + lib + '=>' + known_loc if $FAST_REQUIRE_DEBUG
|
138
|
+
$LOADED_FEATURES << known_loc # *must*
|
139
|
+
return eval(File.open(known_loc, 'rb') {|f| f.read}, TOPLEVEL_BINDING, known_loc) || true # note the b here--this means it's reading .rb files as binary, which *typically* works--if it breaks re-save the offending file in binary mode, or file an issue on the tracker...
|
140
|
+
end
|
141
|
+
else
|
142
|
+
# we don't know the location--let Ruby's original require do the heavy lifting for us here
|
143
|
+
old = $LOADED_FEATURES.dup
|
144
|
+
if(original_non_cached_require lib)
|
145
|
+
# debugger might land here the first time you run a script and it doesn't have a require
|
146
|
+
# cached yet...
|
147
|
+
new = $LOADED_FEATURES - old
|
148
|
+
found = new.last
|
149
|
+
|
150
|
+
# incredibly, in 1.8.6, this doesn't always get set to a full path
|
151
|
+
if RUBY_VERSION < '1.9'
|
152
|
+
if !File.file?(found)
|
153
|
+
# discover the full path.
|
154
|
+
dir = $:.find{|path| File.file?(path + '/' + found)}
|
155
|
+
found = dir + '/' + found
|
156
|
+
end
|
157
|
+
found = File.expand_path(found);
|
158
|
+
end
|
159
|
+
puts 'found new loc:' + lib + '=>' + found if $FAST_REQUIRE_DEBUG
|
160
|
+
@@require_locs[lib] = found
|
161
|
+
@@already_loaded[found] = true
|
162
|
+
return true
|
163
|
+
else
|
164
|
+
puts 'already loaded, apparently' + lib if $FAST_REQUIRE_DEBUG
|
165
|
+
# this probably was something like
|
166
|
+
# the first pass was require 'regdeferred'
|
167
|
+
# now it's a different require 'regdeferred.rb'
|
168
|
+
# which fails (or vice versa)
|
169
|
+
# so figure out why
|
170
|
+
# calc location, expand, map back
|
171
|
+
where_found = FastRequire.guess_discover(lib, true)
|
172
|
+
if where_found
|
173
|
+
puts 'inferred ghost loc:' + lib + '=>' + where_found if $FAST_REQUIRE_DEBUG
|
174
|
+
@@require_locs[lib] = where_found
|
175
|
+
# unfortunately if it's our first pass
|
176
|
+
# and we are in the middle of a "real" require
|
177
|
+
# that is circular
|
178
|
+
# then $LOADED_FEATURES or (AFAIK) nothing will have been set
|
179
|
+
# for us to be able to assert that
|
180
|
+
# so...I think we'll end up
|
181
|
+
# just fudging for a bit
|
182
|
+
# raise 'not found' unless @@already_loaded[where_found] # should have already been set...I think...
|
183
|
+
else
|
184
|
+
if $FAST_REQUIRE_DEBUG
|
185
|
+
# happens for enumerator XXXX
|
186
|
+
puts 'unable to infer' + lib + ' in ' if $FAST_REQUIRE_DEBUG
|
187
|
+
@@already_loaded[found] = true # hacky
|
188
|
+
end
|
189
|
+
end
|
190
|
+
return false # XXXX test all these return values
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.resetup!
|
196
|
+
eval "module ::Kernel; alias :require :require_cached; end"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
module Kernel
|
201
|
+
|
202
|
+
if(defined?(@already_using_faster_require))
|
203
|
+
raise 'twice not allowed...'
|
204
|
+
# *shouldn't* get here...unless I'm wrong...
|
205
|
+
else
|
206
|
+
@already_using_faster_require = true
|
207
|
+
include FastRequire
|
208
|
+
# overwrite old require...
|
209
|
+
alias :original_non_cached_require :require
|
210
|
+
FastRequire.resetup!
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'b'
|
data/spec/files/b.rb
ADDED
data/spec/files/c.rb
ADDED
data/spec/files/d.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'faster_require'
|
data/spec/files/e.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'faster_require'
|
data/spec/files/fast.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require '../lib/faster_require.rb'
|
2
|
+
require 'rubygems'
|
3
|
+
Gem::Specification
|
4
|
+
|
5
|
+
raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
6
|
+
require 'files/b.rb'
|
7
|
+
raise if(require 'files/b.rb')
|
8
|
+
raise unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
Gem::Specification
|
3
|
+
|
4
|
+
require '../lib/faster_require.rb'
|
5
|
+
|
6
|
+
raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
7
|
+
require 'files/b.rb'
|
8
|
+
raise if(require 'files/b.rb')
|
9
|
+
raise unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
data/spec/files/large.rb
ADDED
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
2
|
+
raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb') # another test, why not? :)
|
3
|
+
paths = [File.expand_path('b.rb'), File.expand_path('b')]
|
4
|
+
paths.each{|p| require p}
|
5
|
+
paths.each{|p| raise unless FastRequire.require_locs.keys.include?(p)}
|
6
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
$:.unshift 'bin'
|
2
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
3
|
+
require 'non_dot_rb.rb' # succeed
|
4
|
+
require 'non_dot_rb' # fails (well, returns false), we think it succeeds, but it in the wrong place, so when we run the second time, it loads the wrong file
|
5
|
+
|
6
|
+
# unless my gem is working right
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
2
|
+
raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb') # another test, why not? :)
|
3
|
+
require 'b.rb'
|
4
|
+
require 'b'
|
5
|
+
raise unless FastRequire.require_locs.keys.include?('b.rb') && FastRequire.require_locs.keys.include?('b')
|
6
|
+
|
data/spec/files/slow.rb
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
# $FAST_REQUIRE_DEBUG
|
2
|
+
if RUBY_VERSION < '1.9'
|
3
|
+
require 'faster_rubygems'
|
4
|
+
end
|
5
|
+
require 'sane'
|
6
|
+
|
7
|
+
cached = '.cached_spec_locs' + RUBY_VERSION
|
8
|
+
require_relative '../lib/faster_require'
|
9
|
+
# use it for our own local test specs
|
10
|
+
FastRequire.load cached if File.exist? cached
|
11
|
+
require 'spec/autorun'
|
12
|
+
require 'benchmark'
|
13
|
+
FastRequire.save cached
|
14
|
+
|
15
|
+
describe "faster requires" do
|
16
|
+
|
17
|
+
before do
|
18
|
+
FastRequire.clear_all!
|
19
|
+
@old_length = $LOADED_FEATURES.length
|
20
|
+
$b = 0
|
21
|
+
@ruby = OS.ruby_bin + " "
|
22
|
+
end
|
23
|
+
|
24
|
+
def with_file(filename = 'test')
|
25
|
+
FileUtils.touch filename + '.rb'
|
26
|
+
yield
|
27
|
+
FileUtils.rm filename + '.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to do a single require" do
|
31
|
+
Dir.chdir('files') do
|
32
|
+
old = $LOADED_FEATURES.dup
|
33
|
+
assert require('c')
|
34
|
+
assert !(require 'c')
|
35
|
+
new = $LOADED_FEATURES - old
|
36
|
+
raise new.inspect if new.length != 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should be able to go two sub-requires deep appropriately" do
|
41
|
+
Dir.chdir('files') do
|
42
|
+
assert(require('a_requires_b'))
|
43
|
+
assert !(require 'a_requires_b')
|
44
|
+
assert !(require 'a_requires_b')
|
45
|
+
$b.should == 1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be faster" do
|
50
|
+
Dir.chdir('files') do
|
51
|
+
slow = Benchmark.realtime { assert system("#{OS.ruby_bin} slow.rb")}
|
52
|
+
Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")} # warmup
|
53
|
+
fast = Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")}
|
54
|
+
pps 'fast', fast, 'slow', slow
|
55
|
+
assert fast < slow
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should work with large complex gem" do
|
60
|
+
Dir.chdir('files') do
|
61
|
+
assert(system("#{OS.ruby_bin} large.rb"))
|
62
|
+
assert(system("#{OS.ruby_bin} large.rb"))
|
63
|
+
assert(system("#{OS.ruby_bin} large.rb"))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should not re-save the cache file if it hasn't changed [?]"
|
68
|
+
|
69
|
+
it "should require .so files still, and only load them once" do
|
70
|
+
# ruby-prof gem
|
71
|
+
2.times { require 'ruby_prof'; RubyProf } # .so
|
72
|
+
assert $LOADED_FEATURES.length == (@old_length + 1)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should add requires to $LOADED_FEATURES" do
|
76
|
+
with_file('file2') {require 'file2'}
|
77
|
+
assert ($LOADED_FEATURES.grep(/file2.rb/)).length > 0
|
78
|
+
assert $LOADED_FEATURES.length == (@old_length + 1)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should save a file as a cache in a dir" do
|
82
|
+
assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
|
83
|
+
FastRequire.default_save
|
84
|
+
assert Dir[FastRequire.dir + '/*'].length > 0
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should have different caches based on the file being run, and Dir.pwd" do
|
88
|
+
# that wouldn't help much at all for ruby-prof runs, but...we do what we can
|
89
|
+
assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
|
90
|
+
Dir.chdir('files') do
|
91
|
+
assert system("ruby -I../../lib d.rb")
|
92
|
+
assert system("ruby -I../../lib e.rb")
|
93
|
+
assert system("ruby -C.. -I../lib files/e.rb")
|
94
|
+
end
|
95
|
+
assert Dir[FastRequire.dir + '/*'].length == 3
|
96
|
+
assert Dir[FastRequire.dir + '/*spec_files_d*'].length == 1 # use full path
|
97
|
+
assert Dir[FastRequire.dir + '/*spec_files_e*'].length == 2 # different dirs
|
98
|
+
end
|
99
|
+
|
100
|
+
context "should work with ascii files well" do # most are binary, so...low prio
|
101
|
+
it "could cache the converted file, if that speeds things up"
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def ruby filename
|
107
|
+
3.times { assert system(@ruby + " " + filename) }
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should override rubygems' require if rubygems is loaded after the fact...maybe by hooking to Gem::const_defined or something" do
|
111
|
+
ruby "files/gem_after.rb"
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should override rubygems' require if rubygems is loaded before the fact" do
|
115
|
+
ruby "files/gem_before.rb"
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should not double load gems" do
|
119
|
+
a = `#{@ruby} files/gem_after.rb 2>&1`
|
120
|
+
a.should_not match('already initialized')
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should throw if you require it twice" do
|
124
|
+
Dir.chdir('files') do
|
125
|
+
assert !system(@ruby + 'attempt_double_load.rb')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should force require 'abc' to not load file called exactly abc" do
|
130
|
+
Dir.chdir('files') do
|
131
|
+
ruby 'require_non_dot_rb_fails.rb'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should handle full path requires" do
|
136
|
+
Dir.chdir('files') do
|
137
|
+
ruby 'require_full_path.rb'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should handle Pathname requires, too" do
|
142
|
+
require 'pathname'
|
143
|
+
require Pathname.new('pathname')
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should work well with rubygems for gem libs (installed), themselves"
|
147
|
+
|
148
|
+
it "should disallow a file requiring itself" do
|
149
|
+
ruby 'files/requires_itself.rb'
|
150
|
+
ruby 'files/requires_itself.rb'
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faster_require
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roger Pack
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-29 00:00:00 -07:00
|
13
|
+
default_executable: fast_require
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sane
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: ruby-prof
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description:
|
46
|
+
email: rogerdpack@gmail.com
|
47
|
+
executables:
|
48
|
+
- fast_require
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README
|
53
|
+
files:
|
54
|
+
- README
|
55
|
+
- Rakefile
|
56
|
+
- VERSION
|
57
|
+
- bin/fast_require
|
58
|
+
- lib/faster_require.rb
|
59
|
+
- lib/rubygems_plugin.rb
|
60
|
+
- spec/files/a_requires_b.rb
|
61
|
+
- spec/files/attempt_double_load.rb
|
62
|
+
- spec/files/b.rb
|
63
|
+
- spec/files/c.rb
|
64
|
+
- spec/files/d.rb
|
65
|
+
- spec/files/e.rb
|
66
|
+
- spec/files/fast.rb
|
67
|
+
- spec/files/gem_after.rb
|
68
|
+
- spec/files/gem_before.rb
|
69
|
+
- spec/files/large.rb
|
70
|
+
- spec/files/non_dot_rb.rb
|
71
|
+
- spec/files/require_full_path.rb
|
72
|
+
- spec/files/require_non_dot_rb_fails.rb
|
73
|
+
- spec/files/require_twice_in_dir_pwd.rb
|
74
|
+
- spec/files/requires_itself.rb
|
75
|
+
- spec/files/slow.rb
|
76
|
+
- spec/spec.fast_require.rb
|
77
|
+
has_rdoc: true
|
78
|
+
homepage: http://github.com/rdp/faster_require
|
79
|
+
licenses: []
|
80
|
+
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options:
|
83
|
+
- --charset=UTF-8
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
version:
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: "0"
|
97
|
+
version:
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.3.5
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: A tool designed to speedup library loading in Ruby by caching library locations
|
105
|
+
test_files:
|
106
|
+
- spec/files/attempt_double_load.rb
|
107
|
+
- spec/files/a_requires_b.rb
|
108
|
+
- spec/files/b.rb
|
109
|
+
- spec/files/c.rb
|
110
|
+
- spec/files/d.rb
|
111
|
+
- spec/files/e.rb
|
112
|
+
- spec/files/fast.rb
|
113
|
+
- spec/files/gem_after.rb
|
114
|
+
- spec/files/gem_before.rb
|
115
|
+
- spec/files/large.rb
|
116
|
+
- spec/files/non_dot_rb.rb
|
117
|
+
- spec/files/requires_itself.rb
|
118
|
+
- spec/files/require_full_path.rb
|
119
|
+
- spec/files/require_non_dot_rb_fails.rb
|
120
|
+
- spec/files/require_twice_in_dir_pwd.rb
|
121
|
+
- spec/files/slow.rb
|
122
|
+
- spec/spec.fast_require.rb
|