Branding
Jan
23rd
Sat
permalink

Command Line Fu… Uninstalling All Ruby Gems

The other day I found myself needing to uninstall all of the Ruby Gems on my MacBook Pro. This was triggered by two things essentially. The first and most important was that I’ve recently upgraded my OS to Snow Leopard, so all of the currently installed gems needed to be rebuilt. The second was that all of my rails projects now use Bundler, so the need to have a boat load of gems installed local to the system has decreased significantly.

My first thought was to gem uninstall each gem individually, but that’s no fun and tedious. Next I figured I would just go into the gems directory and rm -rf all of the gems. This was better, but still a manual process. Then a coworker of mine showed me some command line magic, which was by far the easiest solution to the problem. Simply execute the following in Terminal.

$ gem list | awk ‘{ print $1 }’ | xargs sudo gem uninstall -a

Thanks for the tip Jeremy.

Comments (View)

Jan
13th
Wed
permalink

MacRuby Xcode Project Templates on Snow Leopard

I’ve been wanting to test out MacRuby for some time now and finally got around to installing the latest release (0.5Beta) on my MBP.  After the installation I fired up Xcode and expected to see a few new MacRuby application templates, however they were not showing up.  After some googling I was able to find some help here, however it was Leopard specific and I’m running Snow Leopard with Xcode installed for All Users not just my own user account.

So if you’re running Snow Leopard with Xcode installed for All Users, here’s what you need to do to get the MacRuby project templates displayed via Xcode.

Move the MacRuby templates you find here —> /Library/Application Support/Developer/Shared/Xcode/Project Templates/Application

To here —> /Developer/Library/Xcode/Project Templates/Application

Restart Xcode and you should be good to go.

Comments (View)

Dec
13th
Sun
permalink

Erika Writes Copy

Launched a site for a friend yesterday… The different types of portfolio content was def a pain to deal with, but the shadowbox js library seems to do the trick.

http://erikawritescopy.com/

Comments (View)

Oct
25th
Sun
permalink

Complex Nested Forms in Rails

I’ve been working on a new project at work that involves some deeply nested forms. Anyone looking for a direction on how to approach implementing this, I would highly recommend checking out the complex-form-example apps on github.

http://github.com/ryanb/complex-form-examples

Comments (View)

Sep
14th
Mon
permalink

Working actively within git submodules

An application we built at work uses Desert as a means to combine multiple Rails apps within one parent Rails app.  Desert can be compared to Rails Engines, however at the time we began building this app we found Desert to be much more robust than Rails Engines. Since our app mainly consisted of four sub apps, all living in their own git repos, we actively used git submodules to manage everything within our parent Desert app.  This worked fairly well, however the git process for getting the workflow correct without running into various git issues took some trial and error to get right.

Now I’m sure there is a possibly a better way of doing this, however this is the process that seemed to work for me (and the rest of the team) while we actively developed this application.

YOU MAKE CHANGES TO SUBMODULE:

Within submodule (ie. parent_app/vendor/plugins/sub_app)

  1. commit
  2. push

Within main git repo (ie. parent app)

  1. commit change to submodule directory (commit id change from the commit above)
  2. push

YOU PULL CHANGES INTO SUBMODULE:

Within main git repo (ie. parent app)

  1. pull
  2. git submodule foreach git pull

This is just the basic working process pending you do not have committed but not yet pushed changes, of course pull —rebase and other basic git rules apply when doing pushes and pulls.

Comments (View)

Aug
11th
Tue
permalink

Setting up Linode (Ubuntu/Rails/Passenger)

It’s been some time since I had to personally setup a web server and I needed a refresher on the numerous steps involved.

I wasn’t able to find all the documentation I needed in one place, but I did find various pieces here and there via Google. Based off of the items I came across and a few trial and error attempts at a few things, I was able to get things up and running. Here’s the compilation of the notes I took stepping through the basic process for setting up a web server to run a Ruby on Rails applications using Passenger (mod-rails).

—————————————————————————————————-

Starting out with the base install of Ubuntu server, log in as the root user.

Create a new user (use of the root user account should limited to bare essentials):
(Lines with a $ reference a command line entry)

$ useradd <name of new user>

Add the created user to the list of users with sudo rights:

$ visudo

Login as the user account you previously created

Install essential packages needed:

$ sudo apt-get install build-essential
$ sudo apt-get install vim
$ sudo apt-get install apache2
$ sudo apt-get install wget
$ sudo apt-get install libreadline5-dev
$ sudo apt-get install mysql-server
$ sudo apt-get install apache2-prefork-dev
$ sudo apt-get install libapr1-dev

Install ruby-ee:

$ sudo wget http://rubyforge.org/frs/download.php/55510/ruby-enterprise_1.8.6-20090421_i386.deb
$ sudo dpkg -i ruby-enterprise_1.8.6-20090421_i386.deb

Append the user shell path with /opt/ruby-enterprise/bin/

Install Passenger (mod-rails)

$sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

Add the following line to /etc/apache2/mods-available/passenger.load (Note that the  passenger version may be different for you depending on the latest build)

LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.3/ext/apache2/mod_passenger.so

Add the following line to /etc/apache2/mods-available/passenger.conf

PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.3
PassengerRuby /opt/ruby-enterprise/bin/ruby

Create symlinks to the above passenger files in /etc/apache2/mods-enabled

$ sudo ln -s /etc/apache2/mods-available/passenger.conf .
$ sudo ln -s /etc/apache2/mods-available/passenger.load .

Update the apache2.conf located in /etc/apache2 to point to the public folder of your rails app

<VirtualHost *:80>
ServerName yourhost.com
ServerAlias www.yourhost.com
DocumentRoot /somewhere/public    # <— be sure to point to public!
</VirtualHost>

Restart Apache

sudo /etc/init.d/apache2 restart

And that’s it! Those are the bare basics to getting things up and running.

As a continuation of this, I recommend checking out the Passenger Users Guide for security and optimization tips and other useful information.

Comments (View)