| 1 | package RDF::DOAP::Change; | ||||||||||||||||||||||||||||||||||||||||||
| 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::Person; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use RDF::DOAP::Types -types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use RDF::DOAP::Utils -traits; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use List::Util qw(uniq); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use Text::Wrap qw(wrap); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use RDF::Trine::Namespace qw(rdf rdfs owl xsd); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#'); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | my $dc = 'RDF::Trine::Namespace'->new('http://purl.org/dc/terms/'); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | my $dcs = 'RDF::Trine::Namespace'->new('http://ontologi.es/doap-changeset#'); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | has blame => ( | |||||||||||||||||||||||||||||||||||||||||
| 21 | traits => [ WithURI, Gathering ], | ||||||||||||||||||||||||||||||||||||||||||
| 22 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | isa => ArrayRef[Person], | ||||||||||||||||||||||||||||||||||||||||||
| 24 | coerce => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | uri => $dcs->blame, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | multi => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | gather_as => ['contributor'], | ||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | has thanks => ( | |||||||||||||||||||||||||||||||||||||||||
| 31 | traits => [ WithURI, Gathering ], | ||||||||||||||||||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | isa => ArrayRef[Person], | ||||||||||||||||||||||||||||||||||||||||||
| 34 | coerce => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | uri => $dcs->thanks, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | multi => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | gather_as => ['thanks'], | ||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | our %ROLES = ( | |||||||||||||||||||||||||||||||||||||||||
| 41 | $dcs->Addition => 'RDF::DOAP::Change::Addition', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | $dcs->Removal => 'RDF::DOAP::Change::Removal', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | $dcs->Bugfix => 'RDF::DOAP::Change::Bugfix', | ||||||||||||||||||||||||||||||||||||||||||
| 44 | $dcs->Update => 'RDF::DOAP::Change::Update', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | $dcs->Regression => 'RDF::DOAP::Change::Regression', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | $dcs->Documentation => 'RDF::DOAP::Change::Documentation', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | $dcs->Packaging => 'RDF::DOAP::Change::Packaging', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | $dcs->SecurityFix => 'RDF::DOAP::Change::SecurityFix', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | $dcs->SecurityRegression => 'RDF::DOAP::Change::SecurityRegression', | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | sub BUILD | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=6 SCAR=18.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 9 | ▶ | my @roles = grep defined, map $ROLES{$_}, @{ $self->rdf_type || [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->rdf_type || []
MC/DC0%0/1
$self->rdf_type || []
$self->rdf_type
Truth table50%1/2
A
A= $self->rdf_type
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ▶ | push @roles, $ROLES{$dcs->Bugfix} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$self->has_rdf_about and $self->has_rdf_model and $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
$self->has_rdf_about and $self->has_rdf_model
MC/DC33%1/3
$self->has_rdf_about and $self->has_rdf_model and $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
$self->has_rdf_about
$self->has_rdf_model
$self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
Truth table50%2/4
A and B and C
A= $self->has_rdf_aboutB= $self->has_rdf_modelC= $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | if $self->has_rdf_about | ||||||||||||||||||||||||||||||||||||||||||
| 59 | && $self->has_rdf_model | ||||||||||||||||||||||||||||||||||||||||||
| 60 | && $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef); | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | ▶ | $self->Moose::Util::apply_all_roles(uniq @roles) if @roles; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | sub changelog_entry | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changelog_entry: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $text = join "\n", $self->changelog_lines; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | wrap(" - ", " ", $text); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | sub changelog_lines | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changelog_lines: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 8 | my ($notype) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 8 | my @lines; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 8 | ▶ | if ($notype) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 8 | @lines = $self->label; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | else | ||||||||||||||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my @type = sort map $_->uri =~ m{(\w+)$}, @{ $self->rdf_type }; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | @lines = "(@type) " . $self->label; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 8 | ▶ | for my $person (uniq sort @{$self->blame||[]}, @{$self->thanks||[]}) | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$self->blame || []
$self->thanks || []
MC/DC100%1/1
$self->blame || []
$self->blame
MC/DC100%1/1
$self->thanks || []
$self->thanks
Truth table100%2/2
A
A= $self->blame
Truth table100%2/2
A
A= $self->thanks
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | push @lines, sprintf("%s++", $person->to_string('compact')); | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 8 | push @lines, $self->changelog_links; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 8 | return @lines; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | sub changelog_links | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changelog_links: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | ▶ | return @{ $self->see_also || [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->see_also || []
MC/DC0%0/1
$self->see_also || []
$self->see_also
Truth table50%1/2
A
A= $self->see_also
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||