Ticket #226 (assigned defect)

Opened 3 months ago

Last modified 3 months ago

<move> task doesn't support filters

Reported by: hans Assigned to: hans (accepted)
Priority: major Milestone: 2.3.1
Component: phing-tasks-system Version: 2.3.0
Keywords: Cc:

Description

As reported by Raphael Scott on mailing list:

While running some old build files developed prior to the current 2.3.0 release(no svn, just stable PEAR package) I encountered some weird replace tokens behaviour. Even tried to pull them out of a bigger build file with not even more success to track it down. Even ran this build fie on a win32 box and a mac osx box and didn't work on both.

Sorry maybe I'm just to waisted due to the later hour and thereby not getting it, but otherwise I also could have been stumbled into a (already reported?) bug.

Shouldn' t the following test target produce the text 'Some text with two tokens: 1st Token followed by a 2nd Token' when applied to the move task context and get written into the file moved to?

<?xml version="1.0" encoding="utf-8" ?>
<project name="test" basedir="." default="test">

  <property name="one" value="1st Token" />
  <property name="two" value="2nd Token" />

  <property name="text">Some text with two tokens: @@TOKEN_ONE@@ followed by a @@TOKEN_TWO@@</property>

  <target name="test">
    <echo msg="${one}" />
    <echo msg="${two}" />
    <echo msg="${text}" />

    <echo file="template.txt">${text}</echo>

    <move file="template.txt" tofile="text-with-tokens-replaced.txt">
      <filterchain>
        <replacetokens begintoken="@@" endtoken="@@">
          <token key="TOKEN_ONE" value="${one}" />
          <token key="TOKEN_TWO" value="${two}" />
        </replacetokens>
      </filterchain>
    </move>
  </target>

</project>

Attachments

Change History

02/24/08 03:08:33 changed by hans

  • status changed from new to assigned.
  • component changed from phing-core to phing-tasks-system.

Yes, indeed, as noted on list, while the <move> command does extend <copy>, there is currently no support for applying filters. This may not be a trivial addition, since <move> is actually performing simple rename() operation (rather than copying data), and hence doesn't use the FileUtiles::copyFile() method which properly incorporates filters.


Add/Change #226 (<move> task doesn't support filters)