I just released a stupid simple plugin based on the idea behind Coda Hale’s rails_environments plugin.
This plugin adds the following functionality to the Rails module to help with determining the current enviroment:
>> Rails.environment # a convenience alias to Rails.env
Not only does it provide
not_env? methods for the standard environments, it also provides those methods for any environment you define in config/environments/ (in fact that is how it learns about all of the environments, including the standard three). So if you define new environments in config/environments/ they will be picked up automatically.
script/plugin install git://github.com/tobias/rails_habitat.git
It lives on github.
Edit: see David’s comment below for the built in way to do this (in Rails >= 2.2).