File Coverage

blib/lib/Dist/Zilla/PluginBundle/Author/AJNN/PruneAliases.pm
Criterion Covered Total %
statement 14 26 53.8
branch 0 6 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 19 40 47.5


line stmt bran cond sub pod time code
1 2     2   1359 use 5.026;
  2         6  
2 2     2   12 use warnings;
  2         9  
  2         110  
3              
4             # ABSTRACT: Prune macOS aliases
5             $Dist::Zilla::PluginBundle::Author::AJNN::PruneAliases::VERSION = '0.02';
6              
7             use Dist::Zilla;
8 2     2   639 use Moose;
  2         680252  
  2         71  
9 2     2   12 use namespace::autoclean;
  2         4  
  2         13  
10 2     2   11445  
  2         7  
  2         20  
11             with 'Dist::Zilla::Role::FilePruner';
12              
13              
14             my ($self) = @_;
15            
16 0     0 0   my @aliases = grep { $self->_is_alias($_) } $self->zilla->files->@*;
17             $self->zilla->prune_file($_) for @aliases;
18 0           }
  0            
19 0            
20              
21             my ($self, $file) = @_;
22            
23             # Try to read macOS alias magic number
24 0     0     open my $fh, '<:raw', $file->name or return;
25             my $data;
26             my $success = read $fh, $data, 16;
27 0 0         close $fh;
28 0           $success or return;
29 0           return 1 if $data eq "book\0\0\0\0mark\0\0\0\0";
30 0          
31 0 0         return;
32 0 0         };
33              
34 0            
35             __PACKAGE__->meta->make_immutable;
36              
37             1;
38              
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             Dist::Zilla::PluginBundle::Author::AJNN::PruneAliases - Prune macOS aliases
47              
48             =head1 VERSION
49              
50             version 0.02
51              
52             =head1 DESCRIPTION
53              
54             This plugin prunes all macOS alias files.
55              
56             =head1 SEE ALSO
57              
58             L<Dist::Zilla::PluginBundle::Author::AJNN>
59              
60             L<Dist::Zilla::Plugin::PruneCruft>
61              
62             L<https://en.wikipedia.org/wiki/Alias_(Mac_OS)>
63              
64             =head1 AUTHOR
65              
66             Arne Johannessen <ajnn@cpan.org>
67              
68             If you contact me by email, please make sure you include the word
69             "Perl" in your subject header to help beat the spam filters.
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             Arne Johannessen has dedicated the work to the Commons by waiving all of his
74             or her rights to the work worldwide under copyright law and all related or
75             neighboring legal rights he or she had in the work, to the extent allowable by
76             law.
77              
78             Works under CC0 do not require attribution. When citing the work, you should
79             not imply endorsement by the author.
80              
81             =cut