Vendoring rspec 1.1.12 as a gem

Hi folks,

Up until now I’ve always used RSpec as a plug-in in my vendor dir, but
seeing as the gem is the endorsed way to install I decided I would try
the gem this time (still vendoring it though because I vendor
everything).

Anyone had any luck doing that?

Here’s what I did. First, to get rspec and rspec-rails on the system:

sudo gem install rspec-rails

Then add a couple lines to my config/environments/test.rb file:

config.gem ‘rspec’, :version => ‘1.1.12’
config.gem ‘rspec-rails’, :version => ‘1.1.12’

Then I tried vendoring the gems:

RAILS_ENV=test rake gems:unpack
(in /Users/wincent/app/src)
no such file to load – rspec-rails
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire’

So looks like back to plug-in for now. But still wanted to ask if
anyone had gotten this to work (this with current Rails 2.2.2).

Cheers,
Wincent

On 17 Jan 2009, at 17:06, Wincent C. wrote:

(in /Users/wincent/app/src)
no such file to load – rspec-rails
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require’

I think you might need to use something like this:

config.gem ‘rspec-rails’, :version => ‘1.1.12’, :lib => ‘spec/rails’

Matt W.
http://blog.mattwynne.net

On Sat, Jan 17, 2009 at 11:06 AM, Wincent C. [email protected]
wrote:

sudo gem install rspec-rails

Then add a couple lines to my config/environments/test.rb file:

config.gem ‘rspec’, :version => ‘1.1.12’
config.gem ‘rspec-rails’, :version => ‘1.1.12’

I just posted about this on the wiki:

http://wiki.github.com/dchelimsky/rspec-rails/configgem

Please check that out and let us know if you have any trouble.

Cheers,
David

On Sat, Jan 17, 2009 at 1:42 PM, David C. [email protected]
wrote:

Please check that out and let us know if you have any trouble.

Actually, that doesn’t address vendoring, just configuring. I have not
been able to get rspec vendored successfully yet. I wonder if anybody
has any ideas about the following:

Right now, if you do this in config/environments/test.rb:

config.gem “rspec”, :lib => false, :version => “1.1.12”
config.gem “rspec-rails”, :lib => false, :version => “1.1.12”

and then type this command:

RAILS_ENV=test rake gems

you get this output:

$ RAILS_ENV=test rake gems
(in /Users/david/projects/ruby/tmp/foo)

  • [R] rspec = 1.1.12
  • [I] rspec-rails = 1.1.12
    • [I] rspec = 1.1.12
    • [ ] cucumber >= 0.1.13
    • [ ] hoe >= 1.8.2
    • [ ] term-ansicolor >= 1.0.3
    • [ ] treetop >= 1.2.4
    • [ ] diff-lcs >= 1.1.2
    • [ ] polyglot
    • [ ] rubyforge >= 1.0.1
    • [I] rake = 0.8.3

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

That lists all of rspec’s dev dependencies (indented) - but the thing
that I don’t understand yet is the [R] indication that rspec gets
assigned. The result is that if you try to vendor rspec and
rspec-rails, it only vendors rspec-rails, not rspec.

Anybody have a grasp on why this is happening? I’d love to get this
resolved before the next release.

Thanks,
David

On Sat, Jan 17, 2009 at 11:58 AM, David C. [email protected]
wrote:

Here’s what I did. First, to get rspec and rspec-rails on the system:
http://wiki.github.com/dchelimsky/rspec-rails/configgem
config.gem “rspec-rails”, :lib => false, :version => “1.1.12”

  • [I] rspec-rails = 1.1.12
    I = Installed
    F = Frozen
    R = Framework (loaded before rails starts)

That lists all of rspec’s dev dependencies (indented) - but the thing
that I don’t understand yet is the [R] indication that rspec gets
assigned. The result is that if you try to vendor rspec and
rspec-rails, it only vendors rspec-rails, not rspec.

Anybody have a grasp on why this is happening? I’d love to get this
resolved before the next release.

Personally I think config.gem is terrible. Just unpack the gem in
vendor and then $:.unshift the lib path in test.rb or better yet,
spec_helper.rb

Pat