Skip to content

Commit

Permalink
Fix another branch sneaking in
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 19, 2022
1 parent 6315033 commit 6aeaadc
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions src/core.c/CompUnit/Repository/Staging.pm6
Expand Up @@ -9,40 +9,23 @@ class CompUnit::Repository::Staging is CompUnit::Repository::Installation {

method short-id() { 'staging' }

method name(--> Str) {
$!name
}

method path-spec(CompUnit::Repository::Staging:D:) {
self.^name ~ '#name(' ~ $!name ~ ')#' ~ $.prefix.absolute;
}

method source-file(Str $name --> IO::Path) {
my $file := $.prefix.add($name);
my $file = self.prefix.add($name);
$file.e ?? $file !! $!parent.source-file($name)
}

method resource($dist-id, $key) {
# check if the dist is installed here
try self.distribution($dist-id)
# we have the dist, so it's safe to access the resource the normal way
?? callsame()
# lookup failed, so it's probably not installed here
!! $!parent.resource($dist-id, $key)
}

sub files($io) {
$io.dir.map: {
dd $_;
}
}

method deploy() {
my $from := $.prefix.absolute;
my $relpath := $from.chars;
my $to := $!parent.prefix;

for Rakudo::Internals.DIR-RECURSE($from) -> $path {
my $destination := $to.add($path.substr($relpath));
$destination.parent.mkdir;
$destination.spurt: $path.IO.slurp(:bin);
}
try self.distribution($dist-id) # check if the dist is installed here
?? callsame() # we have the dist, so it's safe to access the resource the normal way
!! $!parent.resource($dist-id, $key) # lookup failed, so it's probably not installed here
}
}

Expand Down

0 comments on commit 6aeaadc

Please sign in to comment.