Thursday, September 9, 2010

sneak a custom gem into heroku

today, I've been trying to get Wee running on heroku.

I have a custom version of the gem, and want to run it on heroku.

i looked down a few avenues, but decided they where all too complicated right now - I was having trouble getting something basic to work, if I tried something complex then that is just more stuff I will have to debug.

so my plan was: load by custom gem as normal code in the local directoy

> gem unpack wee

then, add to my config.ru:

libdir = "wee-2.2.0/lib/"
$LOAD_PATH.unshift(libdir)

now, when ever this is a line like require 'wee' it will look into the local wee-2.2.0/lib/ and find wee.rb instead of loading from the gem directory.

uploaded it to heroku and it worked!

p.s. the rest of the config.ru looked like this:

require 'continuations.rb'

app = Wee::Application.new { Wee::Session.new(Page.instanciate, Wee::Session::ThreadSerializer.new) }
run app

1 comment:

  1. Thanks for posting this. Bailed me out today big time.

    Have you found another, better way to do this yet?

    ReplyDelete