Getting Ready To Develop With Ruby [Ubuntu]
First, this assumes you’ve got a fresh install of Ubuntu 10.04 (But any version around that should work).
Second, we’re going to also assume you want to do this right from the start, and we’re using RVM for version management.
Thirdly, we’ve decided to use gedit for graphical editor and nano for command line editor. A lot of people are going to be screaming that you need to use X editor, or how Y is so much better. Fuck that, all you need to do right now is develop. Learn the more complex tools when you need more complex tools.
Enter these into the command line, just copy and paste. If you’re absolutely sure all these will work, copy them and replace the line returns with &&, and paste:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential bison autoconf g++ curl zlib1g-dev libreadline5-dev
sudo apt-get install libsqlite3-dev libxslt-dev libxml2-dev
sudo apt-get install sqlite3 git-core subversion nginx
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
rvm install 1.9.2 && rvm --default 1.9.2 && source ~/.rvm/scripts/rvm
gem update --system
gem install facets linguistics sqlite3-ruby --no-ri --no-rdoc
gem install nokogiri rake prawn pony sequel gist --no-ri --no-rdoc
gem install sinatra rails padrino nanoc eventmachine thin rack --no-ri --no-rdoc
gem install haml rdiscount builder --no-ri --no-rdoc
Then copy this line into the last line of each .bashrc and .bash_profile (replace USER with username):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
and from .bashrc remove:
[ -z "$PS1" ] && return
You should have an acceptable web development platform now! Great! But what does this stuff do? Well you should notice a few things:
facets, linguistics, and sqlite3-ruby are gems that all extend the general ability of Ruby in different ways. Investigate these gems later, via google.
nokogiri, rake, prawn, pony, and sequel are gems that extend the specific ability of Ruby in certain domains. For example, nokogiri is a fast and light HTML and XML parser, while sequel is an incredible SQL database wrapper.
sinatra is an example of a single file web app framework, although it doesn’t need to be single file. It is short, sweet, and can be as complex as you require it. It can even be used inside rails apps for smaller tasks.
rails is the most popular gem for web development, and is generally reserved for large scale applications.
padrino if rails is too large or bulky for you, padrino is built on the sinatra web framework and fits the bill.
nanoc is the best example of a static website builder. It’s small and works rather uniquely, so remember to read the (great) documentation.
haml, rdiscount, and builder are some of the best HTML generators. They’re both fast and extensible (haml also includes sass, for css).