line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
8369381
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
135
|
|
2
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
251
|
|
3
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::AuthorityFromModule; # git description: v0.006-15-gdad604f |
4
|
|
|
|
|
|
|
# vim: set ts=8 sts=4 sw=4 tw=115 et : |
5
|
|
|
|
|
|
|
# ABSTRACT: (DEPRECATED) Add metadata to your distribution indicating what module to copy PAUSE permissions from |
6
|
|
|
|
|
|
|
# KEYWORDS: distribution metadata authority permissions PAUSE users |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
21
|
use Moose; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
35
|
|
11
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider', |
12
|
|
|
|
|
|
|
'Dist::Zilla::Role::ModuleMetadata'; |
13
|
5
|
|
|
5
|
|
20638
|
use List::Util 1.33 qw(first any); |
|
5
|
|
|
|
|
118
|
|
|
5
|
|
|
|
|
335
|
|
14
|
5
|
|
|
5
|
|
21
|
use namespace::autoclean; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
35
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has module => ( |
17
|
|
|
|
|
|
|
is => 'ro', isa => 'Str', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has _module_name => ( |
21
|
|
|
|
|
|
|
is => 'ro', isa => 'Str', |
22
|
|
|
|
|
|
|
lazy => 1, |
23
|
|
|
|
|
|
|
default => sub { |
24
|
|
|
|
|
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if (my $module = $self->module) |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
if (my $file = first { |
29
|
|
|
|
|
|
|
$_->name =~ m{^lib/} and $_->name =~ m{\.pm$} |
30
|
|
|
|
|
|
|
and any { $module eq $_ } $self->_packages_from_file($_) } |
31
|
|
|
|
|
|
|
@{ $self->zilla->files }) |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
$self->log_debug([ 'found \'%s\' in %s', $module, $file->name ]); |
34
|
|
|
|
|
|
|
return $module; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->log_fatal([ 'the module \'%s\' cannot be found in the distribution', $module ]); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$self->log_debug('no module provided; defaulting to the main module'); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $file = $self->zilla->main_module; |
43
|
|
|
|
|
|
|
my ($module) = $self->_packages_from_file($file); |
44
|
|
|
|
|
|
|
$self->log_debug([ 'extracted package \'%s\' from %s', $module, $file->name ]); |
45
|
|
|
|
|
|
|
$module; |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
around dump_config => sub |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
52
|
|
|
|
|
|
|
my $config = $self->$orig; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = { |
55
|
|
|
|
|
|
|
module => $self->_module_name, |
56
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return $config; |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub metadata |
63
|
|
|
|
|
|
|
{ |
64
|
4
|
|
|
4
|
0
|
85838
|
my $self = shift; |
65
|
|
|
|
|
|
|
|
66
|
4
|
|
|
|
|
187
|
my $module = $self->_module_name; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
+{ |
69
|
|
|
|
|
|
|
# TODO: figure out which field is preferred |
70
|
4
|
|
|
|
|
26
|
x_authority_from_module => $module, |
71
|
|
|
|
|
|
|
x_permissions_from_module => $module, |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _packages_from_file |
76
|
|
|
|
|
|
|
{ |
77
|
7
|
|
|
7
|
|
428
|
my ($self, $file) = @_; |
78
|
|
|
|
|
|
|
|
79
|
7
|
|
|
|
|
29
|
my $mmd = $self->module_metadata_for_file($file); |
80
|
7
|
|
|
|
|
15070
|
grep { $_ ne 'main' } $mmd->packages_inside; |
|
13
|
|
|
|
|
62
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=encoding UTF-8 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 NAME |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Dist::Zilla::Plugin::AuthorityFromModule - (DEPRECATED) Add metadata to your distribution indicating what module to copy PAUSE permissions from |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 VERSION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
version 0.007 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
In your F<dist.ini>: |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
[AuthorityFromModule] |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is a L<Dist::Zilla> plugin that adds the C<x_authority_from_module> and |
108
|
|
|
|
|
|
|
C<x_permissions_from_module> keys to your distribution metadata, indicating |
109
|
|
|
|
|
|
|
from which module to copy L<PAUSE|http://pause.perl.org> permissions when a |
110
|
|
|
|
|
|
|
module in your distribution enters the L<PAUSE|http://pause.perl.org> index |
111
|
|
|
|
|
|
|
that has not ever previously been indexed. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
As of May 2016, L<PAUSE|http://pause.perl.org> now copies the permissions from the "main module" to any new modules |
114
|
|
|
|
|
|
|
entering the index for the first time, which renders this module obsolete, with all its goals met in full. There is |
115
|
|
|
|
|
|
|
no longer any need to use this module. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=for stopwords Colin Newell QA Hackathon |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
For more information, see the L<pull request that made the change|https://github.com/andk/pause/pull/222>, written |
120
|
|
|
|
|
|
|
by Colin Newell at the Perl QA Hackathon, in Rugby UK, April 2016. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 MOTIVATION |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
NOTE: The remainder of this documentation reflects how PAUSE used to work, and is retained purely for historical reasons. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The idea is (was) that this is a more useful piece of data for |
127
|
|
|
|
|
|
|
L<PAUSE|http://pause.perl.org> than C<x_authority>. Here is how the release |
128
|
|
|
|
|
|
|
process works with C<x_authority>, using L<Moose> as an example: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=for stopwords STEVAN maint |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=over 4 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
I (ETHER) release a new version of L<Moose> with a new module added, C<Moose::Foo> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
normally, L<PAUSE|http://pause.perl.org> would give me "first-come" permissions on this module, but since L<PAUSE|http://pause.perl.org> sees the C<< x_authority => 'cpan:STEVAN' >> metadata, it instead gives "first-come" to STEVAN, and "co-maint" to me |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
but now none of the other members of the Moose cabal can do the next Moose release and get the new version of C<Moose::Foo> indexed - they need to contact STEVAN and ask him to give them co-maint at L<http://pause.perl.org> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=back |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
So, we can see the only gain is that STEVAN automatically gets permission on |
149
|
|
|
|
|
|
|
the new module, but still, no one else does. Now, let's look at how |
150
|
|
|
|
|
|
|
C<x_authority_from_module> would work: |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=over 4 |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
I (ETHER) release a new version of L<Moose> with a new module added, C<Moose::Foo> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item * |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
L<PAUSE|http://pause.perl.org> sees the C<< x_authority_from_module => 'Moose' >> metadata and looks up the permissions for the L<Moose> module, and, L<finding many authors|https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=Moose&pause99_peek_perms_sub=Submit>, copies all those permissions to L<Moose::Foo>: STEVAN gets first-come, and everyone else (ETHER included) gets co-maint. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item * |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
now any of the other members of the Moose cabal can do the next Moose release and everything will be properly indexed, with no manual intervention required. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=back |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 CONFIGURATION OPTIONS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 C<module> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
The module name to copy permissions from. It must exist in the distribution, |
173
|
|
|
|
|
|
|
and exist in the L<PAUSE|http://pause.perl.org> permissions table (see |
174
|
|
|
|
|
|
|
L<peek at PAUSE permissions|https://pause.perl.org/pause/authenquery?ACTION=peek_perms>). |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This config is optional; it defaults to the L<main module|Dist::Zilla/main_module> in the distribution. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=for Pod::Coverage metadata |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 SEE ALSO |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=over 4 |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<https://github.com/andk/pause/pull/222> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Authority> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<peek at PAUSE permissions|https://pause.perl.org/pause/authenquery?ACTION=peek_perms> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L<What is x_authority?|http://jawnsy.wordpress.com/2011/02/20/what-is-x_authority> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 SUPPORT |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-AuthorityFromModule> |
205
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-AuthorityFromModule@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-AuthorityFromModule@rt.cpan.org>). |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
208
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
211
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
I am also usually active on irc, as 'ether' at C<irc.perl.org>. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 AUTHOR |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Karen Etheridge. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
224
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |