Nicolas Alpi, Web developer

A blog about productivity, startups and me.

2009 Rubyist's Guide to Linux Development Environment

After resintalling my workstation on Ubuntu Jaunty (for using EXT4), I had to reinstall my development softwares.


Using Giantrobot 2009 Rubyit’s guide to Mac Os development as a guideline for this post, I’ll present here my current Linux configutation for Ruby development.


Also opinionated (Gedit over Netbeans), this configuration suit all my need for developing everyday. (And NO I don’t need / want a Mac Os!)



Git


Install git and gitk (Repository vislulizer)





sudo apt-get intall git-core gitk

If you want to display the current git branch on your bash, just copy the content of this gist in ~/.bashrc

git terminal

SSH

I also need a public keygen to access public repo

ssh-keygen

And press enter till the end. Now you have your key stored in ~/.ssh/id_rsa.pub
h2. LAMR => Linux, Apache, Mysql, Ror

Ruby

Install all you need with ruby in one line

sudo apt-get install ruby-full build-essential

Rubygems

First install Rubygem:

$ cd ~

$ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.2.tgz
$ tar xzvf rubygems-1.3.2.tgz
$ cd rubygems-1.3.2
$ sudo ruby setup.rb
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Then add the github gem source

sudo gem source -a http://gems.github.com

Rails


Once rubygem and rails are installed you just have to install rails via gems



sudo gem install rails

You can also specify a version of the gem

sudo gem install rails -v 2.2.2

Apache + Mysql


First install apache2 and mysql



sudo apt-get install apache2 mysql-server mysql-client libmysql-ruby libmysqlclient-dev

Then the rubygem mysql

sudo gem install mysql

Capistrano

Deploying code to production or staging as eaysier as

cap staging deploy

cap production deploy

Install capistrano and capistrano-ext

sudo gem install capistrano

sudo gem install capistrano-ext

Gedit for Ruby and Ruby on Rails


Mac users have Textmate, Linux user can have nearly the same! I must admit that I love Gedit, it’s such a good editor with the good plugins.

Install Gedit and Gedit plugins


First you need to install the plugin extenstion for gedit



sudo apt-get install gedit gedit-plugins

Gmate, here is the magic


Gmate is a usefull program (collection set of plugins and theme) transforming Gedit into a Textmate like



cd ~
git clone git://github.com/lexrupy/gmate.git
cd gmate
sh ./install.sh

Now reboot your gedit, I use Bitstream Vera Sans Mono Blold 11 as main font, I’ve also activated the Bookmark plugin and the External Tools one.

Here is an exemple of my Gedit/Gmate display the user controller of SerialCooking

gmate

Quick reference:


  • F9 => Show / Hide left side pane

  • CTRL + F9 => Show / Hide bottom pane with integrated console (If you activated the plugin)

  • Enter => Complete the word completion

  • Tab => Use Tab to compete the snippets (lit + tab in an RHTML file == link_to ’’, )

  • Ctrl + T => Indent

  • Ctrl + Alt + PgUp or Down => Navigate between tabs

Other useful softwares

Guake

Useful if you want to have a console display by pressing F12 (I use Bitstream Vera Sans Mono 10 as font)

sudo apt-get install guake

guake




h2. Mysql Tools


Sun Mysql tools to enjoy Mysql navigation



sudo apt-get install mysql-gui-tools-common

Xmind

Xmind is an excellent mind mapper. You can learn more about Xmind on the official website, and download the last version on sourceforge
h2. Usefull tips

Api Dock

I use API dock to search on the Ruby and Rails doc. It comes with great Firefox extension that you can install

Ruby API Doc search

Rails API Doc search

Tail -f

Use tail -f log/developement.log in your console and you’ll an auto refresh of you log file. Really useful!

Virtual workspace

Ubuntu come by default with 2 virtual workspace. I like to have 4 of them, and switching by CTRL + Atl + Arrow left/right.

One will have personnal stuff, like music email twitter and co, second the source code, third the browser to test and fourth the console. A bit to much organised, but I like it.

Useful online app

I don’t want to do a copy and paste of Dan post, so checkout the web app list on the giantrobot 2009 Rubyit’s guide to Mac Os development
h2. Go forth & conquer!

With this you should be ready to develop you Ruby code on Linux. If you still don’t know how to do, tuts arrive this week on notgeeklycorrect so stay tuned!

Feel free to comment and add your own tips!

_Edit: Added API Dock section, typo
_

Comments