line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::Release::UploadToCPAN; |
2
|
1
|
|
|
1
|
|
926
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
7
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
24
|
use ExtUtils::MakeMaker qw(prompt); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Minilla::Util qw(require_optional); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
8
|
1
|
|
|
1
|
|
6
|
use Minilla::Logger; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
626
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
0
|
|
|
0
|
0
|
|
require_optional('CPAN/Uploader.pm', |
12
|
|
|
|
|
|
|
'Release engineering'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub run { |
16
|
0
|
|
|
0
|
0
|
|
my ($self, $project, $opts) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $work_dir = $project->work_dir(); |
19
|
0
|
|
|
|
|
|
my $tar = $work_dir->dist; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
0
|
|
|
|
if ($opts->{dry_run} || $ENV{FAKE_RELEASE}) { |
|
|
0
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
infof("Dry run. You don't need the module upload to CPAN\n"); |
23
|
|
|
|
|
|
|
} elsif ($project->config->{release}->{do_not_upload_to_cpan}) { |
24
|
0
|
|
|
|
|
|
infof("You disabled CPAN uploading feature in minil.toml.\n"); |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
|
infof("Upload to CPAN\n"); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $pause_config = ($opts->{pause_config}) ? $opts->{pause_config} |
29
|
|
|
|
|
|
|
: ($project->config->{release}->{pause_config}) ? $project->config->{release}->{pause_config} |
30
|
0
|
0
|
|
|
|
|
: undef; |
|
|
0
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $config = CPAN::Uploader->read_config_file($pause_config); |
32
|
0
|
0
|
0
|
|
|
|
if (!$config || !$config->{user} || !$config->{password}) { |
|
|
|
0
|
|
|
|
|
33
|
0
|
|
|
|
|
|
die <
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Missing ~/.pause file or your ~/.pause file is wrong. |
36
|
|
|
|
|
|
|
You should put ~/.pause file in following format. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
user {{YOUR_PAUSE_ID}} |
39
|
|
|
|
|
|
|
password {{YOUR_PAUSE_PASSWORD}} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
EOF |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
PROMPT: while (1) { |
46
|
0
|
|
0
|
|
|
|
my $answer = prompt("Release to " . ($config->{upload_uri} || 'CPAN') . ' ? [y/n] '); |
47
|
0
|
0
|
|
|
|
|
if ($answer =~ /y/i) { |
|
|
0
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
last PROMPT; |
49
|
|
|
|
|
|
|
} elsif ($answer =~ /n/i) { |
50
|
0
|
|
|
|
|
|
errorf("Giving up!\n"); |
51
|
|
|
|
|
|
|
} else { |
52
|
0
|
|
|
|
|
|
redo PROMPT; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
if ($opts->{trial}) { |
57
|
0
|
|
|
|
|
|
my $orig_file = $tar; |
58
|
0
|
0
|
|
|
|
|
$tar =~ s/\.(tar\.gz|tgz|tar.bz2|tbz|zip)$/-TRIAL.$1/ |
59
|
|
|
|
|
|
|
or die "Distfile doesn't match supported archive format: $orig_file"; |
60
|
0
|
|
|
|
|
|
infof("renaming $orig_file -> $tar for TRIAL release\n"); |
61
|
0
|
0
|
|
|
|
|
rename $orig_file, $tar or errorf("Renaming $orig_file -> $tar failed: $!\n"); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $uploader = CPAN::Uploader->new(+{ |
65
|
|
|
|
|
|
|
tar => $tar, |
66
|
|
|
|
|
|
|
%$config |
67
|
|
|
|
|
|
|
}); |
68
|
0
|
|
|
|
|
|
$uploader->upload_file($tar); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
unlink($tar) unless Minilla->debug; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|