Hi David, all: I just recently upgraded to Rails 2.3.1RC2 (Mac OS.X 10.5.6, ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]) and have been dilligently following the instructions for upgrading rspec and rspec- rails according to: http://wiki.github.com/dchelimsky/rspec/rails-with.... I have successfully built the rspec and rspec-rails gems, installed and unpacked them, and ran script/generate rspec successfully. 'rake spec' works fine, however 'script/spec' fails with error: $ script/spec spec script/spec:3:in `require': no such file to load -- spec (LoadError) script/spec looks like: #!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../ vendor/plugins/rspec/lib")) require 'spec' exit ::Spec::Runner::CommandLine.run and 'rake gems RAILS_ENV=test' returns: - [R] rspec >= 184.108.40.206 - [F] rspec-rails >= 220.127.116.11 - [R] rspec = 18.104.22.168 - [F] rack = 0.9.1 - [ ] cucumber >= 0.1.13 - [ ] hoe >= 1.9.0 I = Installed F = Frozen R = Framework (loaded before rails starts) rspec does not exist in vendor/gems, but rspec-rails does. It seems it's marked as 'R' which (1) I'm not certain I understand why, and (2) seems to prevent unpacking into vendor/gems. In any case, I would like to resolve the issue with script/spec. Since rspec is also not installed in vendor/plugins the LOAD_PATH line in script/spec looks odd, but I'm not sure it's the cause. Any pointers greatly appreciated. Thanks, Michael
on 2009-03-07 15:41
on 2009-03-07 16:40
On Fri, Mar 6, 2009 at 4:02 PM, rockrep <firstname.lastname@example.org> wrote: > $ script/spec spec > script/spec:3:in `require': no such file to load -- spec (LoadError) > > script/spec looks like: > #!/usr/bin/env ruby > $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../ > vendor/plugins/rspec/lib")) This bit is a bug that I plan to fix (today), but that's not the only problem here. > > I = Installed > F = Frozen > R = Framework (loaded before rails starts) > > rspec does not exist in vendor/gems, but rspec-rails does. It seems > it's marked as 'R' which (1) I'm not certain I understand why, and (2) > seems to prevent unpacking into vendor/gems. In any case, I would > like to resolve the issue with script/spec. I've seen this with older versions of lib/tasks/rspec.rake that required 'spec'. Basically, when you run any rake task in rails, rake loads up the Rakefile in the project root *and* all of the .rake files in lib/tasks before executing anything. So if any of those files require 'spec', then the rails/gems framework will consider rspec to be loaded already, and won't let you unpack it. Try this: rm lib/tasks/rspec.rake rake gems RAILS_ENV='test' If that changes rspec to [I], then you can unpack it and you should be good to go.
on 2009-03-07 18:38
On Sat, Mar 7, 2009 at 8:50 AM, David Chelimsky <email@example.com> wrote: >> 'rake spec' works fine, however 'script/spec' fails with error: >> $ script/spec spec >> script/spec:3:in `require': no such file to load -- spec (LoadError) >> >> script/spec looks like: >> #!/usr/bin/env ruby >> $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../ >> vendor/plugins/rspec/lib")) > > This bit is a bug that I plan to fix (today), but that's not the only > problem here. This fixed and pushed to github http://github.com/dchelimsky/rspec-rails/commit/cd... >> - [ ] hoe >= 1.9.0 Just an FYI about the listed dependencies - cucumber and hoe are developer dependencies of rspec, so you don't need them to run rspec. It looks like rails gem management system doesn't make that distinction, and shows all dependencies regardless of type.
on 2009-03-08 21:49
Hi David, Thanks for the quick reply, info, and patch. > > This fixed and pushed to github > > http://github.com/dchelimsky/rspec-rails/commit/cd...... > > > > rake gems RAILS_ENV='test' > > > If that changes rspec to [I], then you can unpack it and you should be > > good to go. > I tried removing rspec.rake again as suggested, but it did not help, and rspec would still not unpack using 'rake gems:unpack RAILS_ENV=test'. The rspec dependency of rspec-rails was marked as 'I', but it still had an 'R' next to the top-level rspec. I also tried removing uuidtools (and searched all the other .rake files in my source tree for references to require 'spec') to see if that had any effect since it lists a dependency on rspec, but that also did not help. I'm showing the full list of my RAILS_ENV=test gem dependencies here in case the additional info helps. - [F] uuidtools - [I] rake = 0.8.3 - [I] rspec = 22.214.171.124 - [F] faker - [F] populator - [F] mislav-will_paginate ~> 2.3.7 - [R] hpricot = 0.6.164 - [R] rspec >= 126.96.36.199 - [F] rspec-rails >= 188.8.131.52 - [I] rspec = 184.108.40.206 - [F] rack = 0.9.1 - [ ] cucumber >= 0.1.13 - [ ] hoe >= 1.9.0 On a positive note, I managed to resolve this issue by manually unpacking rspec using 'gem unpack' instead of 'rails gem:unpack'. Here are the steps I took. Maybe this will help someone else who runs into this issue. Note: config/environments/test.rb already is configured for rspec and rspec-rails as gem dependencies. * sudo gem uninstall rspec -v 220.127.116.11 * sudo gem uninstall rspec-rails -v 18.104.22.168 * re-cloned, re-built, and re-installed both rspec-22.214.171.124 and rspec- rails-126.96.36.199 to pick up your patch as described in http://wiki.github.com/dchelimsky/rspec/edge * cd RAILS_ROOT * rm lib/tasks/rspec.rake * rm -rf vendor/gems/rspec-188.8.131.52 * rm -rf vendor/gems/rspec-rails-184.108.40.206 * cd vendor/gems * sudo gem unpack rspec -v 220.127.116.11 * sudo chown -R michael:staff rspec-18.104.22.168 * cd RAILS_ROOT * rake gems:refresh_specs RAILS_ENV=test # this because gem unpack does not create a .specification file * sudo rake gems:unpack RAILS_ENV=test # unpacks rspec-rails * sudo rake gems:unpack:dependencies RAILS_ENV=test # I had already done this previously, so didn't need this step, but listed here in case someone following this hasn't yet * script/generate rspec And voila!, 'script/spec' works again! 'rake gems RAILS_ENV=test' still doesn't show rspec as 'F' which makes me slightly nervous, but everything is functional again. -Michael
on 2009-03-15 05:58
I'm having similar issues, but when I run the CMD + R command in Textmate: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- spec (LoadError) from /System/Library/Frameworks/ Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/ custom_require.rb:27:in `require' from /Users/robbyc/Library/ Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/ mate.rb:14 from /tmp/textmate-command-5945.rb:2:in `require' from /tmp/ textmate-command-5945.rb:2