| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::NameFromDirectory; |
|
2
|
1
|
|
|
1
|
|
458291
|
use 5.008_001; |
|
|
1
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use Moose; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::NameProvider'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3905
|
use Path::Tiny (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
140
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub provide_name { |
|
11
|
1
|
|
|
1
|
0
|
35124
|
my $self = shift; |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
28
|
my $root = $self->zilla->root->absolute; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Dist::Zilla v6 has excised Path::Class in favor of Path::Tiny |
|
16
|
|
|
|
|
|
|
# make sure $root is a Path::Tiny object |
|
17
|
1
|
|
|
|
|
54
|
$root = Path::Tiny->new("$root"); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# make sure it is a root dir, by checking -e dist.ini |
|
20
|
1
|
50
|
|
|
|
45
|
return unless $root->child('dist.ini')->exists; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
45
|
my $name = $root->basename; |
|
23
|
1
|
|
|
|
|
29
|
$name =~ s/(?:^(?:perl|p5)-|[\-\.]pm$)//x; |
|
24
|
1
|
|
|
|
|
5
|
$self->log("guessing your distribution name is $name"); |
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
310
|
return $name; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
30
|
1
|
|
|
1
|
|
4
|
no Moose; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
4
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
|
33
|
|
|
|
|
|
|
__END__ |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding utf-8 |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Dist::Zilla::Plugin::NameFromDirectory - Guess distribution name from the current directory |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
[NameFromDirectory] |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Dist::Zilla::Plugin::NameFromDirectory is a Dist::Zilla plugin to |
|
48
|
|
|
|
|
|
|
guess distribution name (when it's not set in C<dist.ini>) from the |
|
49
|
|
|
|
|
|
|
current working directory. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Prefixes such as C<perl-> and C<p5->, as well as the postfix C<.pm> |
|
52
|
|
|
|
|
|
|
and C<-pm> will be automatically trimmed. The following directory |
|
53
|
|
|
|
|
|
|
names are all recognized as C<Foo-Bar>. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Foo-Bar |
|
56
|
|
|
|
|
|
|
p5-Foo-Bar |
|
57
|
|
|
|
|
|
|
perl-Foo-Bar |
|
58
|
|
|
|
|
|
|
Foo-Bar-pm |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
It is designed to be used with Plugin bundle so that your dist.ini |
|
61
|
|
|
|
|
|
|
doesn't need to contain per-project name anymore. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Even when this plugin is used, you can always override the name by |
|
64
|
|
|
|
|
|
|
specifying it in C<dist.ini>. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt> |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright 2013- Tatsuhiko Miyagawa |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 LICENSE |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
77
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<Dist::Zilla> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |