Permalink
Browse files

Be smarter when figuring out date of last release

Current algo only works when script is run in the month
following the month of last release.

Improve by using the date of last commit to VERSION file.
  • Loading branch information...
zoffixznet committed Dec 19, 2016
1 parent 08ff3db commit 27761645c59446090d895e50e5cd7a1ab3a93ab7
Showing with 11 additions and 7 deletions.
  1. +11 −7 tools/contributors.pl6
@@ -7,14 +7,9 @@ sub MAIN (
:$nqp = 'nqp',
:$moar = 'nqp/MoarVM',
:$roast = 't/spec',
:$show-missing-names,
) {
$last_release //= do {
Date.new-from-daycount:
.daycount # daycount for 1st of previous month
+ (.day-of-week == 7 ?? 6 !! 6 - .day-of-week) # offset of the first Saturday
+ 2*7 # add two extra weeks, to get 3rd Saturday
given Date.today.earlier(:1month).truncated-to: 'month';
}
$last_release //= get-last-release-date-for $rakudo;
# Check all the places with repos that may be applicable. Get all of the
# committers in that repo since the given date as commit ID => author pairs.
@@ -52,6 +47,15 @@ sub MAIN (
say @contributors.join(', ');
}
sub get-last-release-date-for ($rakudo-repo) {
given $rakudo-repo.IO.child('VERSION') {
.e or die "Could not find rakudo's VERSION file at $_";
Date.new: Instant.from-posix: shell(
:out, :cwd($rakudo-repo), "git log --pretty='format:%ct' $_"
).out.lines.head;
}
}
sub get-committers($repo, $since) {
die "Expected a repo in `$repo` but did not find one"
unless $repo.IO.d && "$repo/.git".IO.d;

0 comments on commit 2776164

Please sign in to comment.