jonleighton/spring — pull request #74 by exviva (2013-02-22 17:03:45+00:00)
Title: Teach commands to parse Rails env from command-line arguments

Some commands (e.g. `runner` or `console`) allow users to specify the
Rails env (e.g. `rails runner -e test` or `rails console test`). This
commit parses options passed to `spring (runner|console)`, using some
poor man's `optparse`.

Before - this would be the buggy behaviour:

$ spring runner -e test puts\ Rails.env
development

After - spring parses the `-e` option:

$ spring runner -e test puts\ Rails.env
test

Supported options are:

- runner -e some_env
- runner --environment=some_env
- console some_env

A side effect of this change is that `Command#env` may now return `nil`,
in which case `#rails_env_for` will fallback to RAILS_ENV, etc.