2015-06-13 119 views
0

我要同步從源文件夾的公共文件夾的文件與Phing,但問題是,當我使用部署代碼phing

<copy todir="${libDir}"> 
     <fileset dir="${gitDir}"> 
      <include name="**"></include> 
      <exclude name="public/**"/> 
     </fileset> 
</copy> 

<filesync sourcedir="${gitDir}" destinationdir="${libDir}" verbose="true" checksum="true" /> 

腳本不刪除文件來自$ {libDir},這已經不存在於$ {gitDir}中。 我不想先刪除hole目錄,然後再複製所有文件。它應該有效,但需要更多時間。 你知道我如何同步這些文件夾並刪除不存在的文件嗎?

回答

0

我發現了這個決定。我只是使用linux命令:

<exec command="rsync -a --delete --exclude '.git' --exclude '.svn' ${gitDir} ${libDir}" checkreturn="true" /> 
0

在Phing的任何地方都可以輕鬆使用'exec'來使用本機操作系統工具。

Phing確實有一個rsync任務,它有一個'delete'參數。

使用rsync命令同步文件或目錄。在同一臺服務器上或從/到遠程服務器上完成同步可以是 。

<filesync 
    sourcedir="/var/www/development/project1" 
    destinationdir="/var/www/html/project1" 
    dryrun="true" 
    itemizechanges="true" 
    verbose="true" 
    checksum="true" 
    delete = "true" /> 

鏈接到phing文檔FileSyncTask