bkeepers/dotenv — pull request #23 by toolbear (2013-03-13 13:59:47+00:00)
Title: Use foreman-env gem

Here's my take at extracting `Foreman::Env` to its own gem and re-using it with `Dotenv`. As a separate gem, [foreman-env](https://github.com/toolbear/foreman-env) seems almost too trivial, but it meets my original desire to have Foreman's `.env` parsing logic without having to bring in all of the `foreman` gem. I took a conservative, minimal changes (to Foreman) approach.

This might not mesh with what you had in mind for unifying Foreman and Dotenv, particularly if your desire is to have Foreman depend on Dotenv directly. I'm not a talented enough rubyist yet to figure out how to make Dotenv's automagical `ENV` twiddling an optional thing; and I can see some cases of wanting Foreman's `.env` parsing without the magic.

I've held off on a Foreman pull-request until we're on the same enough page.

## Stuff

* **Not ready for merge**. I didn't want to pollute rubygems.org with a foreman-env gem until a round or two of peer review, so `Gemfile` has `:git` dependencies that need eventual deletion

* [toolbear/foreman-env@master](https://github.com/toolbear/foreman-env) is a nearly mechanical extraction of `Foreman::Env` into a standalone gem. This represents the most conservative approach that meets my original need, but fails at unifying Foreman and Dotenv. My [foreman fork](https://github.com/toolbear/foreman) currently uses this.

* [toolbear/foreman-env@dotenv-extensions](https://github.com/toolbear/foreman-env) is the result of porting over those enhancements, but minimizing changes to the original foreman codebase.

* These two Sinatra apps -- http://git.io/foreman-env-web and http://git.io/foreman-env-web-dotenv -- use my Foreman and Dotenv forks respectively

* I kept the `Foreman` namespace with the notion that once everything was said and done foreman-env would just be part of foreman. Easy enough to change, though in that situation I'd rather revisit the "have Foreman depend on Dotenv" approach than introduce a new named thing.

* The newline expansion picked up from `foreman/env` possibly fixes #21, but may be a breaking change in case Dotenv users are depending on `\n` remaining `\` & `n`

* I reverted the case-insensitivity added by #22. Was being conservative again and minimizing regex changes

## I :heart: explosives