Installing Ruby 1.8 and & 2.3.8 for ActiveSalesforce

I've been working for the past week or two on my Ruby for Developers series but have run into a few snags. First of all the ActiveSalesforce adapter doesn't work with Rails 3.0.3. There's a post on the message boards where Quinton Wall mentions that he is working with Heroku and is looking to write a new Ruby toolkit. Any newtoolkit will be REST-based and move away from the active-record model but no ETA as of now.

So my other alternative was to go the REST route since I've already done it in Java. Pat Patterson has a great Cookbook Recipe but it uses the Sinatra framework and has confusing instruction on setting up na SSL reverse proxy with different HTTP servers. Setting up SSL with Rails 3.0.3 is a breeze and since my Ruby series is already headed down that path, I decided to stick with Rails. I quickly spun up a new Rails app and started working on the OAuth dance. I had no problems authorizing my app with and returning the code, however, when trying to POST to to get my token, I received a mysterious "end of file" error. Based upon the Ruby message boards, a number of people are having struggles with OAuth so I enlisted Quinton to see if he can help me. Hopefully we'll have a Rails 3 solution soon and I can add that to my developer series.

Note: We had an Appirio AppDev CoE call with Ben Scofield (Heroku's developer advocate) last week and he suggested rolling a solution with OmniAuth. I think we are going to post a CloudSpokes contest to build this out for everyone.

So I decided to downgrade to an earlier version of Ruby and Rails so that I could use ActiveSalesforce for my developer series. I ended up (finally!) installing Ruby 1.8.7 and Rails 2.3.8 on a Ubuntu 10.10 VM. I think I could have used Ruby 1.9.2 but was caught in version hell. There are a couple of conflicting articles on how to setup your Rails environment (this one seems to be the best) but I finally got it working with a little help from the ActiveSalesforce Google Group.

Here are the steps that I went through on a fresh install of Ubuntu:

apt-get install ruby-full


tar -xvf rubygems-1.3.7.tgz

cd rubygems-1.3.7/

ruby setup.rb

ln -s /usr/bin/gem1.8 /usr/bin/gem

gem install rdoc

# install the 2.3.8 version of rails
gem install --version=2.3.8 rails --include-dependencies

# install sqlite dev lib
apt-get install libsqlite3-dev

# install rubygem
apt-get install rubygems

# install bundler
gem install Bundler

# install sqlite3
gem install sqlite3-ruby

# install rake
gem install rake

# install rforcedotcom
gem install rforcedotcom

# install the older version of facets for toolkit
gem install -v=2.8.4 facets

# install hpricot
gem install hpricot

# install the soap adapter
gem install asf-soap-adapter