Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created May 19, 2017 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/5909465f90fd10453b750b7fb4915598 to your computer and use it in GitHub Desktop.
Save zoffixznet/5909465f90fd10453b750b7fb4915598 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use v6.d.PREVIEW;
use WWW;
constant ECO_API = 'https://modules.perl6.org/.json';
class Zefyr {
method top100 {
my @modules = jget(ECO_API)<dists>.sort(-*<stars>).grep({
try Date.new(.<date_updated>) after Date.today.earlier: :4months
})»<name>.grep(none |<p6doc panda v5>, /^ "Inline::"/).head: 100;
say "Installing @modules[]";
my $outdir = 'output'.IO.mkdir.self;
my role ModuleNamer[$name] { method Module-Name { $name } }
my @results = @modules.map: -> $module {
start {
with run :out, :err, <zef --serial --debug install>, $module {
my $out = .out.slurp: :close;
$outdir.add($module.subst: :g, /\W+/, '-').spurt:
"ERR: {.err.slurp: :close}\n\n-----\n\nOUT: $out\n";
$out
}
} does ModuleNamer[$module]
}
say "Started {+@results} Promises. Awaiting results";
while @results {
await Promise.anyof: @results;
my @ready = @results.grep: *.so;
@results .= grep: none @ready;
for @ready {
say .Module-Name ~ ': ', .status ~~ Kept
?? <SUCCEEDED! FAILED!>[.result.contains: 'FAILED']
!! "died with {.cause}";
}
}
}
}
sub MAIN (:$top100) {
Zefyr.new.top100;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment