/usr/share/perl5/Dist/Zilla/Plugin/Config/Git.pm is in libdist-zilla-plugin-config-git-perl 0.92-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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | package Dist::Zilla::Plugin::Config::Git;
our $VERSION = '0.92'; # VERSION
# ABSTRACT: Plugin configuration containing settings for a Git repo
#############################################################################
# Modules
use Moose;
use MooseX::Types::Moose qw(Str ArrayRef RegexpRef);
with 'Dist::Zilla::Role::Plugin';
#############################################################################
# Regular Expressions (for subtypes)
### NOTE: Subtypes are responsible for using ^$ ###
# RegExp rule based on git-check-ref-format
my $valid_ref_name = qr%
(?!
# begins with
/| # (from #6) cannot begin with /
# contains
.*(?:
[/.]\.| # (from #1,3) cannot contain /. or ..
//| # (from #6) cannot contain multiple consecutive slashes
@\{| # (from #8) cannot contain a sequence @{
\\ # (from #9) cannot contain a \
)
)
# (from #2) (waiving this rule; too strict)
[^\040\177 ~^:?*[]+ # (from #4-5) valid character rules
# ends with
(?<!\.lock) # (from #1) cannot end with .lock
(?<![/.]) # (from #6-7) cannot end with / or .
%x;
# based mostly on git-clone
### XXX: While not technically valid, we're making \s illegal everywhere for sanity ###
my $valid_git_repo = qr%
# standard ref name
# XXX: This is probably wrong, but it works for now.
$valid_ref_name|
# valid URL (with standard git schemes)
(?:
(?:ssh|git|https?|ftps?|rsync|file):// # scheme
(?:[^\s@]+\@)? # user
[\w\d\.\[\]\:]+ # host/port
/*\S+ # dir/file
)|
# non-scheme URL format
(?:
(?:[^\s@]+\@)? # user
[\w\d\.\[\]]+ # host
:
/*\S+ # dir/file
)|
# filename
(?:
(?:\.\.)?[\\/]+ # ../ or ..\ or / or \
\S+ # (Thanks UNIX!)
)
%x;
#############################################################################
# Subtypes
use MooseX::Types -declare => [qw(
GitRepo
GitBranch
)];
subtype GitRepo,
as Str,
where { /^$valid_git_repo$/ }
;
subtype GitBranch,
as Str,
where { /^$valid_ref_name$/ }
;
use namespace::clean;
#############################################################################
# Attributes
has remote => (
is => 'ro',
isa => GitRepo,
default => 'origin',
);
has local_branch => (
is => 'ro',
isa => GitBranch,
default => 'master',
);
has remote_branch => (
is => 'ro',
isa => GitBranch,
lazy => 1,
default => sub { shift->local_branch },
);
has allow_dirty => (
is => 'ro',
isa => ArrayRef[Str|RegexpRef],
lazy => 1,
default => sub { [ 'dist.ini', shift->changelog ] },
);
has changelog => (
is => 'ro',
isa => Str,
default => 'Changes',
);
sub mvp_multivalue_args { qw(allow_dirty) }
#############################################################################
# Pre/post-BUILD
sub BUILDARGS {
my ($class, @arg) = @_;
my %copy = ref $arg[0] ? %{$arg[0]} : @arg;
my $zilla = delete $copy{zilla};
# Morph allow_dirty REs
if (defined $copy{allow_dirty}) {
my @new;
my @allow_dirty = ref $copy{allow_dirty} ? @{ $copy{allow_dirty} } : ($copy{allow_dirty});
foreach my $filespec (@allow_dirty) {
if ($filespec =~ m!
# Mimic a real Perl qr with delimiters
^qr(?:
<.+>|\(.+\)|\[.+\]||\{.+\}| # <>, (), [], {}
([^\w\s]).+\1 # any non-word/space character
)$
!x) {
my $re = substr($filespec, 3, -1);
push @new, qr/$re/;
}
else {
push @new, $filespec;
}
}
$copy{allow_dirty} = \@new;
}
return {
zilla => $zilla,
%copy,
};
}
42;
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::Plugin::Config::Git - Plugin configuration containing settings for a Git repo
=head1 SYNOPSIS
[Config::Git / Git::main]
remote = origin
local_branch = master
remote_branch = master
allow_dirty = dist.ini
allow_dirty = README
allow_dirty = qr{\w+\.ini}
changelog = Changes
[Git::CheckFor::CorrectBranch]
git_config = Git::main
[@Git]
git_config = Git::main
; etc.
=head1 DESCRIPTION
This is a configuration plugin for Git repoE<sol>branch information. A configuration plugin is sort of like a Stash, but is better suited
for intra-plugin data sharing, using distro (not user) data.
Why use this? To provide a standard set of information to other Git plugins easily, especially if the repo data is non-standard, or if
you need more than one set of data.
=for Pod::Coverage mvp_multivalue_args
=head1 OPTIONS
=head2 remote
Name of the remote repo, in standard Git repo format (refspec or git URL).
Default is C<<< origin >>>.
=head2 local_branch
Name of the local branch name.
Default is C<<< master >>>.
=head2 remote_branch
Name of the remote branch name.
Default is C<<< master >>>.
=head2 allow_dirty
Filenames of files in the local repo that are allowed to have modifications prior to a write action, such as a commit. Multiple lines
are allowed. Any strings in standard C<<< qr >>> notation are interpreted as regular expressions.
Default is C<<< dist.ini >>> and whatever L<changelog> is set to.
=head2 changelog
Name of your change log.
Default is C<<< Changes >>>.
=head1 ACKNOWLEDGEMENTS
Kent Fredric and Karen Etheridge for implementation discussion. Graham Knop for continuous code reviews.
=head1 AVAILABILITY
The project homepage is L<https://github.com/SineSwiper/Dist-Zilla-Plugin-Config-Git>.
The latest version of this module is available from the Comprehensive Perl
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN
site near you, or see L<https://metacpan.org/module/Dist::Zilla::Plugin::Config::Git/>.
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Internet Relay Chat
You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is,
please read this excellent guide: L<http://en.wikipedia.org/wiki/Internet_Relay_Chat>. Please
be courteous and patient when talking to us, as we might be busy or sleeping! You can join
those networks/channels and get help:
=over 4
=item *
irc.perl.org
You can connect to the server at 'irc.perl.org' and talk to this person for help: SineSwiper.
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests via L<https://github.com/SineSwiper/Dist-Zilla-Plugin-Config-Git/issues>.
=head1 AUTHOR
Brendan Byrd <BBYRD@CPAN.org>
=head1 CONTRIBUTOR
Graham Knop <haarg@haarg.org>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Brendan Byrd.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut
|