[Rails] custom_require.rb
I've been tryng to duplicate an ancient Ruby 1.86 Rails 2.3.2 app on a brand new Linux box (over from a windows box) and have, under rpm, recreated all the gems with their corret versions.
However, when I go to invoke
ruby script/server
I am getting:
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/rails/gem_dependency.rb:99:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ruby-debug (MissingSourceFile)
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /home/user/ggrip/ggripv2/config/environments/development.rb:2:in `load_environment'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/initializer.rb:365:in `load_environment'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/initializer.rb:358:in `load_environment'
... 9 levels...
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/commands/server.rb:84
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
I'm at a loss here as to what to change to get this thing to fire up -- Im just not sure what it is telling me needs to be changed in my custom_require.rb, below, in order to start. Can someone please orient me here what I need to do? Thanks, RVic
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems'
module Kernel
##
# The Kernel#require from before RubyGems was loaded.
alias gem_original_require require
##
# When RubyGems is required, Kernel#require is replaced with our own which
# is capable of loading gems on demand.
#
# When you call <tt>require 'x'</tt>, 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 <tt>require</tt> functionality of returning false if
# that file has already been loaded is preserved.
def require(path) # :doc:
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
private :require
private :gem_original_require
end
-- However, when I go to invoke
ruby script/server
I am getting:
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/rails/gem_dependency.rb:99:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ruby-debug (MissingSourceFile)
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /home/user/ggrip/ggripv2/config/environments/development.rb:2:in `load_environment'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/initializer.rb:365:in `load_environment'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/initializer.rb:358:in `load_environment'
... 9 levels...
from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/rails-2.3.2/lib/commands/server.rb:84
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /home/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
I'm at a loss here as to what to change to get this thing to fire up -- Im just not sure what it is telling me needs to be changed in my custom_require.rb, below, in order to start. Can someone please orient me here what I need to do? Thanks, RVic
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems'
module Kernel
##
# The Kernel#require from before RubyGems was loaded.
alias gem_original_require require
##
# When RubyGems is required, Kernel#require is replaced with our own which
# is capable of loading gems on demand.
#
# When you call <tt>require 'x'</tt>, 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 <tt>require</tt> functionality of returning false if
# that file has already been loaded is preserved.
def require(path) # :doc:
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
private :require
private :gem_original_require
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/761343fa-3c4f-43d6-94ee-edd5ccc90b65%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home