buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Jensen <>
Subject Substituting values in a file
Date Wed, 15 Sep 2010 21:28:36 GMT
I have a client/server system where both the client and the server need to
know the server's hostname (think of this requirement like Apache's virtual
hosts where one process is able to serve as multiple hosts), but that can
change depending on whether it is a dev, QA, or production build.  I need to
replace a variable for the hostname in a couple of XML files, a properties
file, and a JSON/JavaScript file.  The number is small enough that I would
want to specify the files to modify rather than do a global search/replace
(keeps the variables from proliferating, too :)

One solution I thought of is to have a configuration file that specifies the
hostname the system is being built for (the confi file would exist outside
our repository). When a build is performed, the files would have the
variable substitution performed to give *this* build a particular hostname.

The problem with this is that it doesn't work well in IDE projects that
don't know about the substitution.

I'm open to other ideas and, more importantly, any points for accomplishing
this that a new user of buildr might not know about (I can always write the
ruby code to do it if it comes to that).



*Travis Jensen*
*Read the Software Maven @
Read my LinkedIn profile @
Read my Twitter mumblings @
Send me email @

**What kind of guy calls himself the Software Maven???**

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message