Distar/000075500000000000000000000000001217715246600123155ustar00rootroot00000000000000Distar/bin/000075500000000000000000000000001217715246600130655ustar00rootroot00000000000000Distar/bin/distar-init000075500000000000000000000036111217715246600152430ustar00rootroot00000000000000#!/usr/bin/env perl use strict; use warnings FATAL => 'all'; use File::Path qw(mkpath); my $project = $ARGV[0] or die "No project name passed"; my @parts = split('-', $project); my $lib_file = join('/', 'lib', @parts).".pm"; my $author = $ENV{DISTAR_INIT_AUTHOR} or die "DISTAR_INIT_AUTHOR unset"; mkpath "${project}/maint"; mkpath join('/', $project, 'lib', @parts[0..$#parts-1]); my $package_name = join('::', @parts); open my $mpl_main, '>', "${project}/Makefile.PL" or die "couldn't open Makefile.PL: $!"; print $mpl_main sprintf(<<'END', $package_name, $lib_file); use strict; use warnings FATAL => 'all'; use ExtUtils::MakeMaker; (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; WriteMakefile( NAME => '%s', VERSION_FROM => '%s' ); END close($mpl_main); open my $mpl_maint, '>', "${project}/maint/Makefile.PL.include" or die "couldn't open maint/Makefile.PL.include: $!"; print $mpl_maint sprintf(<<'END', $author); BEGIN { -e 'Distar' or system("git clone git://git.shadowcat.co.uk/p5sagit/Distar.git") } use lib 'Distar/lib'; use Distar; author '%s'; END close($mpl_maint); open my $pm, '>', "${project}/${lib_file}" or die "Couldn't open .pm file: $!"; my $year = 1900+(localtime)[5]; my $mod_text = sprintf(<<'END', $package_name, $package_name, $author, $year, $package_name); package %s; our $VERSION = '0.000001'; # 0.0.1 $VERSION = eval $VERSION; 1; =head1 NAME %s - Description goes here =head1 SYNOPSIS =head1 DESCRIPTION =head1 AUTHOR %s =head1 CONTRIBUTORS None yet - maybe this software is perfect! (ahahahahahahahahaha) =head1 COPYRIGHT Copyright (c) %s the %s L and L as listed above. =head1 LICENSE This library is free software and may be distributed under the same terms as perl itself. END $mod_text =~ s/^ //mg; print $pm $mod_text; close $mod_text; chdir($project); system("git init"); Distar/helpers/000075500000000000000000000000001217715246600137575ustar00rootroot00000000000000Distar/helpers/add-readme-to-manifest000064400000000000000000000003251217715246600201110ustar00rootroot00000000000000#!/usr/bin/env perl use strict; use warnings FATAL => 'all'; use ExtUtils::Manifest 'maniadd'; eval { maniadd({ README => "README file (added by Distar)"}) } or print "Could not add README to MANIFEST: $@\n";Distar/lib/000075500000000000000000000000001217715246600130635ustar00rootroot00000000000000Distar/lib/Distar.pm000064400000000000000000000072661217715246600146620ustar00rootroot00000000000000package Distar; use strictures 1; use base qw(Exporter); use ExtUtils::MakeMaker (); use ExtUtils::MM (); use Config; use File::Spec; our $VERSION = '0.001000'; $VERSION = eval $VERSION; our @EXPORT = qw( author manifest_include run_preflight ); sub import { strictures->import; shift->export_to_level(1,@_); } sub author { our $Author = shift } our $Ran_Preflight; our @Manifest = ( 'lib' => '.pm', 't' => '.t', 't/lib' => '.pm', 'xt' => '.t', 'xt/lib' => '.pm', '' => qr{[^/]*\.PL}, '' => qr{Changes|MANIFEST|README|META\.yml}, '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" # print ref as well as stringification in case of overload "" : 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 run_preflight { $Ran_Preflight = 1; my $version = $ARGV[0]; system("git fetch"); my $make = $Config{make}; my $null = File::Spec->devnull; require File::Find; File::Find::find({ no_chdir => 1, wanted => sub { return unless -f && /\.pm$/; my $file_version = MM->parse_version($_); die "Module $_ version $file_version doesn't match dist version $version" unless $file_version eq 'undef' || $file_version eq $version; }}, 'lib'); for (scalar `"$make" manifest 2>&1 >$null`) { $_ && die "$make manifest changed:\n$_ Go check it and retry"; } for (scalar `git status`) { /^# On branch master/ || die "Not on master. EEEK"; /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream"; } for (scalar `git diff`) { length && die "Outstanding changes"; } my $ymd = sprintf( "%i-%02i-%02i", (localtime)[5]+1900, (localtime)[4]+1, (localtime)[3] ); my @cached = grep /^\+/, `git diff --cached -U0`; @cached > 0 or die "Please add:\n\n$version - $ymd\n\nto Changes stage Changes (git add Changes)"; @cached == 2 or die "Pre-commit Changes not just Changes line"; $cached[0] =~ /^\+\+\+ .\/Changes\n/ or die "Changes not changed"; $cached[1] eq "+$version - $ymd\n" or die "Changes new line should be: \n\n$version - $ymd\n "; } { package Distar::MM; our @ISA = @ExtUtils::MM::ISA; @ExtUtils::MM::ISA = (__PACKAGE__); sub new { my ($class, $args) = @_; return $class->SUPER::new({ LICENSE => 'perl', %$args, AUTHOR => $Distar::Author, ABSTRACT_FROM => $args->{VERSION_FROM}, test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t' }, }); } sub dist_test { my $self = shift; my $dist_test = $self->SUPER::dist_test(@_) . <<'END'; # --- Distar section: preflight: perl -IDistar/lib -MDistar -erun_preflight $(VERSION) release: preflight $(MAKE) disttest rm -rf $(DISTVNAME) $(MAKE) $(DISTVNAME).tar$(SUFFIX) git commit -a -m "Release commit for $(VERSION)" git tag v$(VERSION) -m "release v$(VERSION)" cpan-upload $(DISTVNAME).tar$(SUFFIX) git push origin v$(VERSION) HEAD distdir: readmefile readmefile: create_distdir pod2text $(VERSION_FROM) >$(DISTVNAME)/README $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-readme-to-manifest END if (open my $fh, '<', 'maint/Makefile.include') { $dist_test .= do { local $/; <$fh> }; } return $dist_test; } } END { write_manifest_skip() unless $Ran_Preflight } 1;