buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lacton <>
Subject [buildr] How to use filter?
Date Sat, 05 Jul 2008 20:46:05 GMT

Starting point: a template file
'src/main/webapp/WEB-INF/jonas-web.xml.tpl', containing an XML
configuration, with a token '~CLIENT~' to be replaced by a client code
Ending point: a war file, containing a 'jonas-web.xml' file in its
WEB-INF folder, with a client code instead of the '~CLIENT~' token

I thought using 'filter' would be the way to go, but it seems I don't
understand how it works. Here's what I tried.

define 'jonas-web' do

  project.version = '1.0'

  package(:war).with :classes=>_('target/WEB-INF/jonas-web.xml')

  file _('target/WEB-INF/jonas-web.xml') =>
[_('src/main/webapp/WEB-INF/jonas-web.xml.tpl')] do |task|
    mv _('target/WEB-INF/jonas-web.xml.tpl'), _('target/WEB-INF/jonas-web.xml')

  check package(:war) do
    it.should contain('WEB-INF/jonas-web.xml')
    it.should_not contain('WEB-INF/jonas-web.xml.tpl')

  check package(:war).entry('WEB-INF/jonas-web.xml') do
    it.should contain(/some_client/)
    it.should_not contain(/~CLIENT~/)

The 'mv' operation fails with "No such file or directory -
/home/lacton/code/buildr/jonas-web/target/WEB-INF/jonas-web.xml.tpl or
/home/lacton/code/buildr/jonas-web/target/WEB-INF/jonas-web.xml". When
I check the contents of the target directory, it's weird, because I
can see buildr created the 'target/WEB-INF' directory, but it's empty.
There isn't a 'jonas-web.xml*' in it.

What's wrong with the way I use filter? More broadly speaking, is
there a better way to do what I'm trying to do?


View raw message