line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: add a module to a dist |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Dist::Zilla::Pragmas; |
4
|
4
|
|
|
4
|
|
149229
|
|
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
36
|
|
5
|
|
|
|
|
|
|
use Dist::Zilla::App -command; |
6
|
4
|
|
|
4
|
|
29
|
use Dist::Zilla::Path; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
54
|
|
7
|
4
|
|
|
4
|
|
1436
|
|
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
34
|
|
8
|
|
|
|
|
|
|
use namespace::autoclean; |
9
|
4
|
|
|
4
|
|
1567
|
|
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
37
|
|
10
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod Adds a new module to a Dist::Zilla-based distribution |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod $ dzil add Some::New::Module |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod There are two arguments, C<-p> and C<-P>. C<-P> specify the minting profile |
17
|
|
|
|
|
|
|
#pod provider and C<-p> - the profile name. These work just like C<dzil new>. |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod =cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
1
|
0
|
|
23
|
|
|
|
|
|
|
[ 'profile|p=s', 'name of the profile to use', |
24
|
1
|
|
|
1
|
1
|
25836
|
{ default => 'default' } ], |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
[ 'provider|P=s', 'name of the profile provider to use', |
27
|
1
|
|
|
1
|
1
|
16
|
{ default => 'Default' } ], |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# [ 'module|m=s@', 'module(s) to create; may be given many times' ], |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my ($self, $opt, $args) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
require MooseX::Types::Perl; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->usage_error('dzil add takes one or more arguments') if @$args < 1; |
37
|
1
|
|
|
1
|
1
|
867
|
|
38
|
|
|
|
|
|
|
for my $name ( @$args ) { |
39
|
1
|
|
|
|
|
10
|
$self->usage_error("$name is not a valid module name") |
40
|
|
|
|
|
|
|
unless MooseX::Types::Perl::is_ModuleName($name); |
41
|
1
|
50
|
|
|
|
6
|
} |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
4
|
|
44
|
1
|
50
|
|
|
|
7
|
my ($self, $opt, $arg) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $zilla = $self->zilla; |
47
|
|
|
|
|
|
|
my $dist = $zilla->name; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
require File::pushd; |
50
|
1
|
|
|
1
|
1
|
378
|
|
51
|
|
|
|
|
|
|
require Dist::Zilla::Dist::Minter; |
52
|
1
|
|
|
|
|
11
|
my $minter = Dist::Zilla::Dist::Minter->_new_from_profile( |
53
|
1
|
|
|
|
|
31
|
[ $opt->provider, $opt->profile ], |
54
|
|
|
|
|
|
|
{ |
55
|
1
|
|
|
|
|
6
|
chrome => $self->app->chrome, |
56
|
|
|
|
|
|
|
name => $dist, |
57
|
1
|
|
|
|
|
4
|
_global_stashes => $self->app->_build_global_stashes, |
58
|
1
|
|
|
|
|
9
|
}, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $root = path($zilla->root)->absolute; |
62
|
|
|
|
|
|
|
my $wd = File::pushd::pushd($minter->root); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $factory = $minter->plugin_named(':DefaultModuleMaker'); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
for my $name ( @$arg ) { |
67
|
1
|
|
|
|
|
32
|
$factory->make_module({ name => $name }); |
68
|
1
|
|
|
|
|
159
|
} |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
224
|
for my $file ( @{ $factory->zilla->files} ) { |
71
|
|
|
|
|
|
|
$zilla->_write_out_file($file, $root); |
72
|
1
|
|
|
|
|
5
|
} |
73
|
1
|
|
|
|
|
11
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
77
|
1
|
|
|
|
|
9
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding UTF-8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Dist::Zilla::App::Command::add - add a module to a dist |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 VERSION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
version 6.028 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Adds a new module to a Dist::Zilla-based distribution |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$ dzil add Some::New::Module |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
There are two arguments, C<-p> and C<-P>. C<-P> specify the minting profile |
97
|
|
|
|
|
|
|
provider and C<-p> - the profile name. These work just like C<dzil new>. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 PERL VERSION |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
102
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
103
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
104
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
107
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
108
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
109
|
|
|
|
|
|
|
the minimum required perl. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
120
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |