leehambley/rack-google-analytics — pull request #11 by rymai (2012-08-16 15:56:39+00:00)
Title: Ensure the body is closed after iterating over it

Hi,

I was getting many `(deadlock; recursive locking)` errors on my Heroku app in production environment and not in staging and couldn't find the origin until if found [this thread](https://github.com/rack/rack/issues/349) and then [this post](http://johnbintz.github.com/blog/2012/03/05/closing-given-body-in-rack-middleware/).

Then I compared the Rack middleware of the staging and production environments and found that the only Rack middleware that was present in production and not in staging was this one! And in fact, it appeared that you didn't close the body after iterating over it so I fixed this and since then I didn't get any new `(deadlock; recursive locking)` errors. :)

I've also improved the overall gem architecture:
* Usage of Bundler;
* Add development dependencies;
* Creation of `lib/rack-google-analytics.rb` so `:require => 'rack/google-analytics'` in the Gemfile is not needed anymore.

I hope you like these changes, otherwise feel free to ignore them and merge only the fix in the first commit.

Thanks!