Sunday, December 14, 2008

A few things to note about Heroku

First off, Heroku is amazing. Free hosting for rails apps with an editor that is actually better than what I usually use. (Looking forward to Textmate after I switch to mac though...) I initially had a couple of problems getting started with it. The tarball files did not import as anticipated. I couldn't really figure out why. The git option seemed a little better anyways, albeit a few extra steps. Importing with git was still pretty trivial.
gem install heroku

heroku clone untitled-b93f9c
cd untitled-b93f9c
[..local edits..]
git add .
git commit -m "local changes"
git push
So that's way simple, and the directions are there as soon as you fire up your app for the first time. Despite this nicety, however, I came across a couple of other issues.

First, the rails version. Heroku likes 2.0.2, or 2.1. I was running with version 2.1.2. So that just involved changing
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION

to
RAILS_GEM_VERSION = '2.1' unless defined? RAILS_GEM_VERSION

in config/environment.rb.

Naturally, changing the rails version made some of my other packages squeal. Thoughtbot's Clearance authentication system, makes use of Digest::Sha1. This apparently does not come prepackaged with Rails 2.1, so another change to enviroment.rb fixed that:

#Put the sha BACK!
require 'digest/sha1'
Next, a :link_to method caused a problem:
<div id="app_name">
<%= link_to "my app name", :root %>
Ruby language scholars might have spotted the problem without the error message, but once I got it, it was pretty simple. link_to can't be used with a symbol, so that's an easy fix. Alakazam!

<%=link_to "my app name", "/" %>

So all is well now in the land of Heroku. A few things I'm wondering now... When will heroku support newer versions of rails? Is heroku(or will it become) a popular enough deployment option to force package developers to support a heroku friendly version? Will merb make both of these questions moot?

No comments:

Post a Comment