Chronicling My Ruby on Rails Journey

March 12, 2010

Getting PostgreSQL to install on Windows

Filed under: Database,rails,ruby rails — Bob Ngu @ 11:19 am
Tags: ,

In the effort to migrate my existing Rails app from Slicehost to Heroku, I encountered some MySQL – PostgreSQL compatibility issues, I’ll write a separate post on Heroku gotchas later. In order to debug those issues, I need to install PostgreSQL on my local Windows development machine. Did you think it’ll be trivial? Of course not, nothing open source is ever trivial on Windows…. nothing, trust me on that.

First thing first, install PostgreSQL (V8.4.2-1 as of this article’s date).

And silly me, first thing I tried was gem install postgres, not even close. A little research led me to this article to try gem install ruby-postgres. That seemed to work.

Next I tried to run rake db:create, if memory serves me correctly, I ran into this error

Can’t activate rubyforge (= 0.4.4, runtime), already activated rubyforge-1.0.0 (Gem::Exception)

To fix it, I followed the advice in this article.

From here onwards, I kept trying rake db:migrate and got several other errors for libpq.dll, libeay32.dll, ssleay32.dll, and a whole slew of other missing DLLs. According to this article, it said to

You need to go back to the postgres installer file and
copy a couple of libraries to the ruby “bin” file (for example in
c:\ruby\bin\)

* comerr32.dll
* krb5_32.dll
* libeay32.dll
* libiconv-2.dll
* libintl-2.dll
* libpq.dll
* ssleay32.dll

Don’t overwrite any files if they already exist in the ruby directory !

I tried the advice without much success because I kept getting DLL errors like missing DLLs and like

ruby.exe – Ordinal Not Found
The ordinal 284 could not be located in the dynamic link library SSLEAY32.dll.
and
The ordinal 2821 could not be located in the dynamic link library LIBEAY32.dll.

Bottom line, don’t try the advice from the above article, it is outdated and there are new DLLs added to PostgreSQL since then, restore ruby\bin to what it was if you did try. Then I came across this article saying to add C:\Program Files\PostgreSQL\8.4\bin to your Windows path which as it turns out, installing PostgreSQL didn’t do, why I have no freaking idea.

Anyway, after adding the path, I’m still getting the ordinal could not be located in the DLL errors for LIBEAY32.DLL and SSLEAY32.DLL. It turns out that those 2 DLLs support OpenSSL and my machine is littered with multiple copies of it from cygwin, Google, SVN, Ruby, Postgres, VMware, etc. It’s a freaking mess. I took a cue from from this posting and copied those 2 files from C:\Program Files\PostgreSQL\8.4\bin to C:\ruby\bin. First, rename those 2 files in C:\ruby\bin to something else just in case you need them for some other reason before you copied them from PostgreSQL.

The final thing you need to do is to change your database.yml file to something like this

development:
adapter: postgresql
database: DATABASENAME
username: YOURUSERNAME
password: YOURPASSWORD
host: localhost
encoding: UTF8

And now run rake db:create and rake db:migrate and you should be good to go. I think I got a headache writing this post.

March 8, 2010

Getting Git to work on Heroku on Windows using Putty / Plink / Pageant

Filed under: rails,ruby rails — Bob Ngu @ 8:44 pm
Tags: ,

Ok, so I have heard from several Rails developers about how much they like Heroku . One reason is that the basic version is free though you are only allowed a max of 5MB for the database. I decided to give it a try in my attempt to migrate off slicehost which I’m currently using.

Boy, I had no idea what I was in for trying to get an app uploaded (not even running yet) to Heroku. I ran into more errors that I can shake a stick at especially since I’m using Putty / Plink / Pageant to handle ssh. First off, I’m new to Git, the word in the open source community is that all the cool kids are using it and in Heroku’s case, it’s not a choice but a necessity, it’s the only way they allow you to upload code to their server.

So off I go to install Git on Windows and the first thing I suggest you do is to read this excellent post on Git on Windows install because trust me, you will be confused with what choices to accept during installation. Here are my choices

  1. Screen 1: Run Git from Windows Command Prompt
  2. Screen 2: Use [Tortoise]Plink
  3. Since I use Putty (not Tortoise), I set GIT_SSH to C:\Program Files\PuTTY\plink.exe, notice no quotes around it.

  4. Screen 3: Use Unix style line endings

Next, I installed a couple of gems

  • gem install rest-client –version 1.3.0
  • It has to be V1.3.0 (latest is V1.4.0) or else “gem install heroku” will barf on you.

  • gem install heroku

Get your Rails app ready, either create a new one or use an existing one. If you are currently using SVN with your app, I suggest you export a fresh copy to a new folder and use that instead because I have no idea if SVN and Git will play nice together in the same app.

Here’s Heroku quickstart guide on deploying an app, it’s written more for Mac / Linux developers though the basic steps are the same.

Follow these steps to get your application added to your local Git repository

  1. change folder to your app root folder
  2. git init
  3. git add .
  4. You might see a a bunch of warning messages about CRLF being replaced by LF, no biggie.

  5. git commit -m “first commit”

Next comes the tricky Putty / Plink / Pageant setup. First off, make sure you have the latest Putty version installed (V0.6), if not, you will get a nondescript error later on

Unable to read from standard input
fatal: The remote end hung up unexpectedly

Now, setup your SSH public/private keys using PuTTYgen, I used SSH-2 RSA. Once the key generation is done, click “Save private key” and save the private key to a folder of your choice, name it something like heroku_key.ppk. You can save the keys with or without a passphrase, it’s up to you, I didn’t. Next comes the public key but don’t click “Save public key”, instead open up notepad, copy and paste the public key string at the top of the PuTTYgen window and save it here

C:\documents and settings\(username)\.ssh\id_rsa.pub

Launch Pageant and add heroku_key.ppk to it. If you wish to auto launch Pageant at startup, you can add this link to Windows startup folder

“C:\Program Files\PuTTY\pageant.exe” “C:\Documents and Settings\(username)\(folder)\heroku_key.ppk” “C:\Documents and Settings\(username)\(folder)\some_other_key.ppk”

Notice that I added 2 keys to pageant upon launch, that’s because I have an existing key pair for slicehost, you only need to add the heroku_key.ppk.

To avoid getting this error when using plink,

The server’s host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server’s rsa2 key fingerprint is: ssh-rsa 2048 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
Connection abandoned.
fatal: The remote end hung up unexpectedly

Open PuTTY, in the hostname box, enter “heroku.com” and click Open. You’ll receive a prompt “The server’s host key is not cached in the registry”. Click Yes then close Putty (don’t bother trying to log in), Heroku’s host key will now be cached.

Now follow these steps to complete deploying your app to Heroku

  • heroku create
  • git push heroku master
  • heroku rake db:migrate

And you are done and you can thank me later. What a PITA to get it working on Windows but I hope this will save someone the same pain I went through.

December 6, 2009

How not to muck up your mockups

Filed under: Design — Bob Ngu @ 5:10 pm
Tags: , ,

DISCLAIMER
In exchange for a free copy of Balsamiq, I have agreed to do a review of the product. This is not a sponsored ad of the product but rather my honest opinion of what works well and what doesn’t.

As a developer, I often have to do UI mockups at various stages of development because it help crystallize the user experience and implementation. Plus it helps others who want to understand my application to see what the UI might look like and give feedback.

There are a variety of tools to help with the mockup process. On the low end, there’s pencil and paper, it’s cheap and quick but cumbersome to change and share online. On the high end, there are tools like Photoshop (proprietary and expensive) and GIMP (open source and free). While great, these high end tools have a steep learning curve and hence not ideal for me.

There are also a number of in-between tools available online on the web but somehow I never bothered to try them out, just seems like too much trouble. Balsamiq came to me as a good tool for mockups via recommendations from several other entrepreneurs and developers, so I decided to try it out.

Balsamiq is an Adobe AIR app, so it works cross platform, that’s a definite plus but if you have used AIR apps before, you also know that Adobe AIR platform is a memory hog, I hear there ‘s a 2.0 version coming out in early 2010 that claims less memory consumption but we’ll see. I have seen Balsamiq use anywhere between 50MB to 100MB on my Windows XP. That’s not too shabby because other AIR apps use considerably more memory.

The installation process is trivial though you have to install Adobe AIR if you don’t already have it on your system. To learn about the product, online help is available here. To be honest, I tried to read through the help but it was dry and taking too long, so I simply jumped in after getting a basic understanding of the app layout (picture borrowed from the site).

Balsamiq

Application Bar
Allows you to do operations on selected UI controls like cut, paste, copy, group etc, frankly I don’t use it much though it’s handy if you can’t remember the keyboard shortcuts.

UI Library
This is where I started to create a mockup. It contains a list of all the UI controls that are available to drag and drop on the mockup canvas. By default, all the UI controls are listed but you can restrict to one category by clicking on the category like Buttons, Layout, Media, Text, etc. I can also quickly find a UI control by searching the “Quick Add” area though that is not useful initially because I don’t know what UI controls are available and certainly don’t remember the names. It will be handy later after I used the product more.

Mockup Canvas
Self-explanatory, it’s where the actual mockup is done. For me doing web mockups, I started with the “Browser Window” control and dragged it to the canvas. For anyone familiar with Windows UI control, the basic operations using the mouse and keyboard apply in selecting and resizing a control. When a control is selected, there is an additional dialog box that gives me additional operations on the control, it’s faded in the background until I mouse over it. For the most part, inline editing (double click) is supported for controls that allows data entry. That’s sufficient for me to get started. Once I start experimenting more, I consult the online help page for further details. I should note that the app is designed to mimic pencil and paper mockups, it’s not meant for final or pretty UI design but for the purpose of creating mockups and getting feedback, it does a great job at it.

Parting Thoughts
Overall, I recommend the product if you can afford the $79. While that’s not cheap, it’s a good investment if you plan to use it for all your mockups. I should mention that sharing the mockups for feedback is kind of a pain. I would need to export the mockups as PNG files, upload them on some service like flickr, and send out emails or IMs to the URLs. Perhaps this is a service that the Balsamiq team can provide in the future. Also, this is a good tool for anyone (even non-techies) who wishes to do mockups because the learning curve is fairly easy.

May 28, 2009

Upgrading MySQL from 5.0.27 to 5.1.34

Filed under: Database,MySQL — Bob Ngu @ 11:18 am
Tags:

Upgrading MySQL from 5.0.x to 5.1.x is considered a major upgrade and there are some fundamental internal changes. For example, in MySQL 5.1.23 and earlier, the default location for the data files used by MySQL is located within the corresponding MySQL Server installation directory. For MySQL 5.1.24 and later, the default location of the data directory is the AppData directory configured for the user that installed the MySQL application. This means that it won’t pick up the current databases since it sits in a different location.

I followed the steps outlined in this article. In my first attempt, I thought it might be possible to have side-by-side 5.0.x and 5.1.x installations just in case the upgrade process really messed up my system. That didn’t pan out so I decided to follow the above steps exactly and first uninstall 5.0.27 and then install 5.1.34.

Here are the steps I took for a successful upgrade.

  1. First do a backup of all the current databases. “mysqldump –all-databases > alldatabases.sql”
  2. Set a new system restore point just in case something went horribly wrong.
  3. Uninstall MySQL 5.0.27 and remove the service.
  4. Download and run mysql-essential.5.1.34.msi.
  5. Run the following command to restore the database file from above
    “mysql –u root < alldatabases.sql”

And I’m up and running.

Update: As it turns out, I spoke too soon, I did get an error

“!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.”

The fix is simple enough, simply run “gem install mysql” as instructed.

Note: I read some articles saying that MySQL 5.1 upgrade had some issues with Rails 2.2 and requires an older MySQL client library, here’s an article on how to fix it. Personally, I didn’t encounter the problem.
Update: Again I spoke too soon, “rake db:create” got this error

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:202: [BUG] Segmentation fault
ruby 1.8.6 (2008-08-11) [i386-mswin32]

Applying the solution in the above article fixed it.

May 22, 2009

Upgrading Rails 2.1 to 2.3.2

Filed under: Gem,rails,ruby rails — Bob Ngu @ 7:39 am
Tags: ,

Right before upgrading Rails 2.1 to 2.3.2, I downloaded a trial version of E text editor (the power of Textmate on Windows), and in the process, it upgraded my cygwin installation.

This caused a couple of errors during my Rails upgrade.

  1. When I ran “gem install rails -y”, I got the error “ruby no such file to load ubygems loaderror”. The problem is caused by E text editor installation and the trick is to go to My Computer properties and unset RUBYOPT variable. It’s set to –rubygems, delete the variable.
  2. With that error gone, there is a new error
    c:/ruby/bin/gem:8:in `require’: no such file to load — rubygems (LoadError) from c:/ruby/bin/gem:8

    Error was also caused by E text editor installation which upgraded cygwin and installed its own version of Ruby. Since cygwin was in environment path before c:\ruby, the gem command picked up the wrong copy of ruby (cygwin has its own Ruby exe). Moving the environment cygwin variable to after c:\ruby fixed the problem.

With those 2 errors fixed, I successfully upgraded Rails to 2.3.2. Next it’s time to upgrade the gems, “gem update –system” generated this error

ERROR: While executing gem … (NameError) undefined local variable or method `remote_gemspecs’ for #

Instead, run these 2 commands to fix it

  1. gem install rubygems-update
  2. update_rubygems

As usual, there are leftover gems, so do the cleanup, run with –d (dryrun) option “gem cleanup -d” first to see what the cleanup would do, then run the cleanup “gem cleanup”. This completes the gem upgrade to 1.3.2.

May 21, 2009

Successful upgrade of Ruby 1.8.5 to 1.8.6

Filed under: rails,ruby rails — Bob Ngu @ 10:03 am
Tags:

In an earlier post, I explained why I didn’t upgrade Ruby to 1.8.6 several months ago, now I bit the bullet and completed the upgrade process, remember this is on the Windows platform which is my development machine.

First, I should mention that I did a fair amount of research as to whether I should upgrade Ruby to 1.8.7 instead and there are concerns on multiple Ruby and Rails forums that there may be backward compatibility issues with 1.8.7, so I decided to stick with 1.8.6. The concern with 1.8.7 is that it has backport of several Ruby 1.9 features causing potential compatibility issues, however there are also developers who don’t think there are any 1.8.7 compatibility issues, so do your own research and decide for yourself the version you wish to upgrade to. My plan is to stick 1.8.6 until 1.9 is certified to be compatible with Rails.

First thing I did was download ruby-1.8.6-p287-i386-mswin32.zip from a pseudo secret Ruby ftp location. This may or may not be obvious but unless someone compiles Ruby for you on Windows, you are out of luck since you don’t have the binaries. Note that it isn’t the latest patch level 368 (as of May 2009) but since I don’t have the Windows binaries for that version, I decided to stick with p287 and also not use one-click installer since it includes an older version of gems which by the way is easily remedied by issuing gem update after the installation. I also heard from Luis Lavena, the creator of the Windows Ruby one click installer, about why he decided to stick with 1.8.6 and not 1.8.7. Here’s his post explaining why he stuck with 1.8.6. BTW, he hasn’t gotten much love from developers in helping him maintain the one click installer, so let’s show him some love and appreciation, he is truly a nice guy and has been very helpful in my past interaction with him.

After downloading the zip file, unzipped the file and copied all folders on top of c:\ruby replacing existing files and folders. And it’s as simple as that to upgrade Ruby except I encountered a problem running my app after the upgrade. Note: unless you use REXML in your app, you won’t get this error and don’t need to apply patch.

I got this error

NoMethodError (private method `gsub’ called for 140:Fixnum):
c:/ruby/lib/ruby/1.8/rexml/text.rb:292:in `normalize’
c:/ruby/lib/ruby/1.8/rexml/element.rb:1085:in `[]=’
/app/controllers/application.rb:57:in `resize_videos’
c:/ruby/lib/ruby/1.8/rexml/element.rb:891:in `each’
c:/ruby/lib/ruby/1.8/rexml/xpath.rb:53:in `each’
c:/ruby/lib/ruby/1.8/rexml/element.rb:891:in `each’
c:/ruby/lib/ruby/1.8/rexml/element.rb:393:in `each_element’
/app/controllers/application.rb:56:in `resize_videos’

I posted the question on ruby-forum and got the Ruby author, Yukihiro “matz” Matsumoto, to respond with the following REXML patch

diff –git a/ChangeLog b/ChangeLog
index b5bd805..1edb627 100644
— a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu May 21 08:50:58 2009 Yukihiro Matsumoto
+
+ * lib/rexml/text.rb (REXML::Text.normalize): call to_s for input.
+ [ruby-talk:337069]
+
Mon May 18 21:40:11 2009 Tanaka Akira

* lib/pathname.rb (Pathname#sub): suppress a warning.
diff –git a/lib/rexml/text.rb b/lib/rexml/text.rb
index 2bc0042..a4a30b6 100644
— a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -286,7 +286,7 @@ module REXML
EREFERENCE = /&(?!#{Entity::NAME};)/
# Escapes all possible entities
def Text::normalize( input, doctype=nil, entity_filter=nil )
– copy = input
+ copy = input.to_s
# Doing it like this rather than in a loop improves the speed
#copy = copy.gsub( EREFERENCE, ‘&’ )
copy = copy.gsub( “&”, “&” )

According to him, this is a REXML 1.9 backport that caused the issue, not a gsub bug, and he has committed the changes to 1.8 HEAD. I applied the 1 line change to rexml/text.rb and it worked, much thanks to Matz.

And that’s the story of my successful upgrade of Ruby 1.8.5 to 1.8.6. BTW I also successfully upgraded Rails from 1.2.1 to 2.1 to 2.3.2 but that’s another post for another time.

July 2, 2008

Blueprint CSS template

Filed under: General — Bob Ngu @ 3:45 pm
Tags: ,

Admittedly, this post is slightly off-topic since it doesn’t have anything to do with Ruby or Rails but this is a common task that a do-it-all web developer (like me) has to do while building an app / site. For my current site, JiggyMe (video aggregation site), I stumbled my way through CSS hacking together with what I needed at different times and it left a less than satisfying feeling with me.

And then I came across Blueprint framework, an excerpt from the site

Blueprint is a CSS framework, which aims to cut down on your CSS development time. It gives you a solid CSS foundation to build your project on top of, with an easy-to-use grid, sensible typography, and even a stylesheet for printing.

After spending a day looking through the samples, I decided that it is a good template for my site. Blueprint CSS 101 is a good introduction post on it although it is a bit abstract especially if you aren’t a CSS expert or web designer. These are key features of Blueprint

  1. It performs a mass reset of browser default styles.
  2. It sets up sensible defaults for typography, including font families, header sizes, paragraph styles, list styles, a baseline grid, and more. It does all of this with relative sizes, so that it scales well in any browser.
  3. It gives you a methodology to use for customizable layout grids. Any number of columns and widths you can dream up is easily achievable.
  4. It provides a sensible default print stylesheet.
  5. It does all of these things in ways that work elegantly in most browsers your visitors are likely to be using, including Internet Explorer 6 and 7.

The Grid
Blueprint’s crown jewel is its grid-building tools. By default, Blueprint’s grids.css file sets up a 950px wide grid of 24 columns, each 30 pixels wide with 10 pixel gutters. This grid is likely to be flexible enough for most of your needs.

However, the grid is fully customizable. If you need more or less columns or a wider or narrower total width, you’ll want to use the Blueprint Grid CSS Generator tool. It not only provides a replacement grids.css file, but it also creates a grid.png image file for use as a background image during development—very handy for making sure everything lines up properly. The grid generator is a key piece to the framework, even if it’s technically a third-party tool. Without it, Blueprint is limiting and controlling, forcing designers to use a single layout grid. With it, designers have endless freedom.

Let’s take an example that should clarify how you can use it.
Blueprint Example

In the above code, the CSS classes from Blueprint are container, span-4, span-24, last, span-8, span-16 and it looks like this in the browser (click on the image to see the full layout).
Blueprint example in browser

Hope that’s enough to get you started with Blueprint, have fun with it.

UPDATE
Someone asked how to incorporate the CSS templates into Rails, so here are the instructions (for Windows).

First you have to download the “Blueprint 0.7.1.zip” from
http://code.google.com/p/blueprintcss/downloads/list

Unzip the file and copy the blueprint folder to your Rails app folder [yourapp]\public\stylesheets folder.

In any HTML file, for example [yourapp]\public\index.html, you have to include the following lines between the <head> tags

<link rel=”stylesheet” href=”stylesheets/blueprint/screen.css” type=”text/css” media=”screen, projection”>
<link rel=”stylesheet” href=”stylesheets/blueprint/print.css” type=”text/css” media=”print”>
<!–[if IE]><link rel=”stylesheet” href=”stylesheets/blueprint/ie.css” type=”text/css” media=”screen, projection”><![endif]–>

After that, you can use the blueprint CSS classes within the HTML code as shown above.

June 30, 2008

Switching to Aptana Studio

Filed under: rails,ruby rails,Subversion — Bob Ngu @ 3:36 pm
Tags: , ,

My IDE of choice has been RadRails 0.7.2 until now. I just switched over to Aptana Studio 1.1. Aptana has taken over the development of RadRails as Aptana Studio so I highly recommend the switch especially since Aptana Studio will be maintained and enhanced but not RadRails. For those of you with RadRails, you will like the “Check for Aptana Studio updates now…” action, something that wasn’t working for RadRails.

The first thing I did was to install the Subclipse Subversion plugin, enter the authentication credentials and I have access to my project. Next thing I did was set Aptana default workspace to my existing workspace and it imported all the settings.

Note that I am on Windows, hence why I am not using textmate. IMO, Aptana Studio is the best RoR IDE for Windows and free to boot. Enjoy!

June 29, 2008

New Ruby on Rails Windows group

Filed under: ruby rails — Bob Ngu @ 8:40 am

At the suggestion of a fellow RoR Windows developer, we thought it is a good idea to create a separate group for RoR Windows developers seeing how Windows issues tend to be rather different than Linux. Here is the new group
http://groups.google.com/group/ruby-on-rails-windows

I have also sent an email to the ruby-forum webmaster to add the group there. Please come and join us.

June 27, 2008

Upgrading to Rails 2.1 on Windows

Filed under: rails,ruby rails — Bob Ngu @ 4:13 pm

Ok, now that I have decided not to upgrade Ruby to 1.8.6, see Upgrading Ruby for details, I then moved onto upgrading Rails from 1.2.1 to 2.1, this is still on my Windows XP development machine which is treated like the bastard redheaded step child that it is:) Note that I have an existing app in Rails 1.2.1, in fact the app is frozen to Rails 1.2.1, and I have no plans of upgrading the app to Rails 2.1. I am upgrading my development environment to create a new app on Rails 2.1.

First off, different articles have slightly different ways of doing the upgrade. According to this article Migrating to Rails 2.0, it suggested the following commands (it’s the one I ended up following):

gem install rails -y
gem update --system

In another Wiki article HowToUpgrade, it recommends the following commands

sudo gem update rails -y
sudo gem update rake -y
sudo gem update activerecord -y
sudo gem update activesupport -y
sudo gem update actionpack -y
sudo gem update actionmailer -y
sudo gem update activeresource -y or possibly sudo gem install activeresource -y

Yet in another different article, Setting Up Rails Development Environment on Windows Vista/XP, it suggests… In future, whenever you want to update Rails to a newer version, simply run the following command:

C:\> gem update rails

Since I am not a Rails internals expert, I am starting to feel like the blind leading the blind here. After doing an eenie, meenie, minie, moe (not quite but close enough) to catch a mongrel by its tail (sorry couldn’t resist :P), I went with the first option.

The first command went without a hitch – this one updates Rails itself
gem install rails –y

The second command seemed to work – this ones updates RubyGems from 0.9.4 to 1.2.0
gem update --system

However, when I tried to start my existing app (it uses Mongrel), it threw an error
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — c:/ruby/lib/ruby/gems/1.8/gems/mongrel_service-0.3.2-x86-mswin32/lib/mongrel_service/init.rb (MissingSourceFile)

If I start the app using webrick, it works fine. Also, I noticed that the old Rails 1.2.1 gems are still there along with the new 2.1 gems – this is in the C:\ruby\lib\ruby\gems\1.8\gems folder. After getting some advice from the Ruby on Rails forum, I decided to do a gem cleanup with the following command
gem cleanup

Running the command gave me this

Cleaning up installed gems...
Attempting to uninstall rails-1.2.1
Successfully uninstalled rails-1.2.1
Attempting to uninstall actionmailer-1.3.1
Successfully uninstalled actionmailer-1.3.1
Attempting to uninstall activerecord-1.15.1
You have requested to uninstall the gem:
activerecord-1.15.1
actionwebservice-1.2.1 depends on [activerecord (= 1.15.1)]
rails-1.2.1 depends on [activerecord (= 1.15.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]

This was unexpected so I terminated the cleanup and did some research and found out that Rails 2.0 made a conscious decision to chuck ActionWebService (SOAP) in favor of ActiveResource (REST). Quoting from this article

ActionWebService out, ActiveResource in
It’ll probably come as no surprise that Rails has picked a side in the SOAP vs REST debate. Unless you absolutely have to use SOAP for integration purposes, we strongly discourage you from doing so. As a naturally extension of that, we’ve pulled ActionWebService from the default bundle. It’s only a gem install actionwebservice away, but it sends an important message none the less.

So the warning regarding actionwebservice makes sense since gem cleanup doesn’t know about actionwebservice for Rails 2.x. To get around the problem, I answered “Y” and proceeded. I encountered a similar prompt later and answered “Y” as well.

Attempting to uninstall fxruby-1.2.6-x86-mswin32

You have requested to uninstall the gem:
fxruby-1.2.6-x86-mswin32
fxri-0.3.3 depends on [fxruby (>= 1.2.0, < 1.3)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]

I hope nothing breaks, if you have any details about this, let me know.

Next, onto resolving the mongrel failure problem. After digging around the net, I came across Latest RubyGems and Rails is a deadly combo. As it turns out all I need to do is go into c:\ruby\lib\ruby\gems\1.8\gems and rename mongrel_service-0.3.2-mswin32 to mongrel_service-0.3.2-x86-mswin32 (note the x86 addition). Mongrel runs fine afterward.

All in all, upgrading Rails to 2.1 is a major PITA and not for the faint of heart.

Next Page »

Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.