Caught by gems

Hello,

I’ve set-up a new computer and I’m having troubles with gems.

In the production server and in my old developer machine works perfect,
but in the nem I’m getting errors when I start them using thin:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’: no such file to load – will_paginate
(MissingSourceFile)

gem environment

RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.4
  • RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
  • INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: /opt/local/bin/ruby
  • EXECUTABLE DIRECTORY: /opt/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-darwin-10
  • GEM PATHS:
    • /opt/local/lib/ruby/gems/1.8
    • /Users/montx/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

And I have installed the will_paginate gem in -
/opt/local/lib/ruby/gems/1.8

gem list

*** LOCAL GEMS ***

pg (0.8.0)
prawn (0.6.3)
prawn-core (0.6.3)
prawn-format (0.2.3)
prawn-layout (0.3.2)
prawn-security (0.1.1)
will_paginate (2.3.11)

What I’m missing ???

thanks,

r.

can you write the line custom_require.rb:31 here to get it solve

The error must be related to some path or similar, as if I paste de plug
in will_paginate in vendors/plugins it works …

But I believe my paths are ok, as I can find everything there …

any idea ?

thanks!

regards,

r.

On Jan 7, 7:16Â am, Raimon Fs [email protected] wrote:

Hello,

I’ve set-up a new computer and I’m having troubles with gems.

In the production server and in my old developer machine works perfect,
but in the nem I’m getting errors when I start them using thin:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in

This is the problem - you’ve got two ruby versions installed (the one
in /Library is the default Apple ruby, and the other in /opt), and the
system is deciding to use the one in /Library, which doesn’t have gems
installed, when starting thin.

You may want to check the thin startup script - what does the #! line
in it say?

–Matt J.

kannav rajeev wrote:

can you write the line custom_require.rb:31 here to get it solve

gem_original_require path

This line is from the file custom_require:

#–

Copyright 2006 by Chad F., Rich Kilmer, Jim W. 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 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) # :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

Matt J. wrote:

On Jan 7, 7:16Â am, Raimon Fs [email protected] wrote:

Hello,

I’ve set-up a new computer and I’m having troubles with gems.

In the production server and in my old developer machine works perfect,
but in the nem I’m getting errors when I start them using thin:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in

This is the problem - you’ve got two ruby versions installed (the one
in /Library is the default Apple ruby, and the other in /opt), and the
system is deciding to use the one in /Library, which doesn’t have gems
installed, when starting thin.

You may want to check the thin startup script - what does the #! line
in it say?

I can’t find the Thin startup script …

Where it is ?

thanks,

regards,

r.

On Jan 8, 3:29Â am, Raimon Fs [email protected] wrote:

Where it is ?

thanks,

regards,

Run the command ‘which thin’ to find out where it’s at.

–Matt J.

Matt J. wrote:

On Jan 8, 3:29Â am, Raimon Fs [email protected] wrote:

Where it is ?

thanks,

regards,

Run the command ‘which thin’ to find out where it’s at.

–Matt J.

I’m on OS X so I can’t use wich AFAIK …

thanks,

r.

Hassan S. wrote:

On Fri, Jan 8, 2010 at 9:45 AM, Raimon Fs [email protected] wrote:

Run the command ‘which thin’ to find out where it’s at.

I’m on OS X so I can’t use wich AFAIK …

Of course you can, and it would have taken less time to try than to
type that sentence…

sure I tried it before posting here …

as you say, it works, thanks!

/usr/bin/thin

r.

On Fri, Jan 8, 2010 at 9:45 AM, Raimon Fs [email protected] wrote:

Run the command ‘which thin’ to find out where it’s at.

I’m on OS X so I can’t use wich AFAIK …

Of course you can, and it would have taken less time to try than to
type that sentence…