| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | package Dist::Zilla::PluginBundle::Author::OpusVL; | ||
| 4 | |||
| 5 | use Moose; | ||
| 6 | use 5.014; | ||
| 7 | with ( | ||
| 8 | 'Dist::Zilla::Role::PluginBundle::Easy', | ||
| 9 | 'Dist::Zilla::Role::PluginBundle::PluginRemover', | ||
| 10 | 'Dist::Zilla::Role::PluginBundle::Config::Slicer', | ||
| 11 | ); | ||
| 12 | |||
| 13 | our $VERSION = '0.015'; | ||
| 14 | |||
| 15 | sub configure { | ||
| 16 | my ($self) = @_; | ||
| 17 | |||
| 18 | die "CPAN::Mini::Inject::REST hostname must be set in mcpani_host" | ||
| 19 | if not $self->payload->{mcpani_host}; | ||
| 20 | |||
| 21 | my $remove = $self->payload->{ $self->plugin_remover_attribute } || []; | ||
| 22 | |||
| 23 | $self->add_plugins( | ||
| 24 | [ | ||
| 25 | 'Git::GatherDir' => | ||
| 26 | GatherActualCode => { | ||
| 27 | exclude_filename => [ | ||
| 28 | qw( LICENSE ) | ||
| 29 | ] | ||
| 30 | } | ||
| 31 | ], | ||
| 32 | [ | ||
| 33 | CopyFilesFromBuild => | ||
| 34 | CopyLicenseAndThings => { | ||
| 35 | copy => [ qw( LICENSE ) ] | ||
| 36 | } | ||
| 37 | ], | ||
| 38 | qw( | ||
| 39 | Prereqs::FromCPANfile | ||
| 40 | SurgicalPodWeaver | ||
| 41 | )); | ||
| 42 | $self->add_bundle('@Starter', { | ||
| 43 | '-remove' => [ 'GatherDir', 'UploadToCPAN', 'TestRelease', @$remove ], | ||
| 44 | }); | ||
| 45 | |||
| 46 | $self->add_plugins(qw( | ||
| 47 | CheckChangesHasContent | ||
| 48 | RewriteVersion | ||
| 49 | NextRelease | ||
| 50 | Repository | ||
| 51 | ), | ||
| 52 | [ Encoding => | ||
| 53 | CommonBinaryFiles => { | ||
| 54 | match => '\.(png|jpg|db)$', | ||
| 55 | encoding => 'bytes' | ||
| 56 | } ], | ||
| 57 | [ 'Git::Commit' => | ||
| 58 | CommitGeneratedFiles => { | ||
| 59 | allow_dirty => [ qw/dist.ini Changes cpanfile LICENSE/ ] | ||
| 60 | } ], | ||
| 61 | 'ExecDir', | ||
| 62 | [ ExecDir => | ||
| 63 | ScriptDir => { dir => 'script' } | ||
| 64 | ], | ||
| 65 | qw( | ||
| 66 | Git::Tag | ||
| 67 | BumpVersionAfterRelease | ||
| 68 | ), | ||
| 69 | ['Git::Commit' => | ||
| 70 | CommitVersionBump => { allow_dirty_match => '^lib/', commit_msg => "Bumped version number" } ], | ||
| 71 | 'Git::Push', | ||
| 72 | ['CPAN::Mini::Inject::REST' => | ||
| 73 | $self->config_slice({ | ||
| 74 | mcpani_host => 'host', | ||
| 75 | mcpani_port => 'port', | ||
| 76 | mcpani_protocol => 'protocol', | ||
| 77 | }) ], | ||
| 78 | [ Prereqs => 'TestMoreWithSubtests' => { | ||
| 79 | -phase => 'test', | ||
| 80 | -type => 'requires', | ||
| 81 | 'Test::More' => '0.96' | ||
| 82 | } ], | ||
| 83 | ); | ||
| 84 | } | ||
| 85 | |||
| 86 | __PACKAGE__->meta->make_immutable; | ||
| 87 | no Moose; | ||
| 88 | |||
| 89 | 1; | ||
| 90 | |||
| 91 | =encoding utf8 | ||
| 92 | |||
| 93 | =head1 NAME | ||
| 94 | |||
| 95 | Dist::Zilla::PluginBundle::Author::OpusVL - Standard behaviour for OpusVL modules | ||
| 96 | |||
| 97 | =head1 SYNOPSIS | ||
| 98 | |||
| 99 | In your F<dist.ini>: | ||
| 100 | |||
| 101 | [@Author::OpusVL] | ||
| 102 | mcpani_host = some.cpan.host | ||
| 103 | |||
| 104 | =head1 DESCRIPTION | ||
| 105 | |||
| 106 | This generally implements the workflow that OpusVL modules will use. | ||
| 107 | |||
| 108 | It is roughly equivalent to: | ||
| 109 | |||
| 110 | [Git::GatherDir] | ||
| 111 | [@Starter] | ||
| 112 | ; ...but without GatherDir and UploadToCPAN or TestRelease | ||
| 113 | |||
| 114 | [Prereqs::FromCPANfile] | ||
| 115 | [CheckChangesHasContent] | ||
| 116 | [RewriteVersion] | ||
| 117 | [NextRelease] | ||
| 118 | [Repository] | ||
| 119 | [PodWeaver] | ||
| 120 | finder = :InstallModules | ||
| 121 | |||
| 122 | [Git::Commit / CommitGeneratedFiles] | ||
| 123 | allow_dirty = dist.ini | ||
| 124 | allow_dirty = Changes | ||
| 125 | allow_dirty = cpanfile | ||
| 126 | allow_dirty = LICENSE | ||
| 127 | [ExecDir] | ||
| 128 | dir = script | ||
| 129 | |||
| 130 | [Git::Tag] | ||
| 131 | [BumpVersionAfterRelease] | ||
| 132 | [Git::Commit / CommitVersionBump] | ||
| 133 | allow_dirty_match = ^lib/ | ||
| 134 | commit_msg = "Bumped version number" | ||
| 135 | |||
| 136 | [Git::Push] | ||
| 137 | [CPAN::Mini::Inject::REST] | ||
| 138 | |||
| 139 | [Prereqs / TestMoreWithSubtests] | ||
| 140 | -phase = test | ||
| 141 | -type = requires | ||
| 142 | Test::More = 0.96 | ||
| 143 | |||
| 144 | Your module files should contain: | ||
| 145 | |||
| 146 | # ABSTRACT: frobnicates the whirligigs | ||
| 147 | |||
| 148 | our $VERSION = '0.001'; | ||
| 149 | |||
| 150 | For PodWeaver (the ABSTRACT) and RewriteVersion (the $VERSION). | ||
| 151 | |||
| 152 | Your script files should additionally contain | ||
| 153 | |||
| 154 | # PODNAME: myscript | ||
| 155 | |||
| 156 | Modules and scripts should thus not contain a NAME section in their POD. | ||
| 157 | |||
| 158 | =head1 TODO | ||
| 159 | |||
| 160 | The two modules in this distribution need to be split into roles so we don't | ||
| 161 | have to provide dummy data for mcpani_host in the ToCPAN version that doesn't | ||
| 162 | use it. |