Jruby PATH and RUBYOPTS integration

Hi,
I download the last jruby version and install the rspec gem using jgem
to install.

After it, I export RUBYOPT=rubygems to guarantee that the spec can be
found.

Trying to run the spec by normal mode I got:

jonatas@branco:~/jruby-1.6.1$ jruby -S spec
LoadError: no such file to load – spec/autorun
require at org/jruby/RubyKernel.java:1038
(root) at /usr/bin/spec:2

Trying to execute directly from the original binary:
jonatas@branco:~/jruby-1.6.1$ echo $RUBYOPT
rubygems
jonatas@branco:~/jruby-1.6.1$ bin/jruby -S
lib/ruby/gems/1.8/gems/rspec-core-2.5.1/bin/rspec


Could not find ‘rspec/autorun’

This may happen if you’re using rubygems as your package manager, but
it is not
being required through some mechanism before executing the rspec
command.

You may need to do one of the following in your shell:

# for bash/zsh
export RUBYOPT=rubygems

# for csh, etc.
set RUBYOPT=rubygems

For background, please see 54177’s gists · GitHub.


How can I run rspec through jruby in this case?