line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1273
|
use 5.008; # utf8 |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
1123
|
use utf8; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::if::not::ENV; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.001000'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Load a plugin when an ENV key is NOT true. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
516
|
use Moose qw( has around with ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Dist::Zilla::Util qw(); |
16
|
|
|
|
|
|
|
use Dist::Zilla::Util::ConfigDumper qw( config_dumper ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginLoader::Configurable'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has key => ( is => ro =>, required => 1 ); |
21
|
|
|
|
|
|
|
around dump_config => config_dumper( __PACKAGE__, qw( key ) ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
around load_plugins => sub { |
24
|
|
|
|
|
|
|
my ( $orig, $self, $loader ) = @_; |
25
|
|
|
|
|
|
|
my $key = $self->key; |
26
|
|
|
|
|
|
|
return if exists $ENV{$key} and $ENV{$key}; |
27
|
|
|
|
|
|
|
return $self->$orig($loader); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
31
|
|
|
|
|
|
|
no Moose; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Dist::Zilla::Plugin::if::not::ENV - Load a plugin when an ENV key is NOT true. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 0.001000 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
[if::not::ENV] |
52
|
|
|
|
|
|
|
key = AIRPLANE |
53
|
|
|
|
|
|
|
dz_plugin = Some::Plugin |
54
|
|
|
|
|
|
|
dz_plugin_name = NOTAIRPLANE/Some::Plugin |
55
|
|
|
|
|
|
|
>= some_plugin_argument = itsvalue |
56
|
|
|
|
|
|
|
>= some_plugin_argument = itsvalue |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Then |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
dzil build # Some::Plugin is loaded |
61
|
|
|
|
|
|
|
AIRPLANE=1 dzil build # Some::Plugin NOT loaded!... but still a develop dep. |
62
|
|
|
|
|
|
|
AIRPLANE=0 dzil build # Some::Plugin loaded |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 SEE ALSO |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=over 4 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * C<[if]> - L<< Dist::Zilla::Plugin::if|Dist::Zilla::Plugin::if >> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * C<[if::not]> - L<< Dist::Zilla::Plugin::if::not|Dist::Zilla::Plugin::if::not >> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * C<[if::ENV]> - L<< Dist::Zilla::Plugin::if::ENV|Dist::Zilla::Plugin::if::ENV >> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * C<PluginLoader::Configurable role> - L<< |
75
|
|
|
|
|
|
|
Dist::Zilla::Role::PluginLoader::Configurable|Dist::Zilla::Role::PluginLoader::Configurable |
76
|
|
|
|
|
|
|
>> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * C<PluginLoader role> - L<< Dist::Zilla::Role::PluginLoader|Dist::Zilla::Role::PluginLoader >> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * C<PluginLoader util> - L<< Dist::Zilla::Util::PluginLoader|Dist::Zilla::Util::PluginLoader >> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=back |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
93
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |