Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
diagnose days running clean/dirty
  • Loading branch information
coke committed Apr 9, 2013
1 parent 040ecd5 commit b00393c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions bin/days_since.pl
@@ -0,0 +1,36 @@
use v6;

my $day;
my %status;

my @dates;
for lines open 'perl6_pass_rates' -> $line {
if $line ~~ /^ '#' \s* (\d\d)\/(\d\d)\/(\d\d\d\d) / {
$day = Date.new(+$2, +$0, +$1);
@dates.push($day);
} elsif $line ~~ /^ '"' (\w+) '"' \s* ',' \s* (\d+) \s* ',' \s* (\d+)/ {
%status{~$0}{$day} = $2 eq "0";
}
}

my @x = gather for %status.keys -> $impl {
my $state;
my $date;
for @dates -> $day {
my $new_state = %status{$impl}{$day};

FIRST $date = $day;
if ! $state.defined { $state = $new_state }

if ($state ne $new_state) {
my $diff = @dates[0] - $day;
take "$impl has been " ~ ($state ?? "clean" !! "dirty") ~
" for " ~ $diff ~ " day" ~ ($diff != 1 ?? "s" !! "") ~ ".";
last;
}

$date = $day;
}
}

say @x.join(" ");

0 comments on commit b00393c

Please sign in to comment.