From: Matt S Trout Date: Mon, 14 Feb 2011 22:39:53 +0000 (+0000) Subject: first cut at Distar X-Git-Tag: v0.001000~37 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=42e08a83216e13515942995a7f1707b12ac8b95b;p=p5sagit%2FDistar.git first cut at Distar --- 42e08a83216e13515942995a7f1707b12ac8b95b diff --git a/lib/Distar.pm b/lib/Distar.pm new file mode 100644 index 0000000..7169783 --- /dev/null +++ b/lib/Distar.pm @@ -0,0 +1,78 @@ +package Distar; + +use strictures 1; +use base qw(Exporter); + +our @EXPORT = qw( + author manifest_include +); + +sub import { + strictures->import; + shift->export_to_level(1,@_); +} + +sub author { our $Author = shift } + +our @Manifest = ( + 'lib' => '.pm', + 't' => '.t', + 't/lib' => '.pm', + 'xt' => '.t', + 'xt/lib' => '.pm', + '' => '.PL', + '' => qr{Changes|MANIFEST|README|META\.yml}, + '' => qr{t/smells-of-vcs/.svn}, + 'maint' => qr{[^.].*}, +); + +sub manifest_include { + push @Manifest, @_; +} + +sub write_manifest_skip { + use autodie; + my @files = @Manifest; + my @parts; + while (my ($dir, $spec) = splice(@files, 0, 2)) { + my $re = ($dir ? $dir.'/' : ''). + ((ref($spec) eq 'Regexp') + ? $spec + : !ref($spec) + ? ".*\Q${spec}\E" + : die "spec must be string or regexp, was: ${spec} (${\ref $spec})"); + push @parts, $re; + } + my $final = '^(?!'.join('|', map "${_}\$", @parts).')'; + open my $skip, '>', 'MANIFEST.SKIP'; + print $skip "${final}\n"; + close $skip; +} + +sub MY::postamble { <<'END'; } +upload: $(DISTVNAME).tar$(SUFFIX) + cpan-upload $< +release: upload + git commit -a -m "Release commit for $(VERSION)" + git tag release_$(VERSION) + git push + git push --tags +END + +{ + no warnings 'redefine'; + sub main::WriteMakefile { + my %args = @_; + system("pod2text $args{VERSION_FROM} >README"); + ExtUtils::MakeMaker::WriteMakefile( + @_, AUTHOR => our $Author, ABSTRACT_FROM => $args{VERSION_FROM}, + test => { TESTS => ($args{test}{TESTS}||'').' xt/*.t' }, + ); + } +} + +END { + write_manifest_skip() +} + +1;