line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Role::PluginBundle::Airplane; |
2
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
3
|
1
|
|
|
1
|
|
638069
|
use Moose::Role; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: A role for building packages with Dist::Zilla in an airplane |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5359
|
use Dist::Zilla::Util; |
|
1
|
|
|
|
|
10569
|
|
|
1
|
|
|
|
|
316
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
requires 'build_network_plugins'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has airplane => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'Bool', |
14
|
|
|
|
|
|
|
init_arg => undef, |
15
|
|
|
|
|
|
|
lazy => 1, |
16
|
|
|
|
|
|
|
builder => '_build_airplane_mode', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has network_plugins => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => 'ArrayRef', |
22
|
|
|
|
|
|
|
init_arg => undef, |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
builder => 'build_network_plugins', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_airplane_mode { |
28
|
5
|
|
66
|
5
|
|
146
|
return $ENV{DZIL_AIRPLANE} // $_[0]->payload->{airplane} // 0; |
|
|
|
100
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _get_network_plugins { |
32
|
3
|
|
|
3
|
|
8
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
4
|
my %network_plugins; |
35
|
3
|
|
|
|
|
5
|
for (@{$self->network_plugins}) { |
|
3
|
|
|
|
|
95
|
|
36
|
3
|
|
|
|
|
11
|
$network_plugins{$self->_plugin_to_name($_)} = 1; |
37
|
|
|
|
|
|
|
} |
38
|
3
|
|
|
|
|
100
|
return \%network_plugins; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _plugin_to_name { |
42
|
5
|
|
|
5
|
|
9
|
my ($self, $plugin) = @_; |
43
|
5
|
|
|
|
|
22
|
return Dist::Zilla::Util->expand_config_package_name($plugin); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
around add_plugins => sub { |
47
|
|
|
|
|
|
|
my $orig = shift; |
48
|
|
|
|
|
|
|
my $self = shift; |
49
|
|
|
|
|
|
|
my @plugins = @_; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
if ($self->airplane) { |
53
|
|
|
|
|
|
|
my $plugins = $self->_get_network_plugins(); |
54
|
|
|
|
|
|
|
@plugins = grep { |
55
|
|
|
|
|
|
|
not exists $plugins->{ |
56
|
|
|
|
|
|
|
$self->_plugin_to_name( |
57
|
|
|
|
|
|
|
!ref $_ ? $_ : ref eq 'ARRAY' ? $_->[0] : die "unable") |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} @plugins; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# halt release after pre-release checks, but before ConfirmRelease |
63
|
|
|
|
|
|
|
push @plugins, 'BlockRelease'; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$orig->($self, @plugins); |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=pod |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=encoding UTF-8 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 NAME |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Dist::Zilla::Role::PluginBundle::Airplane - A role for building packages with Dist::Zilla in an airplane |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 VERSION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
version 0.001 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SYNOPSIS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::Author::EXAMPLE; |
88
|
|
|
|
|
|
|
use Moose; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Airplane'; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub build_airplane_mode { |
93
|
|
|
|
|
|
|
return [qw( |
94
|
|
|
|
|
|
|
PromptIfStale |
95
|
|
|
|
|
|
|
Test::Pod::LinkCheck |
96
|
|
|
|
|
|
|
Test::Pod::No404s |
97
|
|
|
|
|
|
|
Git::Remote::Check |
98
|
|
|
|
|
|
|
CheckPrereqsIndexed |
99
|
|
|
|
|
|
|
CheckIssues |
100
|
|
|
|
|
|
|
UploadToCPAN |
101
|
|
|
|
|
|
|
UploadToStratopan |
102
|
|
|
|
|
|
|
Git::Push |
103
|
|
|
|
|
|
|
)]; |
104
|
|
|
|
|
|
|
}; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub configure { |
107
|
|
|
|
|
|
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my @plugins = ['PromptIfStale']; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$self->add_plugins(@plugins); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DESCRIPTION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Enables airplane mode for your dzil plugin bundle. This means all network |
117
|
|
|
|
|
|
|
plugins are removed from loading and aborts a release via the plugin |
118
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::BlockRelease>. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# In your dist.ini |
121
|
|
|
|
|
|
|
[@Author::EXAMPLE] |
122
|
|
|
|
|
|
|
airplane = 1 ; or DZIL_AIRPLANE=1 in your shell |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Wesley Schwengle. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is free software, licensed under: |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The (three-clause) BSD License |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |