Created
October 4, 2015 06:06
-
-
Save yosugi/4ce856e9f9c4eba6d40c to your computer and use it in GitHub Desktop.
git-diff-test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| sub checkPhp { | |
| my ($file) = @_; | |
| return if ($file !~ /\.php$/); | |
| my $ret = `php -l $file 2> /dev/null`; | |
| if ($? == 0) { | |
| print 'lint OK ' . $file . "\n"; | |
| } else { | |
| print 'lint NG ' . $file . "\n"; | |
| print STDERR $ret; | |
| } | |
| } | |
| sub runPhpUnit { | |
| my ($file) = @_; | |
| return if ($file !~ /Test\.php$/); | |
| my $ret = `phpunit $file 2> /dev/null`; | |
| if ($? == 0) { | |
| print 'test OK ' . $file . "\n"; | |
| } else { | |
| print 'test NG ' . $file . "\n"; | |
| print STDERR $ret; | |
| } | |
| } | |
| __END__ | |
| =head1 NAME | |
| git-diff-test - run lint to changed files | |
| =head1 SYNOPSIS | |
| $ git diff-test [<commit>] | |
| =head1 USAGE | |
| git diff-test HEAD^^ | |
| git diff-test branch_name | |
| git diff-test tag_name | |
| git diff-test commit..commit | |
| =head1 AUTHOR | |
| yosugi | |
| =head1 LICENSE | |
| MIT License (http://opensource.org/licenses/mit-license.php) | |
| =cut |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment