line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
610
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
34
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
63
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Inkt::Role::Release; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
203
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Types::Standard -types; |
12
|
|
|
|
|
|
|
use namespace::autoclean; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has should_release_on_build => ( is => "ro", isa => Bool, default => 0, init_arg => "should_release" ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
for my $category (qw( prerelease_action postrelease_action )) |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
has "${category}s" => ( |
19
|
|
|
|
|
|
|
traits => ["Array"], |
20
|
|
|
|
|
|
|
is => "ro", |
21
|
|
|
|
|
|
|
isa => ArrayRef[CodeRef], |
22
|
|
|
|
|
|
|
default => sub { [] }, |
23
|
|
|
|
|
|
|
handles => { "setup_${category}" => "push" }, |
24
|
|
|
|
|
|
|
init_arg => undef, |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has "skip_${category}s" => ( |
29
|
|
|
|
|
|
|
is => "ro", |
30
|
|
|
|
|
|
|
isa => Bool, |
31
|
|
|
|
|
|
|
default => 0, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $_run = sub |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
my $type = $_[0] . "s"; |
39
|
|
|
|
|
|
|
(my $label = $type) =~ s/_/ /g; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return unless @{$self->$type}; |
42
|
|
|
|
|
|
|
return $self->log("Skipping $label") if $self->${\ "skip_$type" }; |
43
|
|
|
|
|
|
|
$self->log("Running $label..."); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
for my $test (@{ $self->$type }) |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
$self->$test(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub Release |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
my $self = shift; |
54
|
|
|
|
|
|
|
my $file = Path::Tiny::path($_[0] || sprintf('%s.tar.gz', $self->targetdir)); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
-f $file or $self->BuildTarball($_[0]); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$self->$_run("prerelease_action"); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
if (system("cpan-upload", $file)) |
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
$self->log("Could not upload to CPAN!"); |
63
|
|
|
|
|
|
|
die("cpan-upload failed; stopping"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$self->$_run("postrelease_action"); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
after BuildAll => sub { |
70
|
|
|
|
|
|
|
my $self = shift; |
71
|
|
|
|
|
|
|
$self->Release if $self->should_release_on_build; |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding utf-8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Dist::Inkt::Role::Release - automatically upload a distribution to the CPAN |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
distink-dist --should_release=1 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 BUGS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Please report any bugs to |
93
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Dist-Inkt-Role-Release>. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L<Dist::Inkt> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Toby Inkster. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
113
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
114
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
115
|
|
|
|
|
|
|
|