Gem_original_require no such file to load

Hello folks, i found a strange behaviour that i really can’t explain.

I have a ruby project structured in this way

-lib -test

ruby scripts in ‘test’ have require directives like

require ‘…/lib/TSWatirIE.rb’

or

logfile =
‘…/logs/Odf_potenziale_accede_compila_anagrafica__e_diventa_odfIE.log’

Now, i’ve got my ruby scripts on ‘test’ (they are watir scripts). When i
run
them from a dos shell, or from scite, they work fine. When i try to run
them
from an ide, like RDT or netBeans ruby ide, i always come to the
following
error

C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’: no such file to load – …/lib/TSWatirIE.rb
(LoadError)

or

No such file or directory -
…/logs/Odf_potenziale_accede_compila_anagrafica__e_diventa_odfIE.log
(Errno::ENOENT)

The weird thing is that all paths work thiw way:

require ‘lib/TSWatirIE.rb’

or

logfile =
‘logs/Odf_potenziale_accede_compila_anagrafica__e_diventa_odfIE.log’

But, obviously, they don’t work in the shell environment.

Have you got any idea for this behaviour?

Thanks

Andrea M.

http://www.superandrew.it

A clever person solves a problem.
A wise person avoids it.

Einstein

Hi!

2007/10/1, Andrea M. [email protected]:

Have you got any idea for this behaviour?

Yes, I think that the IDEs add your project path to the $LOAD_PATH
variable while the ruby interpreter(used by SciTe) and irb just add
“.”(the current folder) to the load path. You can use the -I
parametre on the command line to add your project path to
$LOAD_PATH

2007/10/1, Thomas W. [email protected]:

Yes, I think that the IDEs add your project path to the $LOAD_PATH
variable while the ruby interpreter(used by SciTe) and irb just add
“.”(the current folder) to the load path. You can use the -I
parametre on the command line to add your project path to
$LOAD_PATH

Wow. That seems to be a really good and practical idea. But i noticed
that
eclipse rdt has greyed out the possibility to change the $load_path
variable, instead there is a checked flag (greyed out also), “Use
default
load_path”.

I’m gonna try to pass it as a command line argument. I’ll let you know,
thank you very much.

Andrea M.

http://www.superandrew.it

A clever person solves a problem.
A wise person avoids it.

Einstein

Thomas W. wrote:

parametre on the command line to add your project path to
$LOAD_PATH

The problem is actually that while you invoke the scripts from their own
directory, the IDE sets the current directory to the project root. As I
noticed, e.g. “require” doesn’t use the script’s own directory while
searching for libs (even when specified by relative paths), only those
listed in the load path. This path usually happens to nclude “.”, so if
your current working dir is the script’s own, you’re OK, but the IDE
sets it otherwise.

As I’ve seen in a couple of examples, it seems to be a common practice
to use

require File.dirname(FILE) + “/…/relative/path”

instead of

require “…/relative/path”

The former makes sure that the lib will be searched for relative to your
current script file.

mortee

2007/10/1, mortee [email protected]:

As I’ve seen in a couple of examples, it seems to be a common practice
to use

require File.dirname(FILE) + “/…/relative/path”

instead of

require “…/relative/path”

Phew! That’s exactly what i was searching for!

Thank you very much.

Andrea M.

http://www.superandrew.it

A clever person solves a problem.
A wise person avoids it.

Einstein

Andrea M. wrote:

2007/10/1, mortee [email protected]:

As I’ve seen in a couple of examples, it seems to be a common practice
to use

require File.dirname(FILE) + “/…/relative/path”

instead of

require “…/relative/path”

Phew! That’s exactly what i was searching for!

Thank you very much.

Andrea M.

Hi,

I’m having exactly the same problem but on a Mac. I’ve tried the
solutions mentioned here, but gem_original_require keeps getting
flagged.

Any ideas?
Thanks

Hima Kiran wrote:

`require’

I tried in google to find the problem, but no one has listed
wm/dependencies.
I also tried reinstalling all (ruby, watir and webmetrics). Please help
me out of this.

Thanks & Regards,
Kiran.

Hi Kiran
Welcome to Ruby!

I guess, you set the RUBYOPT environment variable, right? If so, I think
you should check the installed gem at first with “gem list -l”. If
everything is as expected (hopefully), then it should work out of the
box
If not, you could check the GEM-Environment with “gem env”. Maybe the
GEM_PATH is set to a global directory and gem automatically installed in
some local directory (e.g. $HOME/.gem/ruby/1.8 or something). Then you
should create/set shell environements like shown here:
http://docs.rubygems.org/read/chapter/15#page101

beste regards and good luck
ralf

Hi,
I am new to Ruby, I am trying my hands with WebMetrics with a simple
login logout script generation, which left me with the first line of the
script
require ‘wm/dependencies’
when I run this in Scite, it give the following error
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require': no such file to load -- wm/dependencies (LoadError) from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’

I tried in google to find the problem, but no one has listed
wm/dependencies.
I also tried reinstalling all (ruby, watir and webmetrics). Please help
me out of this.

Thanks & Regards,
Kiran.

This is my problem

Do you have the “bundler” gem installed?

– Matma R.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs