line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
73078
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
2
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
3
|
1
|
|
|
1
|
|
7
|
use v5.8.0; |
|
1
|
|
|
|
|
2
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::NexusRelease; |
6
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::NexusRelease::VERSION = '1.0.0'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Release a Dist::Zilla build to a Sonatype Nexus instance. |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
464
|
use utf8; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
11
|
1
|
|
|
1
|
|
478
|
use Moose; |
|
1
|
|
|
|
|
273166
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::Releaser'; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
4789
|
use Log::Any qw($log); |
|
1
|
|
|
|
|
8601
|
|
|
1
|
|
|
|
|
3
|
|
15
|
1
|
|
|
1
|
|
2925
|
use Scalar::Util qw(weaken); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
16
|
1
|
|
|
1
|
|
2
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
401
|
use namespace::autoclean; |
|
1
|
|
|
|
|
5129
|
|
|
1
|
|
|
|
|
3
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::NexusRelease::_Uploader; |
23
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::NexusRelease::_Uploader::VERSION = '1.0.0'; |
24
|
|
|
|
|
|
|
# Nexus::Uploader will be loaded later if used |
25
|
|
|
|
|
|
|
our @ISA = 'Nexus::Uploader'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub log { |
28
|
8
|
|
|
8
|
|
1667
|
my $self = shift; |
29
|
8
|
|
|
|
|
27
|
$self->{'Dist::Zilla'}{plugin}->log(@_); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has username => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'Str', |
37
|
|
|
|
|
|
|
required => 1, |
38
|
|
|
|
|
|
|
lazy => 1, |
39
|
|
|
|
|
|
|
default => sub { |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
return $self->zilla->chrome->prompt_str('Nexus username: '); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has password => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
isa => 'Str', |
49
|
|
|
|
|
|
|
required => 1, |
50
|
|
|
|
|
|
|
lazy => 1, |
51
|
|
|
|
|
|
|
default => sub { |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
return $self->zilla->chrome->prompt_str( 'Nexus password: ', |
54
|
|
|
|
|
|
|
{ noecho => 1 } ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has nexus_URL => ( |
60
|
|
|
|
|
|
|
is => 'ro', |
61
|
|
|
|
|
|
|
isa => 'Str', |
62
|
|
|
|
|
|
|
required => 1, |
63
|
|
|
|
|
|
|
default => 'http://localhost:8081/nexus/repository/maven-releases', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has group => ( |
68
|
|
|
|
|
|
|
is => 'ro', |
69
|
|
|
|
|
|
|
isa => 'Str', |
70
|
|
|
|
|
|
|
lazy => 1, |
71
|
|
|
|
|
|
|
default => sub { |
72
|
|
|
|
|
|
|
my $self = shift; |
73
|
|
|
|
|
|
|
return $self->zilla->chrome->prompt_str('Nexus group: '); |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has artefact => |
79
|
|
|
|
|
|
|
( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_artefact' ); |
80
|
1
|
|
|
1
|
|
2
|
sub _build_artefact { my $self = shift; $self->zilla->name; } |
|
1
|
|
|
|
|
25
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
has version => |
84
|
|
|
|
|
|
|
( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_version' ); |
85
|
1
|
|
|
1
|
|
1
|
sub _build_version { my $self = shift; $self->zilla->version; } |
|
1
|
|
|
|
|
23
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has uploader => ( |
89
|
|
|
|
|
|
|
is => 'ro', |
90
|
|
|
|
|
|
|
isa => 'Nexus::Uploader', |
91
|
|
|
|
|
|
|
lazy => 1, |
92
|
|
|
|
|
|
|
default => sub { |
93
|
|
|
|
|
|
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Load the module lazily |
96
|
|
|
|
|
|
|
require Nexus::Uploader; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my $uploader = Dist::Zilla::Plugin::NexusRelease::_Uploader->new( |
99
|
|
|
|
|
|
|
{ username => $self->username, |
100
|
|
|
|
|
|
|
password => $self->password, |
101
|
|
|
|
|
|
|
nexus_URL => $self->nexus_URL, |
102
|
|
|
|
|
|
|
group => $self->group, |
103
|
|
|
|
|
|
|
artefact => $self->artefact, |
104
|
|
|
|
|
|
|
version => $self->version, |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$uploader->{'Dist::Zilla'}{plugin} = $self; |
109
|
|
|
|
|
|
|
weaken $uploader->{'Dist::Zilla'}{plugin}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
return $uploader; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub release { |
116
|
3
|
|
|
3
|
1
|
241897
|
my $self = shift; |
117
|
3
|
|
|
|
|
8
|
my $archive = shift; |
118
|
|
|
|
|
|
|
|
119
|
3
|
|
|
|
|
8
|
my @missing_attributes = (); |
120
|
3
|
|
|
|
|
10
|
for my $attr (qw(username password group)) { |
121
|
9
|
100
|
|
|
|
326
|
if ( !length $self->$attr ) { |
122
|
4
|
|
|
|
|
30
|
$self->log("You need to supply a $attr"); |
123
|
4
|
|
|
|
|
1152
|
push( @missing_attributes, $attr ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
3
|
100
|
|
|
|
10
|
if ( scalar @missing_attributes ) { |
127
|
2
|
|
|
|
|
428
|
croak "Missing attributes " . join( ', ', @missing_attributes ); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
1
|
|
|
|
|
32
|
my $uploader = $self->uploader; |
131
|
|
|
|
|
|
|
|
132
|
1
|
|
|
|
|
23
|
printf "Releasing to Sonatype Nexus: repository '%s', GAV '%s:%s:%s'\n", |
133
|
|
|
|
|
|
|
$uploader->nexus_URL, $uploader->group, $uploader->artefact, |
134
|
|
|
|
|
|
|
$uploader->version; |
135
|
1
|
|
|
|
|
176
|
$uploader->upload_file("$archive"); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=pod |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=encoding UTF-8 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 NAME |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Dist::Zilla::Plugin::NexusRelease - Release a Dist::Zilla build to a Sonatype Nexus instance. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 VERSION |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
version 1.0.0 |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 SYNOPSIS |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
If loaded, this plugin will allow the C<release> command to upload a distribution to a Sonatype Nexus instance. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 DESCRIPTION |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This plugin looks for configuration in your F<dist.ini> or (more |
163
|
|
|
|
|
|
|
likely) F<~/.dzil/config.ini>: |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
[NexusRelease] |
166
|
|
|
|
|
|
|
username = Nexus tokenised username |
167
|
|
|
|
|
|
|
password = Nexus tokenised password |
168
|
|
|
|
|
|
|
group = Nexus group ID to use for the upload |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
The following are optional but very likely to be used: |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
nexus_URL = Nexus repository URL |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
The Nexus Artefact is set to the Perl distribution name (C<name> in F<dist.ini>, and the version is set to the Perl distribution version. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 username |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This is the Nexus user to log in with. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
User will be prompted if this is not set in F<dist.ini>. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 password |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
The Nexus password. It is *strongly* advised that you take advantage of the Nexus user tokens feature! |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
User will be prompted if this is not set in F<dist.ini>. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 nexus_URL |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
The Nexus URL (base URL) to use. Defaults to L<http://localhost:8081/nexus/repository/maven-releases>. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 group |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
The group to use when uploading. There is no default although a reasonable value would be your CPAN ID. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
User will be prompted if this is not set in F<dist.ini>. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 artefact |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
The artefact name to use when uploading - defaults to the distribution name. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 version |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
The version of the distribution - defaults to the $VERSION set in the distribution. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head1 METHODS |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 release |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
The C<release> method required by L<Dist::Zilla::Role::Releaser>. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head1 SEE ALSO |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
- L<Nexus::Uploader> |
217
|
|
|
|
|
|
|
- L<Dist::Zilla::Plusin::UploadToCPAN> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head1 AUTHOR |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Brad Macpherson <brad@teched-creations.com> |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Brad Macpherson. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
228
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |