Module-Starter
view release on metacpan or search on metacpan
lib/Module/Starter/Simple.pm view on Meta::CPAN
=head2 ignores_guts()
Called by C<create_ignores>, this method returns the contents of the
ignore file.
=cut
sub ignores_guts {
my ($self, $type) = @_;
my $ms = $self->{manifest_skip} ? "MANIFEST\nMANIFEST.bak\n" : '';
my $guts = {
generic => $ms.<<"EOF",
Makefile
Makefile.old
Build
Build.bat
META.*
MYMETA.*
.build/
_build/
cover_db/
blib/
inc/
.lwpcookies
.last_cover_stats
nytprof.out
pod2htm*.tmp
pm_to_blib
$self->{distro}-*
$self->{distro}-*.tar.gz
EOF
# make this more restrictive, since MANIFEST tends to be less noticeable
# (also, manifest supports REs.)
manifest => <<'EOF',
# Top-level filter (only include the following...)
^(?!(?:script|examples|lib|inc|t|xt|maint)/|(?:(?:Makefile|Build)\.PL|README|LICENSE|MANIFEST|Changes|META\.(?:yml|json))$)
# Avoid version control files.
\bRCS\b
\bCVS\b
,v$
\B\.svn\b
\b_darcs\b
# (.git or .hg only in top-level, hence it's blocked above)
# Avoid temp and backup files.
~$
\.tmp$
\.old$
\.bak$
\..*?\.sw[po]$
\#$
\b\.#
# avoid OS X finder files
\.DS_Store$
# ditto for Windows
\bdesktop\.ini$
\b[Tt]humbs\.db$
# Avoid patch remnants
\.orig$
\.rej$
EOF
};
$guts->{hg} = $guts->{cvs} = $guts->{git} = $guts->{generic};
return $guts->{$type};
}
=head1 HELPER METHODS
=head2 verbose
C<verbose> tells us whether we're in verbose mode.
=cut
sub verbose { return shift->{verbose} }
=head2 create_file( $fname, @content_lines )
Creates I<$fname>, dumps I<@content_lines> in it, and closes it.
Dies on any error.
=cut
sub create_file {
my $self = shift;
my $fname = shift;
if ( -f $fname ) {
if ( !$self->{'force'} ) {
warn "Will not overwrite '$fname' (--force option not enabled)";
return;
}
}
my @content = @_;
open( my $fh, '>', $fname ) or confess "Can't create $fname: $!\n";
print {$fh} @content;
close $fh or die "Can't close $fname: $!\n";
return;
}
=head2 progress( @list )
C<progress> prints the given progress message if we're in verbose mode.
=cut
sub progress {
my $self = shift;
print @_, "\n" if $self->verbose;
return;
}
( run in 2.302 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )