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