#php #phing
#php #финг #phing
Вопрос:
Есть ли фильтр, и можете ли вы привести мне пример использования Phing для удаления раздела кода?
Например, это мой код:
function someFunc() {
// <debug>
var_dump(func_get_args());
// </debug>
doStuff();
}
Как мне раздеть его до:
function someFunc() {
doStuff();
}
используя Phing?
Ответ №1:
Я разобрался с небольшим регулярным выражением:
<target name="stripblocks" depends="prepare,clone">
<property name="stripblocks" value="debug|strict" />
<reflexive>
<fileset dir="${buildpath}">
<include pattern="**/*" />
</fileset>
<filterchain>
<!-- Replace the blocks using regex -->
<replaceregexp>
<regexp pattern="//samp;<(${stripblocks})amp;>.*?//samp;</(${stripblocks})amp;>"
replace="// amp;<$1/amp;>"
ignoreCase="true"
multiline="true" />
</replaceregexp>
</filterchain>
</reflexive>
</target>
Это меняет
function someFunc() {
// <debug>
var_dump(func_get_args());
// </debug>
doStuff();
}
в
function someFunc() {
// <debug/>
doStuff();
}