# RoR equivalent of Ant's build.properties?

**URL:** <https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710>\
**Category:** Rails\
**Created:** [January 21, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710 "2008-01-21T16:11:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/1 "2008-01-21T16:11:17Z")

</div>

Or to phrase it another way:

While developing in a distributed (multi-developer) environment,  
how do you keep settings local to your own system out of the svn  
repository?

e.g, in config/environment.rb, you want to have an entry like  
config.action\_mailer.smtp\_settings = { :address =\> “[smtp.example.com](http://smtp.example.com)”,  
…

In a Java environment you’d have a build.properties file that would  
substitute in your appropriate values; what’s the Rails way here?

## TIA,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/2 "2008-01-21T16:30:05Z")

</div>

On 21 Jan 2008, at 15:10, Hassan S. wrote:

> 

There’s development.rb, production.rb etc… which allow you to have  
per environment settings for stuff like that.

Fred

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 5:07pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/3 "2008-01-21T17:07:11Z")

</div>

On Jan 21, 2008 7:19 AM, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> There’s development.rb, production.rb etc… which allow you to have  
> per environment settings for stuff like that.

So you’re saying to just exclude development.rb from being included  
in SVN, then?

But it’s not just stuff in that one file. For example, there’s a  
reference  
to “@host” in user\_mailer.rb (restful\_authentication) that needs to be  
configured for each developer.

```
@body[:url] = "http://#{@host}/activate/#{user.activation_code}"

```

Are you saying then that @host and any other desktop-local variables  
anywhere should be set in environments/development.rb?

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/4 "2008-01-21T17:26:43Z")

</div>

On 21 Jan 2008, at 16:06, Hassan S. wrote:

> On Jan 21, 2008 7:19 AM, Frederick C.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > There’s development.rb, production.rb etc… which allow you to have  
> > per environment settings for stuff like that.
> 
> So you’re saying to just exclude development.rb from being included  
> in SVN, then?  
> I wouldn’t go that far - I got the impression from the example you  
> gave that you were more interested in production vs development  
> settings.  
> anywhere should be set in environments/development.rb?  
> Something like the current host does sound like something that is part  
> of the environment, and hence fodder for development.rb. Obviously  
> this isn’t so great if your going to have different ones for each  
> developer (which isn’t something I’ve needed)

Fred

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 5:48pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/5 "2008-01-21T17:48:01Z")

</div>

On Jan 21, 2008 8:24 AM, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > So you’re saying to just exclude development.rb from being included  
> > in SVN, then?  
> > I wouldn’t go that far - I got the impression from the example you  
> > gave that you were more interested in production vs development  
> > settings.

Well, not really – there’s settings for the production server, yes,  
but there’s also development-mode settings for the integration  
server which will be different from those on each developer’s  
desktop.

> Something like the current host does sound like something that is part  
> of the environment, and hence fodder for development.rb. Obviously  
> this isn’t so great if your going to have different ones for each  
> developer (which isn’t something I’ve needed)

I can’t imagine any distributed team would _not_ face this issue.

Any other suggestions?

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 6:01pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/6 "2008-01-21T18:01:56Z")

</div>

Hassan S. wrote:

> I can’t imagine any distributed team would _not_ face this issue.
> 
> Any other suggestions?
> 
> –  
> Hassan S. ------------------------ removed\_email\_address@domain.invalid

Hassan,

Modify config/environment.rb to load user specific configuration files…  
since environment.rb is ruby, you can also add smarts to conditionally  
load files on environment conditions, user defined properties, etc…

Everyone will still have the same version of config/environment.rb but  
can have drastically different environments based on their own user  
settings.

hth

ilan

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 21, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/7 "2008-01-21T19:14:42Z")

</div>

On Jan 21, 2008 9:01 AM, Ilan B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Modify config/environment.rb to load user specific configuration files…  
> since environment.rb is ruby, you can also add smarts to conditionally  
> load files on environment conditions, user defined properties, etc…
> 
> Everyone will still have the same version of config/environment.rb but  
> can have drastically different environments based on their own user  
> settings.

Aha, that sounds exactly like what I need 🙂

## Thanks much!

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 22, 2008, 4:25am UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/8 "2008-01-22T04:25:09Z")

</div>

Our teams leverage an approach wherein we load data from config.yml.

In config,yml, we store all of our settings and ignore that in SVN.  
This  
config file is structured just like the database.yml file, but it  
contains  
every setting that could change, from [authorize.net](http://authorize.net) keys for cc  
processing  
to what type of email system to use (sendmail, smtp, etc). We then just  
load those into a hash stored in a constant in environment.rb

We can then use capistrano to build that file on the servers when we  
deploy  
it 🙂

On Jan 21, 2008 12:13 PM, Hassan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Hassan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@Hassan\_S](https://www.ruby-forum.com/u/Hassan_S)\
**Post date:** [January 22, 2008, 5:50am UTC](https://www.ruby-forum.com/t/ror-equivalent-of-ants-build-properties/126710/9 "2008-01-22T05:50:30Z")

</div>

On Jan 21, 2008 7:24 PM, Brian H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In config,yml, we store all of our settings and ignore that in SVN. This  
> config file is structured just like the database.yml file, but it contains  
> every setting that could change, from [authorize.net](http://authorize.net) keys for cc processing  
> to what type of email system to use (sendmail, smtp, etc). We then just  
> load those into a hash stored in a constant in environment.rb

Thanks, I’ll have a play with that as well, since I’m just getting  
started  
with a multi-dev RoR project and looking at best practices.

## Nothing like jumping into the deep end 🙂

Hassan S. ------------------------ removed\_email\_address@domain.invalid
