Path to add support for custom envs on gem command (App Templates)

Hey guys,

I've sent a patch that might be interesting. This patch allows you to specify a custom environment for the "gem" command on your rails app templates. This way, you can require the gems only at the specified environments, and not the global environment file. For example, a gem command like this:
gem 'mocha', :env => :test

will add the config.gem line at the file config/environments/test.rb, instead of the global environment config/environment.rb. The default remains to the global environment file for backward compatibility.

A user can install the required gems for the Rails application according to the environment that is going to be used, like:

RAILS_ENV=test rake gems:install

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1918-app-templates-should-support-custom-env-files-for-the-gem-command

What do you think?

Carlos Paramio

Hi,

Why not just specify the dependency in the correct environment file?
So add config.gem 'mocha', :version => '0.9.3' to your environments/
test.rb file.

- Eloy

Ah never mind, I understood your question in a different way, I
understand it now.

- Eloy