Skip to content

Commit

Permalink
Add author, meta6 fields
Browse files Browse the repository at this point in the history
Add support for spec version.
  • Loading branch information
jonathanstowe committed Jan 2, 2016
1 parent bfb0c4d commit 468ff00
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/META6.pm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class META6:ver<v0.0.2>:auth<github:jonathanstowe> does JSON::Class {

role MetaAttribute {
has Optionality $.optionality is rw;
has Version $.spec-version is rw = Version.new(0);
}

role MetaAttribute::Specfication does MetaAttribute {
Expand All @@ -117,11 +118,23 @@ class META6:ver<v0.0.2>:auth<github:jonathanstowe> does JSON::Class {
}

multi sub trait_mod:<is> (Attribute $a, Optionality :$specification!) {
set-specification($a, $specification);
}


multi sub trait_mod:<is> (Attribute $a, :@specification! (Optionality $optionality, Version $spec-version)) {
set-specification($a, $optionality, $spec-version);
}

my sub set-specification(Attribute $a, Optionality $optionality = Optional, Version $spec-version = Version.new(0)) {
$a does MetaAttribute::Specfication;
$a.optionality = $specification // Optional;
$a.optionality = $optionality // Optional;
$a.spec-version = $spec-version // Version.new(0);
$a;
}

multi sub trait_mod:<is> (Attribute $a, :$customary ) {

multi sub trait_mod:<is> (Attribute $a, :$customary! ) {
$a does MetaAttribute::Customary;
$a.optionality = Optional;
$a.where = $customary ~~ Str ?? $customary !! 'unknown';
Expand Down Expand Up @@ -163,11 +176,13 @@ class META6:ver<v0.0.2>:auth<github:jonathanstowe> does JSON::Class {
}


has Version $.meta6 is rw is marshalled-by('Str') is unmarshalled-by(&unmarsh-version) is specification(Optional) = Version.new(0);
has Version $.perl is rw is marshalled-by('Str') is unmarshalled-by(&unmarsh-version) is specification(Mandatory);
has Str $.name is rw is specification(Mandatory);
has Version $.version is rw is marshalled-by('Str') is unmarshalled-by(&unmarsh-version) is specification(Mandatory);
has Str $.description is rw is specification(Mandatory);
has Str @.authors is rw is specification(Optional);
has Str $.author is rw is customary;
has Str %.provides is rw is specification(Mandatory);
has Str @.depends is rw is specification(Optional);
has Str %.emulates is rw is specification(Optional);
Expand Down

0 comments on commit 468ff00

Please sign in to comment.