Hello all,
I’m bekkou68.
I have a error on custom_require.rb, which occurred when I execute
rspec.
I executed the following command.
$ script/spec spec/models/
Then, I got the following result.
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’: no such file to load – application
(MissingSourceFile)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in `require’
from /home/project/vendor/plugins/rspec_on_rails/lib/spec/
rails.rb:3
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require’
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:158:in `require’
from /home/project/spec/models/…/spec_helper.rb:6
from /home/project/spec/models/eng_word_spec.rb:1:in `require’
from /home/project/spec/models/eng_word_spec.rb:1
from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:14:in `load’
from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:14:in `load_files’
from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:13:in `each’
from /home/project/vendor/plugins/rspec/lib/spec/runner/
example_group_runner.rb:13:in `load_files’
from /home/project/vendor/plugins/rspec/lib/spec/runner/
options.rb:85:in `run_examples’
from /home/project/vendor/plugins/rspec/lib/spec/runner/
command_line.rb:19:in `run’
from script/spec:4
Here is the contents of custom_require.rb.
============================== from here
==============================
#–
Copyright 2006 by Chad F., Rich Kilmer, Jim W. and others.
All rights reserved.
See LICENSE.txt for permissions.
#++
require ‘rubygems’
module Kernel
alias gem_original_require require # :nodoc:
We replace Ruby’s require with our own, which is capable of
loading gems on demand.
When you call require ‘x’, this is what happens:
* If the file can be loaded from the existing Ruby loadpath, it
is.
* Otherwise, installed gems are searched for a file that matches.
If it’s found in gem ‘y’, that gem is activated (added to the
loadpath).
The normal require functionality of returning false if
that file has already been loaded is preserved.
def require(path) # :nodoc:
gem_original_require path
rescue LoadError => load_error
if load_error.message =~ /#{Regexp.escape path}\z/ and
spec = Gem.searcher.find(path) then
Gem.activate(spec.name, “= #{spec.version}”)
gem_original_require path
else
raise load_error
end
end
end # module Kernel
============================== to here
==============================
Should I add ‘require xxx’ ?
Are they some wrong codes on custom_require.rb?
Should I update RubyGems?
I’m really happy if you help me.
Sincerely,
bekkou68