Skip to content

Commit

Permalink
Adds URLS
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Feb 8, 2019
1 parent b2711e8 commit a9df30b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lib/Utils.pm6
Expand Up @@ -32,3 +32,16 @@ sub get-issues($token) is export {
sub modules-not-ok( $file = "data/blin-output.txt" ) is export {
$file.IO.slurp.lines.grep( / \– \s+ <!before OK>/ ).map( (*.words)[0] );
}

#! Issue per module
sub issue-per-module( @tickets, @modules --> Hash ) is export {
my %issues-by-title = @tickets.map: { $_<title> => $_<url> };
my %issue-per-module;
for @modules -> $m {
%issue-per-module{$m} = %issues-by-title{$m}:exists??%issues-by-title{$m}!!Nil;
}
return %issue-per-module;

}

#| Edit issue
7 changes: 6 additions & 1 deletion t/1.t6
Expand Up @@ -10,10 +10,15 @@ ok Utils::url, "{Utils::url} is declared";
my $file = "data/blin-output.txt".IO.e??"data/blin-output.txt"!!"../data/blin-output.txt";
my @not-ok-modules = modules-not-ok( $file );
ok @not-ok-modules, "Some modules are not OK";
my @tickets;
if %*ENV{'GH_TOKEN'} {
my @tickets = get-issues( %*ENV{'GH_TOKEN'} );
@tickets = get-issues( %*ENV{'GH_TOKEN'} );
ok @tickets, "Downloads tickets";
cmp-ok @tickets.elems, ">", 1, "There are tickets";
my %mapping = issue-per-module( @tickets, @not-ok-modules );
ok %mapping, "Mapping done";
dd %mapping;
} else {
skip "No token for issues",1;
}

0 comments on commit a9df30b

Please sign in to comment.