RailsApps/rails_apps_composer — pull request #273 by JangoSteve (2014-01-30 08:15:33+00:00)
Title: Foreman procfile

I had mentioned to you that Foreman is used for much more than just environment variables in the .env file, as it primarily manages processes to run an app using a Procfile (like Heroku), and can export to Upstart (Ubuntu) and Init (Unix). Here's a short article that describes it:
http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

Anyway, I included default Procfiles for each of the webservers that rails_apps_composer offers (thin, unicorn, and puma).

Also, because Foreman is a general purpose tool (not rails or even ruby-specific), it doesn't directly tie into Rails to load the environment variables. Instead, in order to run any command with the environment variables, you just run the command you want preceeded by `foreman run` (similar to using `bundle exec`).

So, I made sure that the rake commands that rails_apps_composer runs which might need the environment variables are run using `foreman run` if foreman is selected. I may have gotten overzealous with those though, as the only rake command I'm aware of that really needs it is `rake db:seed` with devise. But I figured better safe than sorry, as it's possible that `db:migrate` or others could rely on environment variables in other recipes I'm not as familiar with, and using `foreman run` wouldn't have any negative effect.

By the way, this is actually one of the reasons I think Foreman will stay relevant after Rails 4.1 (with secrets.yml). In addition to the Procfile process management, Foreman's implementation of environment variables doesn't rely on Rails, and so they would be available even with things like plain ruby scripts included in your app or Rake tasks that don't load the Rails environment.