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, and is feature
compatible with rails_environments:
>> Rails.environment # a convenience alias to Rails.env => "development" >> Rails.development? => true >> Rails.not_development? => false >> Rails.production? => false >> Rails.not_production? => true >> Rails.test? => false >> Rails.not_test? => true
Not only does it provide env?
and 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.
The value of this plugin is diminished by rails 2.2, which allows you
to do Rails.env.development?
.
Install with: script/plugin install git://github.com/tobias/rails_habitat.git
Copyright © 2009 Tobias Crawley, released under the MIT license