Skip to content

Commit 216ba14

Browse files
committed
Make most Whateverable code repo-agnostic
So that it can work with moarvm builds or anything else.
1 parent 3ed10e7 commit 216ba14

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Whateverable.pm6

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use Text::Diff::Sift4;
3030
use Misc;
3131

3232
constant RAKUDO = ./rakudo.IO.absolute;
33+
constant MOARVM = ./moarvm.IO.absolute;
3334
constant CONFIG = ./config.json.IO.absolute;
3435
constant SOURCE = https://github.com/perl6/whateverable;
3536
constant WIKI = https://github.com/perl6/whateverable/wiki/;
@@ -125,10 +126,10 @@ method build-exists($full-commit-hash, :$backend=‘rakudo-moar’) {
125126
{ARCHIVES-LOCATION}/$backend/$full-commit-hash.zst.IO ~~ :e
126127
}
127128

128-
method get-similar($tag-or-hash, @other?) {
129+
method get-similar($tag-or-hash, @other?, :$repo=RAKUDO) {
129130
my $old-dir = $*CWD;
130131
LEAVE chdir $old-dir;
131-
chdir RAKUDO;
132+
chdir $repo;
132133

133134
my @options = @other;
134135
my @tags = self.get-output(git, tag, --format=%(*objectname)/%(objectname)/%(refname:strip=2),
@@ -194,15 +195,15 @@ method run-snippet($full-commit-hash, $file, :$backend=‘rakudo-moar’, :$time
194195
}
195196
}
196197

197-
method get-commits($config) {
198+
method get-commits($config, :$repo=RAKUDO) {
198199
my $old-dir = $*CWD;
199200
LEAVE chdir $old-dir;
200201
my @commits;
201202

202203
if $config.contains: , {
203204
@commits = $config.split: ,;
204205
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
205-
chdir RAKUDO; # goes back in LEAVE
206+
chdir $repo; # goes back in LEAVE
206207
if run(:out(Nil), git, rev-parse, --verify, $<start>).exitcode ≠ 0 {
207208
return Bad start, cannot find a commit for “$<start>”;
208209
}
@@ -215,9 +216,9 @@ method get-commits($config) {
215216
my $num-commits = @commits.elems;
216217
return Too many commits ($num-commits) in range, you're only allowed {COMMITS-LIMIT} if $num-commits > COMMITS-LIMIT
217218
} elsif $config ~~ /:i ^ [ releases | v? 6 \.? c ] $/ {
218-
@commits = self.get-tags: 2015-12-24
219+
@commits = self.get-tags: 2015-12-24, repo => $repo
219220
} elsif $config ~~ /:i ^ all $/ {
220-
@commits = self.get-tags: 2014-01-01
221+
@commits = self.get-tags: 2014-01-01, repo => $repo
221222
} elsif $config ~~ /:i ^ compare \s $<commit>=\S+ $/ {
222223
@commits = $<commit>
223224
} else {
@@ -227,9 +228,9 @@ method get-commits($config) {
227228
return Nil, |@commits # TODO throw exceptions instead of doing this
228229
}
229230

230-
method get-tags($date) {
231+
method get-tags($date, :$repo=RAKUDO) {
231232
my $old-dir = $*CWD;
232-
chdir RAKUDO;
233+
chdir $repo;
233234
LEAVE chdir $old-dir;
234235

235236
my @tags = <HEAD>;
@@ -245,9 +246,9 @@ method get-tags($date) {
245246
@tags.reverse
246247
}
247248

248-
method to-full-commit($commit, :$short = False) {
249+
method to-full-commit($commit, :$short=False, :$repo=RAKUDO) {
249250
my $old-dir = $*CWD;
250-
chdir RAKUDO;
251+
chdir $repo;
251252
LEAVE chdir $old-dir;
252253

253254
return if run(:out(Nil), git, rev-parse, --verify, $commit).exitcode ≠ 0; # make sure that $commit is valid

0 commit comments

Comments
 (0)