2017 © Pedro Peláez
 

library diffdir

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

image

tomk79/diffdir

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  • Monday, May 8, 2017
  • by tomk79
  • Repository
  • 1 Watchers
  • 1 Stars
  • 49 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

diffdir

diffdir は、2つのディレクトリを比較し、差分のあったファイルを抽出します。, (*1)

比較した内容は1ファイル1行のCSVファイルに記録され、ファイルごとの差分を確認できるHTMLファイルを出力します。, (*2)

インストール手順 - Install

diffdir のインストールには composer を使用します。, (*3)

$ cd {$yourDirectory}
$ composer create-project tomk79/diffdir ./

使い方 - Usage

基本的な使い方 - Basic usage.

$ php ./diffdir.php {$path_dirA} {$path_dirB}

サンプルデータを比較する例 - Example: diff of sample data.

$ php ./diffdir.php ./tests/sample_a/ ./tests/sample_b/

オプション

-o 結果の出力先ディレクトリを指定する

-o オプションをつけて、出力先ディレクトリを指定します。, (*4)

$ php ./diffdir.php -o ./result_sample/ ./tests/sample_a/ ./tests/sample_b/

--strip-crlf 改行コードを無視する

--strip-crlf オプションをつけて比較すると、改行コードだけの違いは無視されます。, (*5)

$ php ./diffdir.php --strip-crlf ./tests/sample_a/ ./tests/sample_b/

-v 詳細なメッセージを出力する

-v オプションをつけて比較すると、ターミナル上に処理の詳細が表示されます。, (*6)

$ php ./diffdir.php -v ./tests/sample_a/ ./tests/sample_b/

-q メッセージを表示しない

-q オプションをつけて比較すると、ターミナル上の表示の一切が隠されます。, (*7)

$ php ./diffdir.php -q ./tests/sample_a/ ./tests/sample_b/

PHPスクリプト内で使用する

<?php
require_once( './vendor/autoload.php' );
$diffdir = new tomk79\diffdir(
    '/path/before/', // path before
    '/path/after/',  // path after
    array( // options
        'output'=>'/path/path_output_dir/', // -o
        'strip_crlf'=>true, // --strip-crlf
        'verbose'=>true // -v
    )
);
if( $diffdir->is_error() ){
    print 'ERROR.'."\n";
    var_dump( $diffdir->get_errors() );
}else{
    print 'success.'."\n";
    print ''."\n";
    print 'see: '.$diffdir->get_output_dir()."\n";
}

ライセンス - License

MIT License, (*8)

作者 - Author

付録 - Appendix

composer のインストール

composer のインストール方法について 詳しくは composerの公式サイト(英語) を参照してください。, (*9)

下記は公式サイトからの抜粋です。参考までに。, (*10)

Macの方

Mac の方は、次のコマンドでグローバルインストールできます。, (*11)

$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer

Windowsの方

Windows の方は、GUIインストーラ Composer-Setup.exe が用意されています。 次のコマンドでもインストールできますので、お好みの方法でインストールしてください。, (*12)

$ cd C:\bin
$ php -r "readfile('https://getcomposer.org/installer');" | php

開発者向け情報 - for Developer

テスト - Test

$ cd (project directory)
$ ./vendor/phpunit/phpunit/phpunit php/tests/diffdirTest

The Versions

08/05 2017

dev-develop

dev-develop

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

07/05 2017

dev-master

9999999-dev

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

07/05 2017

0.4.0

0.4.0.0

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

27/12 2015

0.3.0

0.3.0.0

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

25/12 2014

0.2.2

0.2.2.0

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

09/11 2014

0.2.1

0.2.1.0

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

08/11 2014

0.2.0

0.2.0.0

2つのディレクトリを比較し、検出された差分をレポートしてくれるコマンドです。ライブラリとしても利用できます。

  Sources   Download

MIT

The Requires

 

The Development Requires

10/09 2014

0.1.0

0.1.0.0

file system utility.

  Sources   Download

MIT

The Requires

 

The Development Requires