Posts Tagged ‘rails’

Installing Ruby Enterprise Edition on Mac OSX

Thursday, June 18th, 2009

This is quite trivial and very easy. I wanted to use the same version of ruby on my mac as is running on our production servers (Ruby Enterprise Edition).

Firstly, do a

gem list

and keep this information. You will need to reinstall all your gems once you have successfully installed REE.

Download REE from http://www.rubyenterpriseedition.com/

tar xvfz ruby-enterprise-X.X.X
sudo ./ruby-enterprise-X.X.X/installer

I suggest changing the default location to just /opt/ruby-enterprise – as you are unlikely to need to roll back the symbolic links in your development environment.

Once it is installed, then you need to make sure that you use it for all your gems, ruby, rake tasks. To do this we will sym link in all the executables into /usr/bin

Find any previous versions of ruby

whereis ruby

and

which ruby

Cleanup – backup and remove any old versions and the associated ruby, gems, rake, irb, cap, capify, erb so they are not on your path.

Then sym link from /usr/bin to opt/ruby-enterprise/bin with all the executables that you may require….

sudo ln -s -f /opt/ruby-enterprise/bin/ruby /usr/bin/ruby
sudo ln -s -f /opt/ruby-enterprise/bin/cap    /usr/bin/cap
sudo ln -s -f /opt/ruby-enterprise/bin/capify /usr/bin/capify
sudo ln -s -f /opt/ruby-enterprise/bin/erb    /usr/bin/erb
sudo ln -s -f /opt/ruby-enterprise/bin/gem    /usr/bin/gem
sudo ln -s -f /opt/ruby-enterprise/bin/irb    /usr/bin/irb
sudo ln -s -f /opt/ruby-enterprise/bin/rails  /usr/bin/rails
sudo ln -s -f /opt/ruby-enterprise/bin/rake   /usr/bin/rake
sudo ln -s -f /opt/ruby-enterprise/bin/rdoc   /usr/bin/rdoc

Do a gem list to see what ruby-enterprise came bundled with.

Now you will need to install all your gems again – that you noted earlier.

False-positive validation warnings

Friday, March 6th, 2009

I had been getting some validation warnings when running some of my specs. The W3 validator confirmed that my xHTML was valid.

After some googling of the problem, it turns out there is a difference between how xhtml and html documents are handled. Essentially, you need to tell the parser that the document is xHTML rather than HTML. More details here, here, and here.

The solution is to tell RSpec that the document is XML based. The options given in the links above work for RUnit based tests. Taking a look at the rspec source, it is checking to see if the response is XML based by noting the Content-Type header record. So, here's the solution I used:

Now, when I run my specs, it correctly parses the response as XHTML and passes validation without any warnings.