One way of doing this is by setting the mode in an environment
specific configuration file. For example, I typically create a config/
directory that contains a file config.rb. This file sets generic
configuration options such as the mode of Ramaze, what cache adapter to
use (for sessions and the like) and so on. In essence this would come
down to the following code for your app.rb file:
require 'ramaze'
require __DIR__('config/config')
require __DIR__('config/database')
# etc.
Yorick
---
if ENV['APP_ENV'] == 'production'
Ramaze.options.mode = :live
end
if Ramaze.options.mode == :live
require __DIR__('config/live')
else
require __DIR__('config/dev')
end
Ramaze::Log.info('We start in %s mode' % Ramaze.options.mode.to_s)
---
This can be extended to include :test too.
Also, you can use RACK_ENV if you really want.
În data de Sat, 10 Mar 2012 23:55:57 +0200, Roy Wright
<roywr...@gmail.com> a scris:
Roy,
You can find an approach similar to Sta's one here :
https://github.com/mwlang/cashmere/blob/master/environment.rb
There are many other interesting bits in this project, regarding testing
(auth Mocking in app.rb), tasks and specs.
Bye,
M
--
Michel Blanc - netWorks
8A68 0871 747A 65B6 E87C 3BEA 187C 36BB 2CE5 68BD