You're viewing all posts tagged with coding

Running a Rails app in production using rbenv, Apache and Passenger

Recently, I upgraded NZ Walks Info to Rails 3 and Ruby 1.9.3. In order to run this new setup successfully, I needed to upgrade the Ruby version on the server. I chose ruby-build and the rbenv Ruby Version Manager to do so and would like to share some simple instructions that worked for me.

Read More...

Pow and Rails 2.3.x apps

Pow has just been released by 37signals:

Knock Out Rails & Rack Apps Like a Superhero.
Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute.

Usually, there’s no configuration needed at all, but in order to get my old Rails 2.3.x apps running, I needed to “rackup” all of these. Following the Rails Guides instructions, I had to create a config.ru file with the following contents:

# RAILS_ROOT/config.ru
require "config/environment"

use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new

Then I was good to go.
Unless…

Read More...

Feature Branches

When I am creating a new feature for an app, I sometimes realize halfway through that the way I am building it, is not the proper way to do so. Or the specification changes. Or there was a misunderstanding. Or there’s an unexpected bug that needs to be fixed and go onto the production server as soon as possible.
Then, when you did all development on the main branch (we use Git, so that’s the master branch in that case), undoing things and/or doing a quick deployment can get very inconvenient. You can’t just deploy a quick bug fix, because all other half-finished features and fixes would have to be deployed, too. You can’t easily revert the existing commits for that feature, especially if the commits are mixed with all the other commits of unrelated features.

Read More...

Mix & Mash Recap

I couldn’t believe my eyes when the winners of the 2010 Mix and Mash competition were announced last Friday on Twitter. I read my name for the price of the “Best Visitor Experience using DOC Data” and the “Supreme Mashup” categories (the “Supreme Mashup” is the highest price).
This is more than I have hoped for and a great honour.

The Mix and Mash competition is about creating useful and beautiful mashups and remixes with open data from New Zealand institutions.

My entry is a website to find information about all NZ walking/tramping/hiking tracks: http://nzwalksinfo.co.nz/.

Read More...

“Why Ruby?” - RubyConf X Keynote (by David Heinemeier Hansson)

Great talk. Good points and entertaining.

(this post was reblogged from marco)
(this post was reblogged from instapaper)

Rails Rumble Recap

During the weekend of October 16th and 18th, I participated in the Rails Rumble 2010 coding competition. The exercise was to build a web app from scratch in 48 hours using Ruby and Rails.
Our team consisted of 3 people: Tim, Falk and myself.
The app we produced: Pianrra - An online keyboard with recording and playback functionality.

Read More...
Nice tip in the latest Heroku newsletter: “Use Git Tags to Manage Versions”.

Nice tip in the latest Heroku newsletter: “Use Git Tags to Manage Versions”.

Show the version number of your Rails app using Git

I use Git tags to manage the version numbers of my Rails apps. Every time a new version is ready, I tag the current commit like this1:

git tag -a v2.3 -m "adding version tag v2.3"

My environment.rb file defines a constant to hold this information (in this case “v2.3”):

APP_VERSION = `git describe --always` unless defined? APP_VERSION

This constant simply contains the output of Git describe2. Now I can use it anywhere in my app where I would like to display the version number.


  1. You are using semantic versioning, right? 

  2. The backticks execute a shell command. Here’s more information: http://gist.github.com/4069 

(this post was reblogged from mwunsch)
Less important is more important!?
I had to smile when I wrote this. :-)

Less important is more important!?
I had to smile when I wrote this. :-)