Created
February 29, 2012 14:27
-
-
Save masaki/1941204 to your computer and use it in GitHub Desktop.
recent job detector
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; | |
use String::CamelCase qw(decamelize); | |
use Getopt::Long; | |
use List::MoreUtils qw(uniq); | |
GetOptions('a|app=s', \my $app); | |
my @changes = @ARGV; | |
my @tests; | |
for my $changed (@changes) { | |
if ($changed =~ m!t/.+\.t$!) { | |
push @tests, $changed; | |
} elsif ($changed =~ m!(.+/)?lib/(.+)\.pm$!) { | |
my @comps = map { decamelize($_) } split m!/!, $2; | |
shift @comps if $comps[0] eq $app; | |
my $base = join '/', ($1 || '') . 't', @comps; | |
push @tests, glob("${base}.t"), glob("${base}/*.t"); | |
} | |
} | |
print "$_\n" for uniq sort @tests; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment