| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
13707
|
use 5.10.0; |
|
|
1
|
|
|
|
|
2
|
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
50
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Badge::Depot::Plugin::Kwalitee; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Kwalitee badge for Badge::Depot |
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
|
9
|
|
|
|
|
|
|
our $VERSION = '0.0101'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
447
|
use Moose; |
|
|
1
|
|
|
|
|
289571
|
|
|
|
1
|
|
|
|
|
3
|
|
|
12
|
1
|
|
|
1
|
|
4089
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
13
|
1
|
|
|
1
|
|
620
|
use MooseX::AttributeShortcuts; |
|
|
1
|
|
|
|
|
230632
|
|
|
|
1
|
|
|
|
|
4
|
|
|
14
|
1
|
|
|
1
|
|
23456
|
use Types::Standard qw/Str HashRef/; |
|
|
1
|
|
|
|
|
41505
|
|
|
|
1
|
|
|
|
|
7
|
|
|
15
|
1
|
|
|
1
|
|
945
|
use Types::URI qw/Uri/; |
|
|
1
|
|
|
|
|
83564
|
|
|
|
1
|
|
|
|
|
10
|
|
|
16
|
1
|
|
|
1
|
|
703
|
use JSON::MaybeXS 'decode_json'; |
|
|
1
|
|
|
|
|
2497
|
|
|
|
1
|
|
|
|
|
45
|
|
|
17
|
1
|
|
|
1
|
|
11
|
use Path::Tiny; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
319
|
|
|
18
|
|
|
|
|
|
|
with 'Badge::Depot'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has dist => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
isa => Str, |
|
23
|
|
|
|
|
|
|
lazy => 1, |
|
24
|
|
|
|
|
|
|
default => sub { |
|
25
|
|
|
|
|
|
|
my $self = shift; |
|
26
|
|
|
|
|
|
|
if($self->get_meta('dist')) { |
|
27
|
|
|
|
|
|
|
return $self->_meta->{'dist'}; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
has version => ( |
|
32
|
|
|
|
|
|
|
is => 'ro', |
|
33
|
|
|
|
|
|
|
isa => Str, |
|
34
|
|
|
|
|
|
|
lazy => 1, |
|
35
|
|
|
|
|
|
|
default => sub { |
|
36
|
|
|
|
|
|
|
my $self = shift; |
|
37
|
|
|
|
|
|
|
if($self->get_meta('version')) { |
|
38
|
|
|
|
|
|
|
return $self->_meta->{'version'}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
has base_url => ( |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
isa => Uri, |
|
45
|
|
|
|
|
|
|
coerce => 1, |
|
46
|
|
|
|
|
|
|
lazy => 1, |
|
47
|
|
|
|
|
|
|
default => 'https://badgedepot.code301.com', |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
has custom_image_url => ( |
|
50
|
|
|
|
|
|
|
is => 'ro', |
|
51
|
|
|
|
|
|
|
isa => Uri, |
|
52
|
|
|
|
|
|
|
coerce => 1, |
|
53
|
|
|
|
|
|
|
lazy => 1, |
|
54
|
|
|
|
|
|
|
builder => 1, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _build_custom_image_url { |
|
58
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
|
59
|
1
|
|
|
|
|
28
|
return sprintf '%s/badge/kwalitee/%s/%s', $self->base_url, $self->dist, $self->version; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
has _meta => ( |
|
62
|
|
|
|
|
|
|
is => 'ro', |
|
63
|
|
|
|
|
|
|
isa => HashRef, |
|
64
|
|
|
|
|
|
|
traits => ['Hash'], |
|
65
|
|
|
|
|
|
|
lazy => 1, |
|
66
|
|
|
|
|
|
|
predicate => 'has_meta', |
|
67
|
|
|
|
|
|
|
builder => '_build_meta', |
|
68
|
|
|
|
|
|
|
handles => { |
|
69
|
|
|
|
|
|
|
get_meta => 'get', |
|
70
|
|
|
|
|
|
|
}, |
|
71
|
|
|
|
|
|
|
); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _build_meta { |
|
74
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
0
|
if($self->has_zilla) { |
|
77
|
|
|
|
|
|
|
return { |
|
78
|
0
|
|
|
|
|
0
|
dist => $self->zilla->name, |
|
79
|
|
|
|
|
|
|
version => $self->zilla->version, |
|
80
|
|
|
|
|
|
|
}; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
0
|
return {} if !path('META.json')->exists; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
my $json = path('META.json')->slurp_utf8; |
|
86
|
0
|
|
|
|
|
0
|
my $data = decode_json($json); |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
0
|
0
|
|
|
0
|
return {} if !exists $data->{'name'} || !exists $data->{'version'}; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return { |
|
91
|
|
|
|
|
|
|
dist => $data->{'name'}, |
|
92
|
0
|
|
|
|
|
0
|
version => $data->{'version'}, |
|
93
|
|
|
|
|
|
|
}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub BUILD { |
|
97
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
|
98
|
1
|
50
|
|
|
|
32
|
$self->link_url(sprintf 'http://cpants.cpanauthors.org/dist/%s%s', $self->dist, $self->version eq 'latest' ? '' : '-'.$self->version); |
|
99
|
1
|
|
|
|
|
2188
|
$self->image_url($self->custom_image_url); |
|
100
|
1
|
|
|
|
|
29
|
$self->image_alt('Distribution kwalitee'); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=pod |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=encoding UTF-8 |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Badge::Depot::Plugin::Kwalitee - Kwalitee badge for Badge::Depot |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=begin html |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
<p> |
|
122
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/perl-5.10+-blue.svg" alt="Requires Perl 5.10+" /> |
|
123
|
|
|
|
|
|
|
<a href="https://travis-ci.org/Csson/p5-Badge-Depot-Plugin-Kwalitee"><img src="https://api.travis-ci.org/Csson/p5-Badge-Depot-Plugin-Kwalitee.svg?branch=master" alt="Travis status" /></a> |
|
124
|
|
|
|
|
|
|
<a href="http://cpants.cpanauthors.org/dist/Badge-Depot-Plugin-Kwalitee-0.0101"><img src="https://badgedepot.code301.com/badge/kwalitee/Badge-Depot-Plugin-Kwalitee/0.0101" alt="Distribution kwalitee" /></a> |
|
125
|
|
|
|
|
|
|
<a href="http://matrix.cpantesters.org/?dist=Badge-Depot-Plugin-Kwalitee%200.0101"><img src="https://badgedepot.code301.com/badge/cpantesters/Badge-Depot-Plugin-Kwalitee/0.0101" alt="CPAN Testers result" /></a> |
|
126
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/coverage-70.6%-red.svg" alt="coverage 70.6%" /> |
|
127
|
|
|
|
|
|
|
</p> |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=end html |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 VERSION |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Version 0.0101, released 2016-02-22. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
If used standalone: |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
use Badge::Depot::Plugin::Kwalitee; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $badge = Badge::Depot::Plugin::Kwalitee->new(dist => 'The-Dist', version => '0.1002'); |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
print $badge->to_html; |
|
144
|
|
|
|
|
|
|
# prints: |
|
145
|
|
|
|
|
|
|
<a href="http://cpants.cpanauthors.org/dist/The-Dist-0.1002"> |
|
146
|
|
|
|
|
|
|
<img src="https://badgedepot.code301.com/badge/kwalitee/The-Dist/0.1002" alt="Distribution kwalitee" /> |
|
147
|
|
|
|
|
|
|
</a> |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
If used with L<Pod::Weaver::Section::Badges>, in weaver.ini: |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
[Badges] |
|
152
|
|
|
|
|
|
|
; other settings |
|
153
|
|
|
|
|
|
|
badge = kwalitee |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Creates a L<Kwalitee|http://cpants.cpanauthors.org> badge for a distribution. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This class consumes the L<Badge::Depot> role. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This badge tries to use distribution meta data to set the attributes. If that is available no attributes need to be set manually. The following checks are made: |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item 1 |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
If the badge is used via L<Pod::Weaver::Section::Badges> during a L<Dist::Zilla> build, then C<version> and C<dist> are set to the values in the Dist::Zilla object. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item 2 |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
If there is a C<META.json> in the distribution root then that is used to set C<version> and C<dist>. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
If neither of those are true, then you should pass C<dist> and C<version> to the constructor. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 dist |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Distribution name. With dashes, not colons. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 version |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Distribution version. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 base_url |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Default: C<https://badgedepot.code301.com> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Set this if you wish to use another instance of L<Badge::Depot::App>. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over 4 |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
L<Badge::Depot> |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
L<Task::Badge::Depot> |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 SOURCE |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Badge-Depot-Plugin-Kwalitee> |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
L<https://metacpan.org/release/Badge-Depot-Plugin-Kwalitee> |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 AUTHOR |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Erik Carlsson. |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
226
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |