Tag: Open Source Software

January 2012 Ruby on Rails Stack

Posted by – January 10, 2012

It seems like I am, entirely too frequently, setting up a new development environment for Ruby on Rails. Between the computers at work and at home I feel like I am starting over, from scratch, somewhere every 6 months or less. Whenever I make a substantial change to my development environment, I like to document it here for my own reference and in the hopes that it may help others.

This go around I am incorporating some recent additions to the stack, notably Homebrew and rbenv. These additions, as well as a few other changes are being made to simplify things and to follow the latest best practices.

The steps I followed to setup my development environment are as follows:

1. Install Homebrew – the missing package manager for OSX. Luckily I didn’t run into any issues installing Homebrew. Homebrew greatly simplifies installing some of the more difficult bits and pieces on OSX.

2. Install rbenv – This differs from my previous use of RVM. While I really liked RVM, the simplicity of rbenv convinced me to switch. Again, no real issues with installation (that is the beauty of a single purpose, simple tool). I didn’t use Homebrew to install rbenv, but in the future I will. With rbenv I also installed the companion ruby-build which simplifies the process of installing various Ruby versions.

3. Install PostgreSQL – While I am a longtime fan of MySQL, it’s acquisition by Oracle combined with the herd moving towards Postgres made me take the plunge. All in all it has been a fairly straightforward process. There is one caveat, when installing Postgres on OSX Lion (which replaced it’s bundled install of MySQL with Postgres) you need to make a minor change to the system paths so that Postgres loads from your installation and not the built in one. I followed the tips from a few blogs and updated /etc/paths, placing “/usr/local/bin” at the top. That one tip, combined with following the instructions provided by Homebrew (accessible via “brew info postgresql”) will get Postgres up an running in no time.

That is basically it! I think this is a really clean and simple install that makes my apps fairly portable. I am using Bundler to manage my Ruby Gems in conjunction with the rbenv-gemset plugin. I could just rely on Bundler, but I prefer to have the gems sandboxed in a separate gemset (for now).

After cloning from GitHub and running “bundle install” and the various rake database tasks I was up and running in development mode with relative ease. One of the wonders of the open source software community is that there seems to be a real emphasis on continuous and meaningful improvement. With each major iteration the tools I am using are becoming both more powerful and easier to use. I was able to get my development environment up and running in about an hour (less if my memory were better). That pales in comparison to some of the herculean efforts required in the past.

I think I Git it

Posted by – October 28, 2008

I just used Git for the first time and I think I finally understand what all the hullabaloo is about. Git is a distributed source control tool being used by the Linux and Ruby on Rails community.

The difference between Git and other source control systems like Subversion is that there is no need for a central repository for your source code. Your code remains completely distributed amongst the various machines and people that are working on it.
I currently use Subversion to maintain my source code, but I am thinking that I may like Git better.

UPDATE: To install Git on Mac OSX (10.5) I used the following, graciously taken from this forum post at Slicehost.

First, get the source code for the latest stable build here, then:

sudo apt-get build-dep git-core
tar xjf git-1.5.5.1.tar.bz2
cd git-1.5.5.1/
./configure
make
sudo make install

Ruby & Rails using Passenger

Posted by – July 28, 2008

I have been toying with a MySQL server at work for loading data from a legacy database and creating user accounts in Microsoft’s Active Directory. I am using linux along with MySQL, Ruby and the Rails framework. While I am certainly no über-expert at this, I am finding the task not only manageable, but altogether pleasant. My current workflow looks like this:

  1. Mount Windows share using Samba
  2. Load data into MySQL and perform a bunch of transformations on it
  3. TODO: script creation of Active Directory accounts from MySQL Database (Python??)

I found that I needed to view the data as I was testing the MySQL transformations, so I turned to Ruby and Rails. I have not had a great deal of luck in the past with configuring Apache to serve up dynamic content via Mongrel or lighty, so I decided to give Passenger a go. For those of you that are unaware, Passenger works directly with Apache and requires almost no configuration. It is dead simple to use. So, within a matter of minutes (minus the time to tweak my database to conform to the Rails conventions) I had a web site up and running to display my data as I was testing it!

Open Source Software is becoming (for me at least) a more viable solution to the problems I face than the proprietary alternatives. The wealth of information available and the relative ease with which a great deal of work can be done is amazing.