| 1 | package Module::Provision::TraitFor::Badges; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Class::Usul::Constants qw( OK TRUE ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | requires qw( output quiet select_method stash ); | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | around 'select_method' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 11 | 1 | my ($orig, $self, @args) = @_; my $method = $orig->( $self, @args ); | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | $method eq 'get_badge_markup' and $self->quiet( TRUE ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | return $method; | |||||||||
| 16 | 1 | }; | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub get_badge_markup : method { | ||||||||
|
Subroutine
get_badge_markup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 19 | 0 | my $self = shift; | |||||||||
| 20 | 0 | my $s = $self->stash; | |||||||||
| 21 | 0 | my $distname = $s->{distname}; | |||||||||
| 22 | 0 | my $distdir = $s->{lc_distname}; | |||||||||
| 23 | 0 | my $reponame = $s->{pub_repo_prefix}.$distdir; | |||||||||
| 24 | 0 | my $coverage = $self->config->coverage_server; | |||||||||
| 25 | 0 | my $travis = 'https://travis-ci.org/'.$s->{author_id}; | |||||||||
| 26 | 0 | ▶ | my $args = sub { { cl => $_[ 0 ], nl => $_[ 0 ], no_lead => TRUE } }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 27 | 0 | ▶ | my $out = sub { $self->output( $_[ 0 ], $args->( $_[ 1 ] ) ) }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | $out->( '=begin html', TRUE ); | |||||||||
| 30 | 0 | $out->( "<a href=\"${travis}/${reponame}\">" | |||||||||
| 31 | . "<img src=\"${travis}/${reponame}.svg?branch=master\"" | ||||||||||
| 32 | . ' alt="Travis CI Badge"></a>' ); | ||||||||||
| 33 | 0 | $out->( "<a href=\"${coverage}/report/${distdir}/latest\">" | |||||||||
| 34 | . "<img src=\"${coverage}/badge/${distdir}/latest\"" | ||||||||||
| 35 | . ' alt="Coverage Badge"></a>' ); | ||||||||||
| 36 | 0 | $out->( "<a href=\"http://badge.fury.io/pl/${distname}\">" | |||||||||
| 37 | . "<img src=\"https://badge.fury.io/pl/${distname}.svg\"" | ||||||||||
| 38 | . ' alt="CPAN Badge"></a>' ); | ||||||||||
| 39 | 0 | $out->( "<a href=\"http://cpants.cpanauthors.org/dist/${distname}\">" | |||||||||
| 40 | . "<img src=\"http://cpants.cpanauthors.org/dist/${distname}.png\"" | ||||||||||
| 41 | . ' alt="Kwalitee Badge"></a>' ); | ||||||||||
| 42 | 0 | $out->( '=end html', TRUE ); | |||||||||
| 43 | 0 | return OK; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 1 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||