buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Toulme <anto...@lunar-ocean.com>
Subject Re: Substituting values in a file
Date Wed, 15 Sep 2010 21:35:39 GMT
Hi Travis, you can reuse some buildrdeb code that does that:

http://github.com/intalio/package_as_deb/blob/master/lib/buildrdeb/package.rb#L33

<http://github.com/intalio/package_as_deb/blob/master/lib/buildrdeb/package.rb#L33>You
read the file, eval(its contents), then write it in the target folder in
place.

The code is not really good looking there but it's really simple. I
recommend you try in irb first.

On Wed, Sep 15, 2010 at 14:28, Travis Jensen <travis.jensen@gmail.com>wrote:

> 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).
>
> Thanks.
>
> tj
>
> *Travis Jensen*
> ***
> *Read the Software Maven @ http://softwaremaven.innerbrane.com/
> Read my LinkedIn profile @ http://www.linkedin.com/in/travisjensen
> Read my Twitter mumblings @ http://twitter.com/SoftwareMaven
> Send me email @ travis.jensen@gmail.com
>
> **What kind of guy calls himself the Software Maven???**
>

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