| 1 | package Dist::Zilla::PluginBundle::Milla; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use version; our $VERSION = version->declare('v1.0.22'); | ||
| 5 | |||
| 6 | use Dist::Milla; | ||
| 7 | use Moose; | ||
| 8 | with 'Dist::Zilla::Role::PluginBundle::Easy', | ||
| 9 | 'Dist::Zilla::Role::PluginBundle::PluginRemover', | ||
| 10 | 'Dist::Zilla::Role::PluginBundle::Config::Slicer'; | ||
| 11 | |||
| 12 | use namespace::autoclean; | ||
| 13 | |||
| 14 | has installer => ( | ||
| 15 | is => 'ro', | ||
| 16 | isa => 'Str', | ||
| 17 | lazy => 1, | ||
| 18 | default => sub { $_[0]->payload->{installer} || 'ModuleBuildTiny' }, | ||
| 19 | ); | ||
| 20 | |||
| 21 | sub build_file { | ||
| 22 | my $self = shift; | ||
| 23 | $self->installer =~ /MakeMaker/ ? 'Makefile.PL' : 'Build.PL'; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub configure { | ||
| 27 | my $self = shift; | ||
| 28 | |||
| 29 | my @accepts = qw( MakeMaker MakeMaker::IncShareDir ModuleBuild ModuleBuildTiny ); | ||
| 30 | my %accepts = map { $_ => 1 } @accepts; | ||
| 31 | |||
| 32 | unless ($accepts{$self->installer}) { | ||
| 33 | die sprintf("Unknown installer: '%s'. " . | ||
| 34 | "Acceptable values are MakeMaker, ModuleBuild and ModuleBuildTiny\n", | ||
| 35 | $self->installer); | ||
| 36 | } | ||
| 37 | |||
| 38 | my @dirty_files = ('dist.ini', 'Changes', 'META.json', 'README.md', 'LICENSE', $self->build_file); | ||
| 39 | my @exclude_release = ('README.md'); | ||
| 40 | |||
| 41 | $self->add_plugins( | ||
| 42 | [ 'NameFromDirectory' ], | ||
| 43 | |||
| 44 | # Make the git repo installable | ||
| 45 | [ 'Git::GatherDir', { exclude_filename => [ $self->build_file, 'META.json', 'LICENSE', @exclude_release ] } ], | ||
| 46 | [ 'CopyFilesFromBuild', { copy => [ 'META.json', 'LICENSE', $self->build_file ] } ], | ||
| 47 | |||
| 48 | # should be after GatherDir | ||
| 49 | # Equivalent to Module::Install's version_from, license_from and author_from | ||
| 50 | [ 'VersionFromMainModule' ], | ||
| 51 | [ 'LicenseFromModule', { override_author => 1 } ], | ||
| 52 | |||
| 53 | [ 'ReversionOnRelease', { prompt => 1 } ], | ||
| 54 | |||
| 55 | # after ReversionOnRelease for munge_files, before Git::Commit for after_release | ||
| 56 | [ 'NextRelease', { format => '%v %{yyyy-MM-dd HH:mm:ss VVV}d' } ], | ||
| 57 | |||
| 58 | [ 'Git::Check', { allow_dirty => \@dirty_files } ], | ||
| 59 | |||
| 60 | # Make Github center and front | ||
| 61 | [ 'GithubMeta', { issues => 1 } ], | ||
| 62 | [ 'ReadmeAnyFromPod', { type => 'markdown', filename => 'README.md', location => 'root' } ], | ||
| 63 | |||
| 64 | # Set no_index to sensible directories | ||
| 65 | [ 'MetaNoIndex', { directory => [ qw( t xt inc share eg examples ) ] } ], | ||
| 66 | |||
| 67 | # cpanfile -> META.json | ||
| 68 | [ 'Prereqs::FromCPANfile' ], | ||
| 69 | [ $self->installer ], | ||
| 70 | [ 'MetaJSON' ], | ||
| 71 | |||
| 72 | # experimental dist metadata | ||
| 73 | [ 'StaticInstall', { mode => 'auto' } ], | ||
| 74 | |||
| 75 | # Advertise Milla | ||
| 76 | [ 'Milla::MetaGeneratedBy' ], | ||
| 77 | |||
| 78 | # x_contributors for MetaCPAN | ||
| 79 | [ 'Git::Contributors' ], | ||
| 80 | |||
| 81 | # add Milla itself as a develop dependency | ||
| 82 | [ 'Prereqs', { -phase => 'develop', 'Dist::Milla' => Dist::Milla->VERSION } ], | ||
| 83 | |||
| 84 | # standard stuff | ||
| 85 | [ 'PodSyntaxTests' ], | ||
| 86 | [ 'MetaYAML' ], | ||
| 87 | [ 'License' ], | ||
| 88 | [ 'ReadmeAnyFromPod', 'ReadmeAnyFromPod/ReadmeTextInBuild' ], | ||
| 89 | [ 'ExtraTests' ], | ||
| 90 | [ 'ExecDir', { dir => 'script' } ], | ||
| 91 | [ 'ShareDir' ], | ||
| 92 | [ 'Manifest' ], | ||
| 93 | [ 'ManifestSkip' ], | ||
| 94 | |||
| 95 | [ 'CheckChangesHasContent' ], | ||
| 96 | [ 'TestRelease' ], | ||
| 97 | [ 'ConfirmRelease' ], | ||
| 98 | [ $ENV{FAKE_RELEASE} ? 'FakeRelease' : 'UploadToCPAN' ], | ||
| 99 | |||
| 100 | [ 'CopyFilesFromRelease', { match => '\.pm$' } ], | ||
| 101 | [ 'Git::Commit', { | ||
| 102 | commit_msg => '%v', | ||
| 103 | allow_dirty => \@dirty_files, | ||
| 104 | allow_dirty_match => '\.pm$', # .pm files copied back from Release | ||
| 105 | } ], | ||
| 106 | [ 'Git::Tag', { tag_format => '%v', tag_message => '' } ], | ||
| 107 | [ 'Git::Push', { remotes_must_exist => 0 } ], | ||
| 108 | |||
| 109 | ); | ||
| 110 | } | ||
| 111 | |||
| 112 | __PACKAGE__->meta->make_immutable; | ||
| 113 | 1; | ||
| 114 | |||
| 115 | __END__ |