line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::RDF::DOAP::Version; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19146
|
use 5.010; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
811
|
use utf8; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
368
|
use RDF::Trine qw[iri variable literal blank statement]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use RDF::TrineX::Parser::Pretdsl; |
9
|
|
|
|
|
|
|
use Test::More; |
10
|
|
|
|
|
|
|
use URI::Escape qw[uri_escape]; |
11
|
|
|
|
|
|
|
use URI::file; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.010'; |
14
|
|
|
|
|
|
|
our @EXPORT = qw(doap_version_ok); |
15
|
|
|
|
|
|
|
our $DOAP = RDF::Trine::Namespace->new('http://usefulinc.com/ns/doap#'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use base qw[Exporter]; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub doap_version_ok |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
my ($dist, $module) = @_; |
22
|
|
|
|
|
|
|
($module = $dist) =~ s{-}{::}g unless $module; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
eval "use $module"; |
25
|
|
|
|
|
|
|
my $version = $module->VERSION; |
26
|
|
|
|
|
|
|
my $dist_uri = iri(sprintf('http://purl.org/NET/cpan-uri/dist/%s/project', uri_escape($dist))); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $model = RDF::Trine::Model->temporary_model; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $turtle = RDF::Trine::Parser->new('Turtle'); |
31
|
|
|
|
|
|
|
while (<meta/*.{ttl,turtle,nt}>) |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my $iri = URI::file->new_abs($_); |
34
|
|
|
|
|
|
|
$turtle->parse_file_into_model("$iri", $_, $model); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $rdfxml = RDF::Trine::Parser->new('RDFXML'); |
38
|
|
|
|
|
|
|
while (<meta/*.{rdf,rdfxml,rdfx}>) |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
my $iri = URI::file->new_abs($_); |
41
|
|
|
|
|
|
|
$rdfxml->parse_file_into_model("$iri", $_, $model); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $pretdsl = RDF::TrineX::Parser::Pretdsl->new; |
45
|
|
|
|
|
|
|
while (<meta/*.{pret,pretdsl}>) |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
my $iri = URI::file->new_abs($_); |
48
|
|
|
|
|
|
|
$pretdsl->parse_file_into_model("$iri", $_, $model); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $pattern = RDF::Trine::Pattern->new( |
52
|
|
|
|
|
|
|
statement($dist_uri, $DOAP->release, variable('v')), |
53
|
|
|
|
|
|
|
statement(variable('v'), $DOAP->revision, literal($version, undef, 'http://www.w3.org/2001/XMLSchema#string')), |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
my $iter = $model->get_pattern($pattern); |
56
|
|
|
|
|
|
|
while (my $result = $iter->next) |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
pass('doap_version_ok'); |
59
|
|
|
|
|
|
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$pattern = RDF::Trine::Pattern->new( |
63
|
|
|
|
|
|
|
statement($dist_uri, $DOAP->release, variable('v')), |
64
|
|
|
|
|
|
|
statement(variable('v'), $DOAP->revision, literal($version//'0')), |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
$iter = $model->get_pattern($pattern); |
67
|
|
|
|
|
|
|
while (my $result = $iter->next) |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
pass('doap_version_ok'); |
70
|
|
|
|
|
|
|
return 1; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
diag("${module}->VERSION = $version"); |
74
|
|
|
|
|
|
|
$pattern = RDF::Trine::Pattern->new( |
75
|
|
|
|
|
|
|
statement($dist_uri, $DOAP->release, variable('v')), |
76
|
|
|
|
|
|
|
statement(variable('v'), $DOAP->revision, variable('r')), |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
$iter = $model->get_pattern($pattern); |
79
|
|
|
|
|
|
|
my $found = 0; |
80
|
|
|
|
|
|
|
while (my $result = $iter->next) |
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
diag("Found metadata for: ".$result->as_string); |
83
|
|
|
|
|
|
|
$found++; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
diag("Found no metadata for any versions.") unless $found; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
fail('doap_version_ok'); |
88
|
|
|
|
|
|
|
return 0; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding utf-8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=for stopwords ver xsd:string |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Test::RDF::DOAP::Version - tests 'meta/changes.ttl' is up to date |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item C<< doap_version_ok($dist, $module) >> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Reads all RDF in a distribution's "meta" directory and checks the |
112
|
|
|
|
|
|
|
distribution metadata matches the pattern: |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
?uri doap:release ?rel . |
115
|
|
|
|
|
|
|
?rel doap:revision ?ver . |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Where ?uri is the URI C<< http://purl.org/NET/cpan-uri/dist/$dist/project >> |
118
|
|
|
|
|
|
|
and ?ver is C<< $module->VERSION >>, as an xsd:string or plain literal. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 BUGS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Please report any bugs to |
125
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Test-RDF-DOAP-Version>. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 SEE ALSO |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L<Module::Install::DOAPChangeSets>. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is copyright (c) 2011-2013 by Toby Inkster. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
140
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
145
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
146
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
147
|
|
|
|
|
|
|
|