line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RDF::DOAP::Project; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
4
|
|
|
|
|
|
|
our $VERSION = '0.104'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
17
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
19
|
|
7
|
|
|
|
|
|
|
extends qw(RDF::DOAP::Resource); |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
14930
|
use RDF::DOAP::Person; |
|
2
|
|
|
|
|
97
|
|
|
2
|
|
|
|
|
99
|
|
10
|
2
|
|
|
2
|
|
1102
|
use RDF::DOAP::Version; |
|
2
|
|
|
|
|
115
|
|
|
2
|
|
|
|
|
103
|
|
11
|
2
|
|
|
2
|
|
1095
|
use RDF::DOAP::Repository; |
|
2
|
|
|
|
|
65
|
|
|
2
|
|
|
|
|
136
|
|
12
|
2
|
|
|
2
|
|
20
|
use RDF::DOAP::Types -types; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
13
|
2
|
|
|
2
|
|
11290
|
use RDF::DOAP::Utils -traits; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
18
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
740
|
use RDF::Trine::Namespace qw(rdf rdfs owl xsd); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has $_ => ( |
19
|
|
|
|
|
|
|
traits => [ WithURI ], |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => String, |
22
|
|
|
|
|
|
|
coerce => 1, |
23
|
|
|
|
|
|
|
uri => do { (my $x = $_) =~ s/_/-/g; $doap->$x }, |
24
|
|
|
|
|
|
|
) for qw(name shortdesc created description programming_language os ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has release => ( |
27
|
|
|
|
|
|
|
traits => [ WithURI ], |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => ArrayRef[Version], |
30
|
|
|
|
|
|
|
coerce => 1, |
31
|
|
|
|
|
|
|
uri => $doap->release, |
32
|
|
|
|
|
|
|
multi => 1, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has $_ => ( |
36
|
|
|
|
|
|
|
traits => [ WithURI, Gathering ], |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => ArrayRef[Person], |
39
|
|
|
|
|
|
|
coerce => 1, |
40
|
|
|
|
|
|
|
multi => 1, |
41
|
|
|
|
|
|
|
uri => $doap->$_, |
42
|
|
|
|
|
|
|
gather_as => ['maintainer'], |
43
|
|
|
|
|
|
|
) for qw( maintainer ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has $_ => ( |
46
|
|
|
|
|
|
|
traits => [ WithURI, Gathering ], |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
isa => ArrayRef[Person], |
49
|
|
|
|
|
|
|
coerce => 1, |
50
|
|
|
|
|
|
|
multi => 1, |
51
|
|
|
|
|
|
|
uri => $doap->$_, |
52
|
|
|
|
|
|
|
gather_as => ['contributor'], |
53
|
|
|
|
|
|
|
) for qw( developer documenter ); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has $_ => ( |
56
|
|
|
|
|
|
|
traits => [ WithURI, Gathering ], |
57
|
|
|
|
|
|
|
is => 'ro', |
58
|
|
|
|
|
|
|
isa => ArrayRef[Person], |
59
|
|
|
|
|
|
|
coerce => 1, |
60
|
|
|
|
|
|
|
multi => 1, |
61
|
|
|
|
|
|
|
uri => $doap->$_, |
62
|
|
|
|
|
|
|
gather_as => ['thanks'], |
63
|
|
|
|
|
|
|
) for qw( translator tester helper ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has $_ => ( |
66
|
|
|
|
|
|
|
traits => [ WithURI ], |
67
|
|
|
|
|
|
|
is => 'ro', |
68
|
|
|
|
|
|
|
isa => Identifier, |
69
|
|
|
|
|
|
|
coerce => 1, |
70
|
|
|
|
|
|
|
uri => do { (my $x = $_) =~ s/_/-/g; $doap->$x }, |
71
|
|
|
|
|
|
|
) for qw( wiki bug_database mailing_list download_page ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has $_ => ( |
74
|
|
|
|
|
|
|
traits => [ WithURI ], |
75
|
|
|
|
|
|
|
is => 'ro', |
76
|
|
|
|
|
|
|
isa => ArrayRef[Identifier], |
77
|
|
|
|
|
|
|
coerce => 1, |
78
|
|
|
|
|
|
|
uri => do { (my $x = $_) =~ s/_/-/g; $doap->$x }, |
79
|
|
|
|
|
|
|
multi => 1, |
80
|
|
|
|
|
|
|
) for qw( homepage old_homepage license download_mirror screenshots category support_forum developer_forum ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
has repository => ( |
83
|
|
|
|
|
|
|
traits => [ WithURI ], |
84
|
|
|
|
|
|
|
is => 'ro', |
85
|
|
|
|
|
|
|
isa => ArrayRef[Repository], |
86
|
|
|
|
|
|
|
coerce => 1, |
87
|
|
|
|
|
|
|
multi => 1, |
88
|
|
|
|
|
|
|
uri => $doap->repository, |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
around homepage => sub { |
92
|
|
|
|
|
|
|
my ($orig, $self, @args) = (shift, shift, @_); |
93
|
|
|
|
|
|
|
if (@args) { |
94
|
|
|
|
|
|
|
return $self->$orig(@args); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
else { |
97
|
|
|
|
|
|
|
return [ |
98
|
|
|
|
|
|
|
# de-prioritize metacpan links |
99
|
|
|
|
|
|
|
sort { |
100
|
|
|
|
|
|
|
("$a" =~ /metacpan/ && "$b" =~ /metacpan/) ? ("$a" cmp "$b") : |
101
|
|
|
|
|
|
|
("$a" =~ /metacpan/) ? 1 : |
102
|
|
|
|
|
|
|
("$b" =~ /metacpan/) ? -1 : ("$a" cmp "$b") |
103
|
|
|
|
|
|
|
} @{ $self->$orig() } |
104
|
|
|
|
|
|
|
]; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub rdf_load_all |
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
111
|
0
|
|
|
|
|
0
|
my ($model) = @_; |
112
|
0
|
|
|
|
|
0
|
map $class->rdf_load($_, $model), $model->subjects($rdf->type, $doap->Project); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub gather_all_maintainers |
116
|
|
|
|
|
|
|
{ |
117
|
0
|
|
|
0
|
0
|
0
|
require RDF::DOAP::Utils; |
118
|
0
|
|
|
|
|
0
|
my $self = shift; |
119
|
0
|
|
|
|
|
0
|
RDF::DOAP::Utils::gather_objects($self, 'maintainer'); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub gather_all_contributors |
123
|
|
|
|
|
|
|
{ |
124
|
0
|
|
|
0
|
0
|
0
|
require RDF::DOAP::Utils; |
125
|
0
|
|
|
|
|
0
|
my $self = shift; |
126
|
0
|
|
|
|
|
0
|
RDF::DOAP::Utils::gather_objects($self, 'contributor'); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub gather_all_thanks |
130
|
|
|
|
|
|
|
{ |
131
|
0
|
|
|
0
|
0
|
0
|
require RDF::DOAP::Utils; |
132
|
0
|
|
|
|
|
0
|
my $self = shift; |
133
|
0
|
|
|
|
|
0
|
RDF::DOAP::Utils::gather_objects($self, 'thanks'); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub sorted_releases |
137
|
|
|
|
|
|
|
{ |
138
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
139
|
|
|
|
|
|
|
my @rels = sort { |
140
|
12
|
0
|
0
|
|
|
308
|
($a->revision and $b->revision and version->parse($a->revision) cmp version->parse($b->revision)) or |
|
|
|
0
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
33
|
|
|
|
|
141
|
|
|
|
|
|
|
($a->issued and $b->issued and $a->issued cmp $b->issued) or |
142
|
|
|
|
|
|
|
($a->rdf_about and $b->rdf_about and $a->rdf_about->as_ntriples cmp $b->rdf_about->as_ntriples) |
143
|
1
|
|
|
|
|
3
|
} @{$self->release}; |
|
1
|
|
|
|
|
31
|
|
144
|
1
|
|
|
|
|
10
|
return \@rels; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub changelog |
148
|
|
|
|
|
|
|
{ |
149
|
1
|
|
|
1
|
0
|
169
|
my $self = shift; |
150
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
2
|
my @releases = @{ $self->sorted_releases }; |
|
1
|
|
|
|
|
5
|
|
152
|
1
|
|
|
|
|
4
|
my @filtered_releases; |
153
|
1
|
|
|
|
|
5
|
while (@releases) { |
154
|
7
|
|
|
|
|
16
|
my $next = shift @releases; |
155
|
7
|
100
|
|
|
|
19
|
if (@releases) { |
156
|
6
|
|
|
|
|
9
|
my $found_catchup = undef; |
157
|
6
|
|
|
|
|
19
|
for my $i (reverse(0 .. $#releases)) { |
158
|
26
|
50
|
|
|
|
43
|
for my $cs (@{ $releases[$i]->changesets || [] }) { |
|
26
|
|
|
|
|
631
|
|
159
|
26
|
100
|
100
|
|
|
727
|
if ($cs->has_versus and $cs->versus->revision eq $next->revision) { |
160
|
1
|
|
|
|
|
5
|
$found_catchup = $i; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
6
|
100
|
|
|
|
18
|
if ($found_catchup) { |
165
|
1
|
|
|
|
|
9
|
my @intermediates = splice(@releases, 0, $found_catchup); |
166
|
1
|
|
|
|
|
4
|
push @filtered_releases, $next->changelog_section; |
167
|
1
|
|
|
|
|
5
|
push @filtered_releases, map $_->_changelog_section_header, @intermediates; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
else { |
170
|
5
|
|
|
|
|
18
|
push @filtered_releases, $next->changelog_section; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
else { |
174
|
1
|
|
|
|
|
5
|
push @filtered_releases, $next->changelog_section; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
1
|
|
|
|
|
8
|
return join "\n", |
179
|
|
|
|
|
|
|
$self->_changelog_header, |
180
|
|
|
|
|
|
|
reverse @filtered_releases; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub _changelog_header |
184
|
|
|
|
|
|
|
{ |
185
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
186
|
1
|
|
|
|
|
30
|
my @lines = ( |
187
|
|
|
|
|
|
|
$self->name, |
188
|
|
|
|
|
|
|
("=" x length($self->name)), |
189
|
|
|
|
|
|
|
"", |
190
|
|
|
|
|
|
|
); |
191
|
|
|
|
|
|
|
push @lines, sprintf('%-14s%s', "$_->[0]:", $_->[1]) |
192
|
1
|
|
|
|
|
30
|
for grep defined($_->[1]), ( |
193
|
|
|
|
|
|
|
["Created" => $self->created], |
194
|
1
|
50
|
|
|
|
7
|
map(["Home page"=>$_], @{$self->homepage||[]}), |
195
|
|
|
|
|
|
|
["Bug tracker" => $self->bug_database], |
196
|
|
|
|
|
|
|
["Wiki" => $self->wiki], |
197
|
|
|
|
|
|
|
["Mailing list" => $self->mailing_list], |
198
|
1
|
50
|
|
|
|
28
|
map(["Maintainer"=>$_->to_string], @{$self->maintainer||[]}), |
199
|
|
|
|
|
|
|
); |
200
|
1
|
|
|
|
|
55
|
return join("\n", @lines)."\n"; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
1; |