Environments Support

botanicus edited this page Sep 13, 2010 · 15 revisions

This page is up to date for upcoming Rango 0.2.

- Rango.environment defaults to "development", can be set to whatever.
- Rango.environment = "test"
- Rango.boot(environment: "test") will also set the Rango.environment

Environments Support in Bundler

This will load all your dependencies for current Rango.environment:

Bundler.require_env(Rango.environment)

However if you don’t like it, just require environment.rb and use require for loading other libraries as usual. For more informations see bundling.

What Environment is Active Now?

- Is current environment development: Rango.environment?("development")
- Does current environment acts like the test environment: Rango.testing?
- Does current environment acts like the development environment: Rango.development?
- Does current environment acts like the production environment: Rango.production?

The key for understanding how the “acts like” methods works are these properties:

Rango.development_environments # ["development"]
Rango.testing_environments     # ["test", "spec", "cucumber"]
Rango.production_environments  # ["stage", "production"]

Simple Setup in init.rb

Setup In an Environment File

You may want to create settings/environments/test.rb etc and then use in your init.rb something like: