I'm a 35'ish year old web application developer from South Portland, Maine. I love meeting fellow techies, drop me a line if you want to talk shop.
Posted on 03/13/2009 at 06:58 PM
Update: See comments for resolution to a Nokogiri dependency issue.
Install the gems:
sudo gem install rails --source http://gems.rubyonrails.org
sudo gem install dchelimsky-rspec
sudo gem install dchelimsky-rspec-rails
sudo gem install cucumber
sudo gem install webrat
Create your app:
rails myapp
cd myapp
Freeze Rails to vendor:
rake rails:freeze:edge
Manage your gem dependencies through rails, edit config/environments/test.rb. Add the following lines:
config.gem "dchelimsky-rspec", :lib => false, :version => ">= 1.1.99.13"
config.gem "dchelimsky-rspec-rails", :lib => false, :version => ">= 1.1.99.13"
config.gem 'aslakhellesoy-cucumber', :lib => false, :version => ">= 0.1.99.23
config.gem 'webrat', :lib => false
Unpack your gems:
rake gems:unpack RAILS_ENV=test
rake gems:unpack:dependencies RAILS_ENV=test
And generate your testing folders:
script/generate rspec
script/generate cucumber
That’s it, have fun.
Also, I believe I had to install the macports version of libxml2 as universal.
sudo port install libxml2 +universal
as seen here:
With some coaxing from technicalpickles in IRC, I’ve just realized that its bad form to vendor native gems ... I’m going to try and un-vendor Nokogiri and see if everything still works as expected.
Just out of curiosity, what reasons did technicalpickles give for it being bad form to vendor native gems?
Oh, wait. One reason just came to me… if I vendor a native extension built on OS X and deploy that app to Ubuntu there might be problems.
Just noticed:
rake gems:build # Build any native extensions for unpacked gems
So, as long as we run this on deployment it shouldn’t be a problem to vendor gems with native extensions.
Did technicalpickles give any other reasons?
That was the only reason I’ve found as well. FYI with the current version of rails you no longer need those specific gem versions in the dchelimsky- and aslakhellesoy- namespaces.
Often times I will release code for free or go that extra distance to help others online. If my skills were useful to you, please consider a small donation. Thank you very much.
@ github.com
@ twitter.com
@ calendaraboutnothing
Foundation's Edge, RJones Family, We're Not.com (only for staging), Ailee Jones (same as rjones for now)
Aaron, Barnaby, Brian, Chris, Dirk, Frank, Four, Justin, Matt, Mike, Monty, Paul, Sean, Travis
I can usually be found lounging on irc.freenode.net while I work, on the following channels: #fauna, #github, #hello-heroku, #jquery, #passenger, #ruby, #rubyonrails, #slicehost, #sproutcore, #textmate, #werenot.
I ran into one issue after I wrote this.
Nokogiri 1.2.0+ is a gem dependency for Webrat. I already had Nokogiri 1.2.1 installed on my systems /Library gems folder ... and I even unpacked it as a dependency to my apps vendor directory, BUT running ... rake features ... every time resulted in a:
MissingSourceFile: no such file to load—nokogiri/native
For some odd reason, when you unpack Nokogiri from your system to your vendor directory, it copies the gem ... but DOESN’T copy a file called native.bundle. So, I dug into my systems gem folder in:
/Library/Ruby/Gems/1.8/gems/nokogiri-1.2.1
Deep in its /lib folder you will find the ‘native.bundle’ file. Copying the file as-is to the appropriate place in my vendors gem folder made rake features not complain anymore. I generated 2 test afterwards to prove everything was working.
I hope that extra info is of use to someone, it was a real pain to track down.