[LRUG] requiring one rails environment from another

Tim Cowlishaw tim at timcowlishaw.co.uk
Mon Apr 12 09:13:14 PDT 2010


Aha, yep - good point! database.yml is already out of SCM in any case.

:-)

On 12 Apr 2010, at 17:10, Levent Ali wrote:

> Couldn't you use test/cucumber environments and just remove
> database.yml from source control?
> 
> On Mon, Apr 12, 2010 at 5:07 PM, Tim Cowlishaw <tim at timcowlishaw.co.uk> wrote:
>> Hey there chaps,
>> 
>> I'm in the middle of setting up a CI server for our office and have run into what seems like a slight gotcha.
>> 
>> Basically, i need to set up a seperate rails environment called something like "CI", so that the CI server can have its own mysql credentials, rather than requiring all users to user the same. So, i set this up in database.yml, and create a ci.rb file in config/environments that contains only a "require File.dirname(__FILE__)+ '/test.rb'" to load in the regular test environment. However, as the code in the required file isn't evaled in the same context as where the 'require' happens - it fails with "undefined local variable or method `config' for main:Object" on the line "config.cache_classes = true", the first line in the required 'test.rb'.
>> 
>> Clearly I'm going about this the wrong way - has anyone else any bright ideas about allowing two distinct environments to share configuration, without resorting to putting it all in environment.rb?
>> 
>> Cheers,
>> 
>> Tim
>> 
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>> 
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org




More information about the Chat mailing list