buildr-users mailing list archives

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

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.

<code>
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|
    filter(_('src/main/webapp/WEB-INF/jonas-web.xml.tpl')).into(_('target/WEB-INF')).using(/~(.*)~/,
:CLIENT=>'some_client').run
    mv _('target/WEB-INF/jonas-web.xml.tpl'), _('target/WEB-INF/jonas-web.xml')
  end

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

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

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?

--
Lacton

Mime
View raw message