Posts Tagged ‘ruby on rails’

ABA Developers Toolkit

Friday, February 12th, 2010

Here’s an overview of what the developers at Ashley Bolser Agency are finding works well.

Web Frameworks

  • The majority of web applications we build use the Ruby on Rails framework. This allows us to get projects up and running in a small space of time without reinventing the wheel each time.
  • For smaller projects we use Sinatra, a small DSL for writing simple web applications. Sinatra is a lot leaner than Rails so is great for high traffic services like API’s.

Plugins and Gems

We use lots of open source rubygems and plugins to avoid reinventing the wheel on every project. A selection of our favourites are:

  • Authlogic - a framework agnostic library for adding authentication into your application.
  • Haml - A templating engine which focuses on improving the syntax of Markup. Haml uses indentation to determine when you want HTML tags to start/end. You therefore don’t actually need end tags, lowering the number of lines of code you need to use.
  • Paperclip - easily add support for file uploads within your application
  • Nokogiri is what we use for parsing any HTML or XML. when doing any API integration.
  • Comma allows you to declare the structure of a CSV file on your model. You can then just call to_csv on a collection to have the data in CSV format.
  • Friendly Id allows you to declare a search engine friendly slug for your ActiveRecord models. The slugs are versioned so that old ones redirect to new ones.
  • Geokit is great for any location based sites. It allows you to Geocode your models and find them based on location.
  • Simple Form - If you just want to quickly add a contact form to your site, this gem makes it a 5 minute job.

Javascript

We have experimented with a number of Javascript frameworks. Jquery seems to be our framework of choice now because of its number of useful plugins and nice syntax.

Testing

We practice test driven development which helps us to write better code, minimise bugs, and make changes without the fear of breaking everything. The libraries that we use are:

  • Rspec is a behaviour driven development framework for allowing you to describe how things should work before you build them.
  • Cucumber is an integration testing library that allows you to describe the overall behaviour of your application in plain text. You then write ruby code that interprets these steps in the background. Cucumber uses Webrat, a headless browser to crawl the application and make sure that what you want to happen does happen. Cucumber also hooks up with a number of other web browsers so it can even test that javascript/ajax works.
  • Using fixtures in testing is fine for small projects but this can often get messy and difficult to manage as the application grows. To get around this, we use the Machinist gem which allows you to define blueprints for a model and create objects with the parameters that you want directly in your test case.
  • Email Spec is a collection of Rspec and Cucumber matchers that make it easy to test that your application sends emails when it should.
  • We use Shoulda Macros within Rspec which make it easy to test simple cases in 1 line of test code.

Version Control

  • We use Git as our version control system of choice. The fact that Git makes branching so easy means we can have multiple versions of sites running at once without any issues. We all work on separate branches and merge changes into the master branch when necessary.
  • We store all our repositories at Github
  • Any small scripts, we store as a Gist

Deploying

  • Capistrano is the tool that we use to deploy our websites and applications. Capistrano connects to your server via SSH, clones the project in a new folder and updates a symbolic link to make that new folder live.
  • We use Webistrano which is basically a web interface for Capistrano. We set up all of our projects in Webistrano which allows us to deploy with a few clicks and see deployment history.

Text Editors

  • The editor of choice for the developers seems to be TextMate. Textmate has a number of bundles that really help develpment. A few that we use are:
  • We also use Vim for editing any configuration files etc on our remote servers.