Archive for September, 2008
Installing amazon-ecs/hpricot RubyGem on Windows Operating System
1Installing rubygems that come with native extensions is not same on gnu/linux and Windows platforms as I have discovered recently. Apparently, it is important that the native extensions needed by the rubygem be built with the same compiler tool chain as your main ruby installation. The rubygem I needed to install was amazon-ecs and it depends on another rubygem called hpricot which comes with native extensions. Though hpricot installed fine on gnu/linux OS, I recieved the following errors on Windows:
Bulk updating Gem source index for: http://gems.rubyforge.org/
Building native extensions. This could take a while…
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb install hpricot
checking for stdio.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/hpricot-0.6.161 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/hpricot-0.6.161/ext/fast_xs/gem_make.out
C:\Users\tabrez>
Help on the IRC channel and some searching on the Internet provided me with the following solution: use whytheluckystiff’s repository as the source to install hpricot rubygem. Once hpricot rubygem was installed, amazon-ecs rubygem installed with no problems.
Successfully installed hpricot-0.6-x86-mswin32
1 gem installed
Installing ri documentation for hpricot-0.6-x86-mswin32…
Installing RDoc documentation for hpricot-0.6-x86-mswin32…
C:\Users\tabrez> gem install amazon-ecs
Successfully installed amazon-ecs-0.5.3
1 gem installed
Installing ri documentation for amazon-ecs-0.5.3…
Installing RDoc documentation for amazon-ecs-0.5.3…
C:\Users\tabrez>
The same source works for sandbox rubygem too.
References:
“Hello, World” Web Application in Ruby on Rails using Aptana Studio
2I am assuming that you have everything properly setup on your computer for developing applications with the Ruby on Rails framework using Aptana Studio IDE. If not, see my previous posts:
- Setting Up Rails Development Environment on Windows Vista/XP
- Setting Up Rails Development Environment using Aptana Studio
In this post I will take you through a screenshot guided tour of the Aptana Studio (RadRails) IDE and show you how to develop a blank web application using Ruby on Rails framework and add a simple scaffold to it(“Hello, World” equivalent for Rails framework). So let’s get started.
When you run the Aptana Studio application, you will see the splash screen as shown below:

To create a new Ruby on Rails project, go to File -> New -> Project… and select Rails Project from the “Rails” folder(expand it if necessary). Enter a name for the project(say “Demo1″) and click Finish.

The main window should look like the following screenshot(click to see larger version).

Below you can see the screenshots of various sections of the main window shown above:

The Project pane on the left:

The Console window at the bottom:

The Scripts window at the right(you can access the same from the “Scripts” menu too):

The Cheat Sheets window at the extreme right:

If you click the “Click to Begin” link in the cheatsheet window(shown above), you will see the following “Dynamuc Help” window with links to various Rails help topics:

Aptana Studio supports the following views that you can enable, for example to view API documentation, try out some regular expressions etc.:

At the bottom, you can click on RubyGems tab to see a list of Ruby gems:

You might be prompted to install some Ruby gems by Aptana Studio(you can install or ignore them):

RailsPlugins tab will show you the Rails plugins that you can install with a few simple mouse clicks:

RakeTasks tab allows you to perform various rake tasks by selecting the one you want from the drop-down box:

Generators tab similarly allows you to generate a scaffold, model, controller, view etc. by selecting the appropriate option from the drop-down box:

Creating a Blank Rails Web Application using Aptana Studio
Let us put the Generators tab to use. Select “Scaffold” from the “Generator” dropdown box, enter the parameters as shown in the screenshot below and press the “Go” button.

You should see the following output in the Console tab.

You should be able to see the following migration file generated in the project directory:

And here is a screenshot showing the contents of the generated migration file:

If you now run the rake tasks “db:create:all” and “db:migrate” you should be able to see the output of commands executed in the console window:

Now run the application. You should see the following output in the internal web browser of Aptana Studio:

Click on the “New Book” link and you will see the new book form like this:

You can go back to your Rails project, make edits, generate more scaffolds, models, controllers and views and test your changes in the internal browser of Aptana Studio. And so on and so forth.
Aptana Studio IDE with RadRails plugins provides one of the richest web application development environments for Ruby on Rails framework. NetBeans 6.1, emacs/vim, IntelliJ IDEA are pretty good too and all of these are multi-platform, so why bother with Mac-only solution like Textmate? ;)
Setting Up Rails Development Environment using Aptana Studio
5You first need to complete the first five steps of my earlier post “Setting Up Rails Development Environment on Windows Vista/XP” which explain how to install Ruby, RubyGems, Ruby on Rails, Mongrel web server and MySQL database server on Microsoft Winodws Vista/XP. You can skip the last two steps(sixth and seventh) of that post which describe how to setup NetBeans 6.1 IDE for development with the Rails framework; continue with this post instead which explains how to setup the Eclipse-based IDE Aptana Studio for developing web applications using the Ruby on Rails framework.
Download and Install Aptana Studio and RadRails plugin
- Download Aptana Studio IDE, run the installer and install it on your computer(or simply extract it if you downloaded the zip file).

- Run Aptana Studio. In the main window, you should see the start page of Aptana Studio(for some reason if you don’t, go to Help -> Aptana Studio Start Page…). Here you will see options to install various plugins for Aptana Studio like PHP plugin, Ruby on Rails plugin, Adobe AIR plugin etc. Click the “Install” button in the “Ruby on Rails” section.

- Select Aptana RadRails checkbox and select all the available optional features available for it.

I recommend that you leave the selected default location for installation as it is and proceed with the installation.

Once the RadRails plugin is installed, it is time to configure Ruby installation in Aptana Studio. If you haven’t installed Ruby and Ruby on Rails yet, see my previous post.
Configure Ruby/Rails in Aptana Studio
- If Ruby is installed in a location like “C:\ruby”, Aptana will automatically find the path and configure the Rails environment so you don’t have to worry about anything. If you have installed Ruby in a non-standard path where Aptana could not find it, then you need to set the path manually. To do so, go to Windows -> Preferences, expand the Ruby node in the left pane and select the Installed Interpreters item.

- Click the Add button and enter the details about your Ruby installation directory. Paths to all the other Ruby tools(e.g. rake, rails etc.) will be picked up automatically from this setting.

That’s all we need to do to get Ruby on Rails framework configured with Aptana Studio IDE. We can now create new project and check out if everything is working properly. I have made a separate post to show how to create a basic Ruby on Rails web project in Aptana Studio and run it with the help of a lot of screenshots to introduce you to the most important features of the Aptana RadRails IDE for Rails based development, so check that out for more details.
Recent Comments