Skip to content

Instantly share code, notes, and snippets.

@ugexe

ugexe/CURI.pm6 Secret

Created August 3, 2017 03:57
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 ugexe/c31932c2c4b2e991c59a3a239f28d63c to your computer and use it in GitHub Desktop.
Save ugexe/c31932c2c4b2e991c59a3a239f28d63c to your computer and use it in GitHub Desktop.
my @comp-units = (
self!repository-version < 1
?? $lookup.lines.unique.map({
# Old, slower, repo format - must parse json meta data to determine name/auth/ver
my $dist = self.distribution($_);
CompUnit.new(
repo => self,
short-name => $spec.short-name,
auth => $dist.meta<auth>,
version => Version.new( $dist.meta<ver> || 0 ),
api => Version.new( $dist.meta<api> || 0 ),
repo-id => (
$dist.meta<provides>{$spec.short-name}.values[0]<file>
|| $dist.meta<files>{$spec.short-name}
|| Any
),
distribution => $dist,
)
})
!! $lookup.dir.map({
# Faster repo format stores common data in a non-json format for quicker lookups
my ($ver, $auth, $api, $source, $checksum) = $_.slurp.split("\n");
my $dist = self!lazy-distribution($_.basename);
CompUnit.new(
repo => self,
short-name => $spec.short-name,
auth => $auth,
version => Version.new( $ver || 0 ),
api => Version.new( $api || 0 ),
repo-id => $source,
distribution => $dist,
checksum => $checksum,
)
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment