10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Phingのインストール

Last updated at Posted at 2012-12-26

追記: 2016-12-19

この記事では、インストールにpearを使っていますが、
現代的なプロジェクトではcomposerを使うことをお勧めします

毎度、新規のサーバーに入れる時、面倒なことになるのでメモっておく。

sudo pear channel-discover pear.pdepend.org
sudo pear channel-discover pear.phpmd.org
sudo pear channel-discover pear.docblox-project.org
sudo pear channel-discover bartlett.laurent-laville.org
sudo pear channel-discover pear.phing.info 
sudo pear upgrade pear
sudo pear install --alldeps phing/phing

ついでにbuild.xmlのテンプレ

<?xml version="1.0"?>
<project name="social-in" basedir="." default="test">
  <!-- 本番用にデプロイ用の設定 -->
  <target name="deploy">
    <phingcall target="clean"></phingcall>
    <phingcall target="test"></phingcall>
    <copy file="path/to/production.yml" tofile="path/to/yaml-name.yml" overwrite="true" />

  </target>

  <!-- テスト用のタスク -->
  <target name="test">
    <phpunit3 haltonfailure="true" printsummary="true">
      <batchtest>
        <fileset dir="path/to/test">
          <include name="*Test.php"/>
        </fileset>
      </batchtest>
    </phpunit3>
  </target>

  <!-- クリア用のタスク -->
  <target name="clean">
      <delete dir="reports" includeemptydirs="true" />
      <delete dir="clover" includeemptydirs="true" />
      <delete dir="apidocs" includeemptydirs="true" />
  </target>

  <!-- カバレッジリポートを出したい時のタスク --> 
  <target name="coverage" depends="clean">
    <mkdir dir="reports/tests" />
    <mkdir dir="clover" />
    <coverage-setup database="reports/coverage.db">
      <fileset dir="path/to/classes">
        <include name="**/*.php"/>
      </fileset>
    </coverage-setup>
    <phpunit haltonfailure="true" printsummary="true" codecoverage="true">
      <formatter todir="reports" type="clover"/>
      <formatter todir="reports" type="xml"/>
      <batchtest>
        <fileset dir="path/to/test">
          <include name="*Test.php"/>
        </fileset>
      </batchtest>
    </phpunit>
    <coverage-report outfile="reports/coverage.xml">
      <report todir="clover" />
    </coverage-report>
  </target>

  <!-- ドキュメントを出力したい時のタスク --> 
  <target name="phpdoc">
    <phpdoc title="SAT Library Documentation"
            destdir="apidocs"
            sourcecode="false"
            output="HTML:Smarty:PHP">
        <fileset dir="path/to/classes">
          <include name="**/*.php" />
          <exclude name="**/pattern-exclude*" />
        </fileset>
      <projdocfileset dir=".">
        <include name="README" />
        <include name="INSTALL" />
        <include name="CHANGELOG" />
      </projdocfileset>
    </phpdoc>
  </target>
</project>
10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?