| 1 | package RDF::DOAP::Version; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||
| 4 | 2 | our $VERSION = '0.105'; | |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 7 | 2 | extends qw(RDF::DOAP::Resource); | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use RDF::DOAP::ChangeSet; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use RDF::DOAP::Change; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use RDF::DOAP::Person; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use RDF::DOAP::Types -types; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use RDF::DOAP::Utils -traits; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use List::Util qw(uniq); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Text::Wrap qw(wrap); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use RDF::Trine::Namespace qw(rdf rdfs owl xsd); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 18 | 2 | my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#'); | |||||||||||||||||||||||||||||
| 19 | 2 | my $dc = 'RDF::Trine::Namespace'->new('http://purl.org/dc/terms/'); | |||||||||||||||||||||||||||||
| 20 | 2 | my $dcs = 'RDF::Trine::Namespace'->new('http://ontologi.es/doap-changeset#'); | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||
| 22 | has $_ => ( | ||||||||||||||||||||||||||||||
| 23 | traits => [ WithURI ], | ||||||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||||
| 25 | isa => String, | ||||||||||||||||||||||||||||||
| 26 | coerce => 1, | ||||||||||||||||||||||||||||||
| 27 | uri => $doap->$_, | ||||||||||||||||||||||||||||||
| 28 | 2 | ) for qw( revision name branch ); | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||
| 30 | 2 | has issued => ( | |||||||||||||||||||||||||||||
| 31 | traits => [ WithURI ], | ||||||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||||
| 33 | isa => String, | ||||||||||||||||||||||||||||||
| 34 | coerce => 1, | ||||||||||||||||||||||||||||||
| 35 | uri => $dc->issued, | ||||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||
| 38 | has changesets => ( | ||||||||||||||||||||||||||||||
| 39 | traits => [ WithURI ], | ||||||||||||||||||||||||||||||
| 40 | is => 'ro', | ||||||||||||||||||||||||||||||
| 41 | isa => ArrayRef[ChangeSet], | ||||||||||||||||||||||||||||||
| 42 | coerce => 1, | ||||||||||||||||||||||||||||||
| 43 | uri => $dcs->changeset, | ||||||||||||||||||||||||||||||
| 44 | multi => 1, | ||||||||||||||||||||||||||||||
| 45 | 7 | ▶ | trigger => sub { $_[0]->clear_changes }, | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 46 | 2 | ); | |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||
| 48 | 2 | has changes => ( | |||||||||||||||||||||||||||||
| 49 | is => 'ro', | ||||||||||||||||||||||||||||||
| 50 | isa => ArrayRef[Change], | ||||||||||||||||||||||||||||||
| 51 | coerce => 1, | ||||||||||||||||||||||||||||||
| 52 | lazy => 1, | ||||||||||||||||||||||||||||||
| 53 | builder => '_build_changes', | ||||||||||||||||||||||||||||||
| 54 | clearer => 'clear_changes', | ||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||
| 57 | 2 | has released_by => ( | |||||||||||||||||||||||||||||
| 58 | traits => [ WithURI, Gathering ], | ||||||||||||||||||||||||||||||
| 59 | is => 'ro', | ||||||||||||||||||||||||||||||
| 60 | isa => Person, | ||||||||||||||||||||||||||||||
| 61 | coerce => 1, | ||||||||||||||||||||||||||||||
| 62 | uri => $dcs->uri('released-by'), | ||||||||||||||||||||||||||||||
| 63 | gather_as => ['maintainer'], | ||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||
| 66 | 2 | has _changelog_subsections => ( | |||||||||||||||||||||||||||||
| 67 | is => 'ro', | ||||||||||||||||||||||||||||||
| 68 | isa => ArrayRef[ArrayRef], | ||||||||||||||||||||||||||||||
| 69 | lazy => 1, | ||||||||||||||||||||||||||||||
| 70 | builder => '_build_changelog_subsections', | ||||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||
| 73 | sub _build_changes | ||||||||||||||||||||||||||||||
| 74 | 7 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
_build_changes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 75 | 7 | my $self = shift; | |||||||||||||||||||||||||||||
| 76 | 7 | ▶ | [ map { @{$_->items} } @{$self->changesets || []} ]; | ||||||||||||||||||||||||||||
|
Condition100%2/2
$self->changesets || []
MC/DC100%1/1
$self->changesets || []
$self->changesets
Truth table100%2/2
A
A= $self->changesets
| |||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||
| 79 | sub changelog_section | ||||||||||||||||||||||||||||||
| 80 | 7 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
changelog_section: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 81 | 7 | my $self = shift; | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||
| 83 | 7 | my @ss = @{ $self->_changelog_subsections }; | |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | if (@ss == 1 and $ss[0][0] eq 'Other') | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@ss == 1 and $ss[0][0] eq "Other"
MC/DC100%2/2
@ss == 1 and $ss[0][0] eq "Other"
@ss == 1
$ss[0][0] eq "Other"
Truth table100%3/3
A and B
A= @ss == 1B= $ss[0][0] eq "Other"
| |||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||
| 87 | # If there's only an "Other" section, then avoid | ||||||||||||||||||||||||||||||
| 88 | # printing a section header for it. | ||||||||||||||||||||||||||||||
| 89 | return join( | ||||||||||||||||||||||||||||||
| 90 | "\n", | ||||||||||||||||||||||||||||||
| 91 | $self->_changelog_section_header, | ||||||||||||||||||||||||||||||
| 92 | map { | ||||||||||||||||||||||||||||||
| 93 | 1 | my ($head, @lines) = @$_; | |||||||||||||||||||||||||||||
| 94 | 1 | (sort(@lines), ''); | |||||||||||||||||||||||||||||
| 95 | } @ss, | ||||||||||||||||||||||||||||||
| 96 | ); | ||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||
| 99 | return join( | ||||||||||||||||||||||||||||||
| 100 | "\n", | ||||||||||||||||||||||||||||||
| 101 | $self->_changelog_section_header, | ||||||||||||||||||||||||||||||
| 102 | map { | ||||||||||||||||||||||||||||||
| 103 | 6 | my ($head, @lines) = @$_; | |||||||||||||||||||||||||||||
| 104 | 7 | (" [ $head ]", sort(@lines), ''); | |||||||||||||||||||||||||||||
| 105 | } @ss, | ||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||
| 109 | sub _changelog_section_header | ||||||||||||||||||||||||||||||
| 110 | 8 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
_changelog_section_header: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||
| 111 | 8 | my $self = shift; | |||||||||||||||||||||||||||||
| 112 | 8 | ▶ | return join( | ||||||||||||||||||||||||||||
|
Condition60%3/5
$self->issued // "Unknown"
$self->name // $self->label
MC/DC0%0/1
$self->issued // "Unknown"
$self->issued
MC/DC50%1/2
$self->name // $self->label
$self->name
$self->label
Truth table50%1/2
A
A= $self->issued
Truth table66%2/3
A // B
A= $self->nameB= $self->label
| |||||||||||||||||||||||||||||||
| 113 | "\t", | ||||||||||||||||||||||||||||||
| 114 | grep( | ||||||||||||||||||||||||||||||
| 115 | defined, | ||||||||||||||||||||||||||||||
| 116 | $self->revision, | ||||||||||||||||||||||||||||||
| 117 | ($self->issued // 'Unknown'), | ||||||||||||||||||||||||||||||
| 118 | ($self->name // $self->label), | ||||||||||||||||||||||||||||||
| 119 | ), | ||||||||||||||||||||||||||||||
| 120 | ) . "\n"; | ||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||
| 123 | sub _subsection_order | ||||||||||||||||||||||||||||||
| 124 | 7 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
_subsection_order: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 125 | 7 | my $self = shift; | |||||||||||||||||||||||||||||
| 126 | 7 | uniq(map $_->[1], $self->_subsection_classification); | |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||
| 129 | sub _subsection_classification | ||||||||||||||||||||||||||||||
| 130 | 14 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
_subsection_classification: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 131 | ( | ||||||||||||||||||||||||||||||
| 132 | 14 | [$dcs->SecurityFix => 'SECURITY', 'Fix'], | |||||||||||||||||||||||||||||
| 133 | [$dcs->SecurityRegression => 'SECURITY', 'Regression'], | ||||||||||||||||||||||||||||||
| 134 | [$dcs->BackCompat => 'BACK COMPAT'], | ||||||||||||||||||||||||||||||
| 135 | [$dcs->Regression => 'REGRESSIONS'], | ||||||||||||||||||||||||||||||
| 136 | [$dcs->Bugfix => 'Bug Fixes'], | ||||||||||||||||||||||||||||||
| 137 | [$dcs->Documentation => 'Documentation'], | ||||||||||||||||||||||||||||||
| 138 | [$dcs->Tests => 'Test Suite'], | ||||||||||||||||||||||||||||||
| 139 | [$dcs->Packaging => 'Packaging'], | ||||||||||||||||||||||||||||||
| 140 | [$dcs->Addition => 'Other', 'Added'], | ||||||||||||||||||||||||||||||
| 141 | [$dcs->Removal => 'Other', 'Removed'], | ||||||||||||||||||||||||||||||
| 142 | [$dcs->Update => 'Other', 'Updated'], | ||||||||||||||||||||||||||||||
| 143 | [$dcs->Change => 'Other'], | ||||||||||||||||||||||||||||||
| 144 | ); | ||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||
| 147 | sub _build_changelog_subsections | ||||||||||||||||||||||||||||||
| 148 | 7 | ▶ | { | ||||||||||||||||||||||||||||
|
Subroutine
_build_changelog_subsections: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||
| 149 | 7 | my $self = shift; | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||
| 151 | 7 | my %sections; | |||||||||||||||||||||||||||||
| 152 | 7 | my @classifications = $self->_subsection_classification; | |||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||
| 154 | 7 | for my $ch (@{ $self->changes }) | |||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||
| 156 | 8 | my $found_section; | |||||||||||||||||||||||||||||
| 157 | 8 | for my $class (@classifications) | |||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||
| 159 | 54 | my ($type, $section, $tag) = @$class; | |||||||||||||||||||||||||||||
| 160 | 54 | ▶ | if ( $ch->isa($type) ) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||
| 162 | 7 | my $text = join "\n", $ch->changelog_lines(1); | |||||||||||||||||||||||||||||
| 163 | 7 | ▶ | $text = "$tag: $text" if $tag; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 164 | 7 | push @{ $sections{$section} }, wrap(" - ", " ", $text); | |||||||||||||||||||||||||||||
| 165 | 7 | $found_section++; | |||||||||||||||||||||||||||||
| 166 | 7 | last; | |||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||
| 169 | 8 | ▶ | unless ($found_section) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||
| 171 | 1 | my $text = join "\n", $ch->changelog_lines(1); | |||||||||||||||||||||||||||||
| 172 | 1 | push @{ $sections{Other} }, wrap(" - ", " ", $text); | |||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||
| 176 | return [ | ||||||||||||||||||||||||||||||
| 177 | 7 | ▶ | map { exists($sections{$_}) ? [$_, @{$sections{$_}}] : (); } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 178 | $self->_subsection_order | ||||||||||||||||||||||||||||||
| 179 | ]; | ||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||
| 182 | 2 | 1; | |||||||||||||||||||||||||||||