Return-Path: Delivered-To: apmail-buildr-users-archive@www.apache.org Received: (qmail 95466 invoked from network); 15 Sep 2010 21:42:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Sep 2010 21:42:49 -0000 Received: (qmail 34258 invoked by uid 500); 15 Sep 2010 21:42:49 -0000 Delivered-To: apmail-buildr-users-archive@buildr.apache.org Received: (qmail 34223 invoked by uid 500); 15 Sep 2010 21:42:49 -0000 Mailing-List: contact users-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@buildr.apache.org Delivered-To: mailing list users@buildr.apache.org Received: (qmail 34215 invoked by uid 99); 15 Sep 2010 21:42:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Sep 2010 21:42:49 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rafadecastro@gmail.com designates 209.85.215.172 as permitted sender) Received: from [209.85.215.172] (HELO mail-ey0-f172.google.com) (209.85.215.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Sep 2010 21:42:45 +0000 Received: by eyd10 with SMTP id 10so549551eyd.17 for ; Wed, 15 Sep 2010 14:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:reply-to:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=A5d85j5RZsYjeHx9ePVrDjassJiR1dYR0Lx47/RwFBY=; b=X+fGiaPxSLemWt8UwYcStP2T7a7lSqL7jSIecpLCeDXvzbOE6LRBhp20BGkw+udfYS 2Dm7xdF1NhjDGzp50seETmp2HdvAHdIZU6xzgqf0l7h8m6TAKpPE0noQ6kbYEb0JBxVg t8bhoD9ery2NdZVFrRdr/U5WXB6M2TC5avTNc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=wEtKIyPgS7eHGZJxR8QNF4cKm2GZVq09Y7Jx+UB0sJvVcovefa+vqtFFeYHSkSLsCF VKxZvY0SvqK+ZbhZla9rNTzxobgtSl5y09X1jjVYRTTiF4HB0b+k9/yxjCDInz0rG8lD KkVD2zDUwCpj8F2w60I6m97+jHRCdW4cRNVt4= Received: by 10.213.108.130 with SMTP id f2mr1771715ebp.72.1284586941247; Wed, 15 Sep 2010 14:42:21 -0700 (PDT) MIME-Version: 1.0 Sender: rafadecastro@gmail.com Reply-To: rafael@micubiculo.com Received: by 10.213.22.68 with HTTP; Wed, 15 Sep 2010 14:42:00 -0700 (PDT) In-Reply-To: References: From: Rafa de Castro Date: Wed, 15 Sep 2010 23:42:01 +0200 X-Google-Sender-Auth: dg_-4KE2HvbF20ymJgJCr87VsTQ Message-ID: Subject: Re: Substituting values in a file To: users@buildr.apache.org, antoine@lunar-ocean.com Content-Type: multipart/alternative; boundary=0015174c1a4650f12804905334e3 --0015174c1a4650f12804905334e3 Content-Type: text/plain; charset=ISO-8859-1 You can also try creating erb templates of the files you want to change. Then bind the values and generate the files dinamically. It's really simple. http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/erb/rdoc/classes/ERB.html And very rubyish :P On 15 September 2010 23:35, Antoine Toulme wrote: > 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 >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???** > > > -- Rafa de Castro rafael@micubiculo.com --0015174c1a4650f12804905334e3--