Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
restructure Distribution; do work once
  • Loading branch information
FROGGS committed May 19, 2015
1 parent 4924f04 commit 7b6caee
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/core/Distribution.pm
Expand Up @@ -2,33 +2,34 @@ class Distribution {
has $.id is rw;
has $.name;
has $.auth;
has $.author;
has $.authority;
has $.ver;
has $.version;
has $.description;
has @.depends;
has %.provides;
has %.files;
has $.source-url;
method auth { $!auth // $!author // $!authority }
method ver { $!ver // $!version }
method hash {
{
:$!id,
:$!name,
:$.auth,
:$.ver,
:$!description,
:@!depends,
:%!provides,
:%!files,
:$!source-url,

submethod BUILD(
:$!id,
:authority(:author(:$!auth)) = '',
:$!name = '',
:version(:$!ver) = Version.new('0'),
:$!description,
:@!depends,
:%!provides,
:%!files,
:$!source-url,
) {
unless nqp::istype($!ver, Version) {
$!ver = !$!ver || $!ver eq '*'
?? Version.new('0')
!! Version.new(~$!ver)
}
}
}

# during CURLI migration period
class CompUnitRepo::Distribution is Distribution {
method Hash { self.hash }
# XXX Needed for Inline::Perl5:
# https://github.com/niner/Inline-Perl5/blob/master/lib/Inline/Perl5.pm6#L22
multi sub postcircumfix:<{ }> (Distribution:D \d, "files" ) {
d.files
}

0 comments on commit 7b6caee

Please sign in to comment.