line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::Plicease::MarkDownCleanup 2.41 { |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
867
|
use 5.014; |
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use Path::Tiny qw( path ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
5
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: add a travis status button to the README.md file |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::AfterBuild'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has travis_status => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has travis_user => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
default => 'plicease', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has cirrus_user => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
default => sub { |
25
|
|
|
|
|
|
|
my($self) = @_; |
26
|
|
|
|
|
|
|
$self->travis_user; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has appveyor_user => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
default => 'plicease', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has appveyor => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
isa => 'Str', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub after_build |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
43
|
0
|
|
|
|
|
|
my $readme = $self->zilla->root->child("README.md"); |
44
|
0
|
0
|
|
|
|
|
if(-r $readme) |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
|
|
|
my $name = $self->zilla->name; |
47
|
0
|
|
|
|
|
|
my $user = $self->travis_user; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $cirrus_status = -f $self->zilla->root->child('.cirrus.yml'); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $status = ''; |
52
|
0
|
0
|
|
|
|
|
$status .= " [![Build Status](https://api.cirrus-ci.com/github/@{[ $self->cirrus_user ]}/$name.svg)](https://cirrus-ci.com/github/@{[ $self->cirrus_user ]}/$name)" if $cirrus_status; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
$status .= " [![Build Status](https://secure.travis-ci.org/$user/$name.png)](http://travis-ci.org/$user/$name)" if $self->travis_status; |
54
|
0
|
0
|
|
|
|
|
$status .= " [![Build status](https://ci.appveyor.com/api/projects/status/@{[ $self->appveyor ]}/branch/master?svg=true)](https://ci.appveyor.com/project/@{[ $self->appveyor_user ]}/$name/branch/master)" if $self->appveyor; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $content = $readme->slurp; |
57
|
0
|
|
|
|
|
|
$content =~ s{# NAME\s+(.*?) - (.*?#)}{# $1$status\n\n$2}s; |
58
|
0
|
|
|
|
|
|
$content =~ s{# VERSION\s+version (\d+\.|)\d+\.\d+(\\_\d+|)\s+#}{#}; |
59
|
0
|
|
|
|
|
|
$readme->spew_raw($content); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
$self->log("no README.md found"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::Plicease::MarkDownCleanup - add a travis status button to the README.md file |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 VERSION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
version 2.41 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
[Author::Plicease::MarkDownCleanup] |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SEE ALSO |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over 4 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item L<Dist::Zilla> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item L<Dist::Zilla::PluginBundle::Author::Plicease> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Graham Ollis. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |