articles tagged with ruby

Installing your own Ruby Gems on Dreamhost

no comments yet, post one now

I came across this problem when trying to setup Capistrano on my dreamhost box.

Capistrano (orginally SwitchTower); is a standalone deployment utility that can integrate nicely with Rails. It allows you to deploy your apps across multiple servers from a subversion; Its handy for any shared environment (such as dreamhost), since you can use it to migrate databases and reset running fcgi processes.

Checking the Dreamhost Gemlist (or; gem list —local) I found that Capistrano wasnt installed – so I had to go about setting up my shared box so I could install any Gem I liked, in my home directory.

Its easier than I thought, but I had some trouble searching Google to find an answer so Im posting it up here; share the knowlegde and all that …

First up, create a new .gems folder in your home directory;

mkdir ~/.gems

Next open up your ~/.bashrc and ~/.bash_profile files and make sure to add the following lines as new environment variables;

export GEM_HOME=$HOME/.gems
export GEM_PATH=/usr/lib/ruby/gems/1.8:$GEM_HOME

Also adjust your PATH variable to include your new ~/.gems folder;

export PATH=~/bin:~/.gems/bin:$PATH

Thats basically it ! – For any gems you want to install you’ll need to grab them from somewhere online; I picked up Capistrano from here with

wget http://rubyforge.org/frs/?group_id=1420&release_id=4528

Then ran this command to install the gem (from my home dir)

gem install ~/capistrano-1.1.0.gem

Since we added the ~/.gems folder to the PATH variable in your bash files, you can simply type cap -V to check capistrano is installed.

Although this is not nessecary for Capistrano – in order to get your rails app to use other gems installed in your home directory, you first have to unpack them in RAILS_ROOT/vendor. Therefore, to be able to require them in your code, enter the RAILS_ROOT/vendor directory and do the following:

gem unpack gem_name

Rails 1.0

no comments yet, post one now

Ruby on Rails 1.0 has been released! There’s even a new website for the framework, designed by the guys at 37Signals; quoted from the site;

> 15 months after the first public release, Rails has arrived at the big 1.0. What a journey! We’ve gone through thousands of revisions, tickets, and patches from hundreds of contributors to get here. I’m incredibly proud at the core committer team, the community, and the ecosystem we’ve raised around this framework.

December 14, 2005 01:22 by

Dreamhost FCGI saga

no comments yet, post one now

After reading on nubyOnRails about stray Ruby processes – I have setup an hourly cronjob to kill all defunct Ruby processes on my dreamhost box. You may see some slight improvements in speed on this site. Now if we could only convince dreamhost to run lighttpd we’d be sorted.

Thanks nuby on rails !

the cron

# hourly - kill defunct ruby procs
01 * * * * /home/hiddenloop/crontabs/killrubyprocs

the script

#!/bin/sh
export procs="`ps x -o ppid,comm | grep "<defunct>" | sed -e "s/^[ \t]*\([0-9]*\)   ruby.*/\1/"`"
for i in $procs; do
  kill -9 $i
done

November 18, 2005 06:03 by
← (k) prev | next (j) →