This is a summary of some of the tools I’m using with Rails, I’m putting together a list to try and get a few more people trying it out. I’m hoping a few people will try out some of the tools and ask questions in the Ruby forum.
Ruby / Rails Tools
Rails is quite simply the best way to build web applications, I’m not lying to you.
It is a collection of best practices, agile workflow and tooling to make web development fun and productive again. I Really Like Rails.
OS
Nearly all Rails developers use Mac OSX, it’s easiest to follow along and receive help if you’re using the same.
If you only have access to windows it’s probably worth downloading and running Ubuntu cause you really need a unix shell.
But if you’re intent on using windows check out http://railsinstaller.org/
Now that we all have our shiny dev machines encased in aluminum…
Read the official rails guides, they contain everything you need to know.
I can’t stress how ridiculously good these docs are, they will answer all of your questions.
Installation and Tools
On a clean install of OSX
Software Update… from the apple menu
install XCode from the app store
Install Command Line Tools for Xcode from http://developer.apple.com/downloads
zsh
Learn to love the command line
https://github.com/robbyrussell/oh-my-zsh
Rubygems
gem update --system
gem install bundler
gem install rails
gem install heroku
If it says “command not found: gem” download and install here
http://rubygems.org/pages/download
Github
If you don’t have a github account yet create one
https://github.com/signup/free
Heroku
If you don’t have a heroku account yet create one
https://api.heroku.com/signup
Git
git config --global user.name "<your name>"
git config --global user.email <your email>
git config --global color.ui true
If it says “command not found: git” download and install here
http://git-scm.com/book/en/Getting-Started-Installing-Git
Generate SSH keys to authenticate your machine with your github account
https://help.github.com/articles/generating-ssh-keys
Homebrew
https://github.com/mxcl/homebrew/wiki/Installation
Homebrew packages
Run “brew install <package>” and read all of the output, if something hasn’t installed correctly it will tell you how to fix it.
You can run “brew doctor” to see if something’s not quite right.
brew install rbenv
brew install postgresql
brew install git-flow
brew install imagemagick
brew install gs
Textmate
Not free, but a fast, lean, beautiful text editor
http://macromates.com/
Pow
A Rack server for development
http://pow.cx/
Create a Rails app, put source in Github, deploy to Heroku
You can put your applications anywhere but “projects” in the home directory “~” is a common place, all other code repos you can clone to ~/code
mkdir ~/code
mkdir ~/projects
cd ~/projects
Create a new rails application called ‘barebones’ using postgresql
rails new barebones -d postgresql
cd barebones
Install all the gems in Gemfile
bundle install
Edit database config
mate config/database.yml
Paste this and save
development:
adapter: postgresql
database: barebones_development
test:
adapter: postgresql
database: barebones_test
Create the database
rake db:setup
Symlink to the pow directory so you can run it locally
cd ~/.pow
ln -s ~/projects/barebones
Init git and commit all files
git init
git add .
git commit -am 'first commit'
Add a ‘remote’ so you can push code to github
git remote add origin git@github.com:<your-name>/barebones.git
git push origin master
Create a heroku app and deploy to it
heroku create
git add remote heroku <heroku-git-address e.g. git@heroku.com:warm-ocean-5452.git>
git push heroku master
We now how have:
A new rails app with db running at [indent][noparse]http://barebones.dev/[/noparse] on the Pow server for development[/indent]
Our code in a github repo at [indent][noparse]https://github.com/<your-name>/barebones[/noparse][/indent]
A Live environment hosted on Heroku at an address like [indent][noparse]http://warm-ocean-5452.herokuapp.com/[/noparse][/indent]
Check out http://guides.rubyonrails.org/ to learn more.
Pre-compilers
SASS & Coffeescript are defaults in Rails so you’ll already have these in your Gemfile
Add HAML and Compass and ‘bundle install’ or ‘bi’ if you installed ohmyzsh
gem 'haml-rails'
gem 'compass-rails'
Haml compiles to HTML
Sass & Compass compile to CSS
Coffeescript compiles Javascript
I still occasionally butt heads with Coffeescript and Haml but for the most part I find them great and they require a lot less code.
Sass and Compass are absolute no brainers, if you’re not using them yet, do.
To use pre-compilers you just add extensions to your views, stylesheets or javascript files e.g.
edit.haml, application.js.coffee, application.css.scss
Testing with Cucumber, Capybara and RSpec
There’s great value in writing automated tests, refactor your code and ensure you haven’t broken anything.
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'machinist'
gem 'faker'
end
Git Flow
Intelligent branching patterns for git
https://github.com/nvie/gitflow/
Sphinx
A powerful search database similar to Lucene, Ferret or Solr
http://freelancing-god.github.com/ts/en/installing_sphinx.html
Babushka
Automate things e.g. provisioning servers, deployment tasks, building a dev environment
http://babushka.me/
Paperclip with imagemagick
Attach files / images to ActiveRecord models
https://github.com/thoughtbot/paperclip/
Ruby Toolbox
Search for gems and find which ones are active and popular
https://www.ruby-toolbox.com/
New Relic
Performance Monitoring for you app
https://rpm.newrelic.com/
If you have any questions about any of those tools or ran into problems setting up your environment ask away.