/usr/share/perl5/Dist/Zilla/Role/Git/DirtyFiles.pm is in libdist-zilla-plugin-git-perl 1.113560-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #
# This file is part of Dist-Zilla-Plugin-Git
#
# This software is copyright (c) 2009 by Jerome Quelin.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use 5.008;
use strict;
use warnings;
package Dist::Zilla::Role::Git::DirtyFiles;
{
$Dist::Zilla::Role::Git::DirtyFiles::VERSION = '1.113560';
}
# ABSTRACT: provide the allow_dirty & changelog attributes
use Moose::Role;
use Moose::Autobox;
use MooseX::Has::Sugar;
use MooseX::Types::Moose qw{ ArrayRef Str };
use List::Util 'first';
# -- attributes
has allow_dirty => (
ro, lazy,
isa => ArrayRef[Str],
builder => '_build_allow_dirty',
);
has changelog => ( ro, isa=>Str, default => 'Changes' );
around mvp_multivalue_args => sub {
my ($orig, $self) = @_;
my @start = $self->$orig;
return (@start, 'allow_dirty');
};
# -- builders & initializers
sub _build_allow_dirty { [ 'dist.ini', shift->changelog ] }
sub list_dirty_files
{
my ($self, $git, $listAllowed) = @_;
my @allowed = map { qr/${_}$/ } $self->allow_dirty->flatten;
return grep {
my $file = $_;
if ( first { $file =~ $_ } @allowed ) {
$listAllowed
} else {
!$listAllowed
}
} $git->ls_files( { modified=>1, deleted=>1 } );
} # end list_dirty_files
no Moose::Role;
no MooseX::Has::Sugar;
1;
=pod
=head1 NAME
Dist::Zilla::Role::Git::DirtyFiles - provide the allow_dirty & changelog attributes
=head1 VERSION
version 1.113560
=head1 DESCRIPTION
This role is used within the git plugin to work with files that are
dirty in the local git checkout.
=head1 ATTRIBUTES
=head2 allow_dirty
A list of files that are allowed to be dirty in the git checkout.
Defaults to C<dist.ini> and the changelog (as defined per the
C<changelog> attribute.
=head2 changelog
The name of the changelog. Defaults to C<Changes>.
=head1 METHODS
=head2 list_dirty_files
my @dirty = $plugin->list_dirty_files($git, $listAllowed);
This returns a list of the modified or deleted files in C<$git>,
filtered against the C<allow_dirty> attribute. If C<$listAllowed> is
true, only allowed files are listed. If it's false, only files that
are not allowed to be dirty are listed.
In scalar context, returns the number of dirty files.
=for Pod::Coverage mvp_multivalue_args
=head1 AUTHOR
Jerome Quelin
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
__END__
|