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
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
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
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
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
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
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
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



Brilliant article.
Thanks.
I’ve been using Geany for editing but it’s limited. I think I will switch to Gedit now though after reading this.
I’ve been using Tilda for my quake-style terminal but it’s a little ropey so I’ll try guake out.
Cheers
Thanks,
I don’t really like Geany, I prefer the Gedit simplicity. For Tilda, last time I tried it, it was a bit buggy so I moved to guake.
Btw, I’ve just edit to post with the API Dock section
Yeah, I agree about geany, it doesn’t let you explore the file tree which makes it difficult to use. And yeah, tilda is buggy as hell. It causes problems with a number of other softwares.
BTW, you might want to edit your instrutions for installing gmate – the command is sh install.sh
Thanks again, gmate and gedit are really simple and that’s just what I need
Thanks the typo is corrected!
The title to this post is a little confusing as the article does not mention linux development. Shouldn’t it be “2009 Rubyist’s guide to developing on the linux platform” or some such. “linux development” is the development of linux applications to me?
Sorry to be an arse lol
@AdulteratedJedi thanks you’re right, the title is changed
Geany does let you explore the file tree. Just go to “View -> Show sidebar” and it’s the “Files” tab. This is pretty much the same in every editor
I’ve used Gedit and Geany pretty heavily and they both have their high and low points, but Geany is more editable out-of-the-box than Gedit (i.e. via preferences rather than plugins) which is a big win for me, as well as having customisable keybindings (which I realise I could get in Gedit if I wanted to make all of Gnome’s keybindings editable).
Neither of them has particularly good autocomplete however. This is a bit of a shame.
@Phil, I agree with you for the autocomplete, but I’m not sure that autocomplete is really a must to have in Rails project. When I really need it, or when I have to do big refactoring I’ll open Netbeans.
.
After, as you already knows, I don’t really like Geany (and I’ve re-tried after our Brug dicussion) it’s not my cup of tea
I think basic autocomplete can be useful, although not essential. I think Scribes has an interesting twist where it autocompletes words you’ve previously typed in any open scribes window. My original comment mentioned Netbeans for refactoring, but I thought I might get abuse for suggesting it so deleted it
FWIW I’m currently using Gedit for some development and there are only really two features I miss from Geany – method browsing (I know there are some plugins for this) and code folding. That, and the constant annoyance of CTRL+ALT+PGUP/DOWN of course
This is a really useful guide though, and I’d never seen API Dock before, which is massively helpful!
@Phil, the autocomplete plugin (dispo in Gmate) add the same feature of completing words aulready existing in your open docs.
Method browsing there is a plugin also, that add a sidepane. But no code folding for the moment
It seems it will be possible with the new GTKSourceview but nothing currently.
Yes, API Dock is wonderful!
Hi, I liked your system setup and this blog as well.
Can you share which theme you are using in your Jaunty and in your gedit??