Ruby 1.9 - autospec loadpath problem

Mac OSX 10.5.5(Ruby 1.8.6 installed already)

I installed Ruby 1.9.1 preview thusly:

==============================================
port install readline
cd ruby-1.9.1-preview1
./configure --program-suffix=-trunk --with-readline-dir=/usr/local
make
make install

Then move my environment over to the trunk version:

==============================================
ln -s /usr/local/bin/ruby-trunk /usr/bin/ruby
ln -s /usr/local/bin/rake-trunk /usr/bin/rake
ln -s /usr/local/bin/gem-trunk /usr/bin/gem

Then the first thing to do of course:

==============================================
gem install rspec
gem install ZenTest

all good so far

Then change into my new mail project (rewriting all the good bits of
tmail
into a 1.9 based, encoding savvy, oniguma laced, mail hooligan) and do
the
deed:

==============================================
cd ~/ruby_programs/mail
autospec

Gets me:

==============================================
[email protected] ~/ruby_programs/mail
$ autospec
/usr/local/bin/autotest:19:in load': Is a directory - /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib/autotest (Errno::EISDIR) from /usr/local/bin/autotest:19:in

Opening up /usr/local/bin/autotest shows me that line 19 says:

load ‘autotest’

Thinks… “Ah… load path problem”. so I puts a puts to see what puts:

==============================================
puts $LOAD_PATH
load ‘autotest’

And I gets:

==============================================
[email protected] ~/ruby_programs/mail
$ autospec
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/columnize-0.2/lib
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/linecache-0.43/lib
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/bin
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/ZenTest-3.11.0/bin
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/ZenTest-3.11.0/lib
/usr/local/lib/ruby-trunk/site_ruby/1.9.1
/usr/local/lib/ruby-trunk/site_ruby/1.9.1/i386-darwin9.5.0
/usr/local/lib/ruby-trunk/site_ruby
/usr/local/lib/ruby-trunk/vendor_ruby/1.9.1
/usr/local/lib/ruby-trunk/vendor_ruby/1.9.1/i386-darwin9.5.0
/usr/local/lib/ruby-trunk/vendor_ruby
/usr/local/lib/ruby-trunk/1.9.1
/usr/local/lib/ruby-trunk/1.9.1/i386-darwin9.5.0
.
loading autotest/rspec
/usr/local/lib/ruby-trunk/gems/1.9.1/gems/ZenTest-3.11.0/bin/autotest:49:in
require': /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib/autotest/rspec.rb:31: target of repeat operator is invalid: /\n(\.\/)?(.*spec\.rb):[\d]+:\Z?/ (SyntaxError) from /usr/local/lib/ruby-trunk/gems/1.9.1/gems/ZenTest-3.11.0/bin/autotest:49:in<top (required)>’
from /usr/local/bin/autotest:20:in load' from /usr/local/bin/autotest:20:in

Looking in /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib
gives:

==============================================
[email protected] ~/ruby_programs/mail
$ ls -al /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib
total 8
drwxr-xr-x 5 root wheel 170 1 Dec 09:05 .
drwxr-xr-x 19 root wheel 646 1 Dec 09:05 …
drwxr-xr-x 4 root wheel 136 1 Dec 09:05 autotest
drwxr-xr-x 21 root wheel 714 1 Dec 09:05 spec
-rw-r–r-- 1 root wheel 561 1 Dec 09:05 spec.rb

So load is trying to load autotest the directory instead of autotest the
script.

Any ideas on how to get it to load the right thing?

On Sun, Nov 30, 2008 at 4:24 PM, Mikel L. [email protected]
wrote:

gem install ZenTest

Opening up /usr/local/bin/autotest shows me that line 19 says:
$ autospec
/usr/local/lib/ruby-trunk/vendor_ruby/1.9.1/i386-darwin9.5.0
from
total 8
drwxr-xr-x 5 root wheel 170 1 Dec 09:05 .
drwxr-xr-x 19 root wheel 646 1 Dec 09:05 …
drwxr-xr-x 4 root wheel 136 1 Dec 09:05 autotest
drwxr-xr-x 21 root wheel 714 1 Dec 09:05 spec
-rw-r–r-- 1 root wheel 561 1 Dec 09:05 spec.rb

So load is trying to load autotest the directory instead of autotest the
script.
Any ideas on how to get it to load the right thing?

I’m not sure how to fix that problem, but before you go much further
you should know that RSpec does not yet run under 1.9. It’s something
I want to raise in priority soon, and patches are welcome, but that’s
the state of things today.

On Mon, Dec 01, 2008 at 03:51pm, David C. [email protected]
wrote:

script.
Any ideas on how to get it to load the right thing?

I’m not sure how to fix that problem, but before you go much further
you should know that RSpec does not yet run under 1.9. […]

I just ran across this (rspec 1.1.99.7, zentest 3.11.1, ruby 1.9.1-p0)
and
thought i’d follow up.

It appears this is related to rubygems being loaded automatically in
ruby
1.9… Cucumber (and rspec for that matter) contains an ‘autotest’
directory
under /lib and it appears earlier in the load path than the ZenTest
directories.

As evidence, running the following gets past the error:
$ ruby --disable-gems which autotest

Of course that would then necessitate activating needed gems manually,
which
seems to be counter-productive if 1.9 is encouraging the opposite
approach.

It’s not clear to me that this is a rspec or zentest bug - it might just
as
easily be a rubygems or ruby deficiency (couldn’t ‘load’ just ignore
directories?).

Unfortunately i’m not experienced enough with any of these libraries to
know
where to take this next.
If anyone would point me in a direction, i’d be happy to keep digging.

In the meantime, here’s a hack to $RUBY_HOME/bin/autotest (the one
generated
by rubygems):

@@ -19 +19,2 @@
-load ‘autotest’
+zentest_gem_dir = Gem.source_index.find_name(‘ZenTest’,
version).first.full_gem_path
+load File.join(zentest_gem_dir, ‘bin’, ‘autotest’)

That is very likely the wrong way to calculate zentest_gem_dir… I
googled and poked around but couldn’t find any definitive API. Any
enlightenment on that would also be appreciated.

Cheers,
lasitha


View this message in context:
http://www.nabble.com/Ruby-1.9---autospec-loadpath-problem-tp20763177p22102148.html
Sent from the rspec-users mailing list archive at Nabble.com.

On Thu, Feb 19, 2009 at 8:52 AM, lasitha [email protected]
wrote:

from /usr/local/bin/autotest:19:in `’

It’s not clear to me that this is a rspec or zentest bug - it might just as
easily be a rubygems or ruby deficiency (couldn’t ‘load’ just ignore
directories?).

Sounds like Autotest’s discovery process is going to need to be
revisited. rspec and rspec-rails each have their own subclasses of
Autotest, and the autotest executable decides what specific class to
load by combing the load path for “autotest/discover” - so rspec and
rspec-rails both need to have autotest directories to make that work.
Merb apps do the same.

version).first.full_gem_path
+load File.join(zentest_gem_dir, ‘bin’, ‘autotest’)

That is very likely the wrong way to calculate zentest_gem_dir… I
googled and poked around but couldn’t find any definitive API. Any
enlightenment on that would also be appreciated.

For a temp solution this seems reasonable to me. Anybody else have a
better idea?

Hi guys,

I’m getting this same error in a Ubuntu 9.04 machine.

I have Ruby 1.8.7 installed alongside Ruby 1.9.1.

When I’m on Ruby 1.9.1 and try to run the specs on a non-Rails app I get
this error:

/usr/local/bin/spec:19:in load': Is a directory - /usr/local/lib/ruby19/gems/1.9.1/gems/rspec-rails-1.2.7.1/lib/spec (Errno::EISDIR) from /usr/local/bin/spec:19:in

If I switch to Ruby 1.8.7 there is no problem.

Any ideas?

Oh, forgot to mention that if I uninstall the rspec-rails gem from my
Ruby 1.9.1 gem repository, the problem goes away, and I can run the
tests in the non-Rails app without problem.