2016-03-15 77 views
0

當我運行構建時,我想在配置文件中搜索配置密鑰rollbackversion,並使用部署服務器的當前分支(在展開之前)將值替換爲它的值(null)。這是怎麼了存儲的值 -如何通過phing構建將配置文件中的鍵替換爲配置文件中的鍵?

destination = /home/sandeepan/mock_del_servers/box1 
rollbackbranch = null 

我已經找到方法來查找和替換的值,但是這不是我所期待的。我想指定一個鍵並將其替換爲它的值。

find replace text in file with Phing

How can I conditionally replace tokens in a config file with Capistrano or Phing?

回答

-1

我找不到任何解決方案這是一種更原產於phing,但這正則表達式這確實更換,並把它放在phing's replaceregexp filter -

<reflexive> 
      <fileset dir="config/"> 
       <include pattern="generic.build.properties" /> 
      </fileset> 
      <filterchain> 
       <replaceregexp> 
        <regexp pattern="(rollbackbranch[\s]*=[\s]*)[a-z]*(\n)" replace="REPLACEMENT"/> 
       </replaceregexp> 
      </filterchain> 
</reflexive> 
相關問題