Unicorn and home_run

Jeremy Evans jeremyevans0 at gmail.com
Tue Aug 24 17:38:17 EDT 2010

On Tue, Aug 24, 2010 at 12:58 PM, Eric Wong <normalperson at yhbt.net> wrote:
> Clifton King <cliftonk at gmail.com> wrote:
>> I got a "The message's content type was not explicitly allowed" when trying
>> to send an email to the group.
> Hi, we only allow plain text and patches on the mailing list, no HTML.
>> > From: Clifton King <cliftonk at gmail.com>
>> > To: mongrel-unicorn at rubyforge.org
>> > Date: Tue, 24 Aug 2010 12:21:49 -0500
>> > Subject: Unicorn and home_run
>> > Hi All,
>> >
>> > I was trying to get home_run (a C-based Date/DateTime implementation)
>> > working with Unicorn http://github.com/jeremyevans/home_run, but using
>> > home_run --install then running unicorn_rails would crash with the following
>> > stack trace on a Ruby 1.8.7 CentOS staging server:
>> > http://pastie.org/1111144
>> >
>> > I believe this has to do with the order in which ruby's default libraries
>> > are loaded when running unicorn_rails. Jeremy Evans (home_run's author) is
>> > available to answer any questions specific to his libraries.
> Are you starting it with "home_run unicorn_rails" or did you install
> it system-wide?

Clifton told me that was working for him.  One of the reasons it may
work where the other way didn't is that in addition to setting up the
load path, it also requires the library up front.

I think this problem is solved in the master branch.  The problem is
that some libraries require date/format without requiring date.  In
the standard library date/format.rb does not require date, where it
does in home_run.  I believe the reason for this error is that
previously, in date/format.rb, I was doing:

  require 'date' unless defined?(Date)

But if something opens up the Date class to monkey-patch, it never
requires 'date', since the Date class then exists.  It appears that
json, syck, and rubygems all do this.  home_run now does:

  require 'date' unless defined?(Date::ZONES)

Which should fix the issue, as only home_run should be defining that.

> Jeremy: would it be easier for home_run to just require the core-Ruby
> classes first and then monkey patch the methods individually?  I haven't
> gotten a chance to look into home_run myself much.

home_run is designed as a complete replacement for the standard date
library.  It's not a monkey patching solution like Date::Performance,
so it wouldn't be easier to just require and then overwrite.


More information about the mongrel-unicorn mailing list