| 1 | package Dist::Zilla::PluginBundle::Starter::Git; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | extends 'Dist::Zilla::PluginBundle::Starter'; | |||||||||||
| 5 | 4 | ▶ | use namespace::clean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 4 | our $VERSION = 'v6.0.0'; | |||||||||||
| 8 | |||||||||||||
| 9 | has '+revision' => ( | ||||||||||||
| 10 | 4 | ▶ | default => sub { $_[0]->payload->{revision} // 3 }, | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->payload->{"revision"} // 3
MC/DC100%1/1
$_[0]->payload->{"revision"} // 3
$_[0]->payload->{"revision"}
Truth table100%2/2
A
A= $_[0]->payload->{"revision"}
| |||||||||||||
| 11 | 4 | ); | |||||||||||
| 12 | |||||||||||||
| 13 | 4 | ▶ | before configure => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||
| 14 | 4 | my ($self) = @_; | |||||||||||
| 15 | 4 | my $name = $self->name; | |||||||||||
| 16 | 4 | ▶ | die "[$name] requires at least revision 3\n" unless $self->revision >= 3; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 4 | }; | |||||||||||
| 18 | |||||||||||||
| 19 | 4 | ▶ | sub gather_plugin { 'Git::GatherDir' } | ||||||||||
|
Subroutine
gather_plugin: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 20 | |||||||||||||
| 21 | 4 | my @allow_dirty = qw(dist.ini Changes); | |||||||||||
| 22 | |||||||||||||
| 23 | 4 | ▶ | sub pluginset_release_management { | ||||||||||
|
Subroutine
pluginset_release_management: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||
| 24 | 4 | my ($self) = @_; | |||||||||||
| 25 | 4 | my $versions = $self->managed_versions; | |||||||||||
| 26 | 4 | my @copy_files = @{$self->regenerate}; | |||||||||||
| 27 | 4 | my @plugins; | |||||||||||
| 28 | 4 | push @plugins, ['Git::Check' => {allow_dirty => [@allow_dirty]}]; | |||||||||||
| 29 | 4 | ▶ | push @plugins, 'RewriteVersion', | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | [NextRelease => { format => '%-9v %{yyyy-MM-dd HH:mm:ss VVV}d%{ (TRIAL RELEASE)}T' }] | ||||||||||||
| 31 | if $versions; | ||||||||||||
| 32 | 4 | ▶ | push @plugins, | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | [CopyFilesFromRelease => { filename => [@copy_files] }], | ||||||||||||
| 34 | ['Regenerate::AfterReleasers' => { plugin => $self->name . '/CopyFilesFromRelease' }], | ||||||||||||
| 35 | if @copy_files; | ||||||||||||
| 36 | 4 | push @plugins, | |||||||||||
| 37 | ['Git::Commit' => 'Release_Commit' => { allow_dirty => [@allow_dirty, @copy_files], add_files_in => '/', commit_msg => '%v%n%n%c' }], | ||||||||||||
| 38 | ['Git::Tag' => { tag_format => '%v', tag_message => '%v' }]; | ||||||||||||
| 39 | 4 | ▶ | push @plugins, 'BumpVersionAfterRelease', | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | ['Git::Commit' => 'Version_Bump_Commit' => { allow_dirty_match => '^', commit_msg => 'Bump version' }] | ||||||||||||
| 41 | if $versions; | ||||||||||||
| 42 | 4 | push @plugins, 'Git::Push'; | |||||||||||
| 43 | 4 | return @plugins; | |||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 47 | 4 | 1; | |||||||||||
| 48 | |||||||||||||
| 49 | =head1 NAME | ||||||||||||
| 50 | |||||||||||||
| 51 | Dist::Zilla::PluginBundle::Starter::Git - A minimal Dist::Zilla plugin bundle for git workflows | ||||||||||||
| 52 | |||||||||||||
| 53 | =head1 SYNOPSIS | ||||||||||||
| 54 | |||||||||||||
| 55 | ; dist.ini | ||||||||||||
| 56 | name = My-Cool-Distribution | ||||||||||||
| 57 | author = Example Jones <jones@example.com> | ||||||||||||
| 58 | license = Perl_5 | ||||||||||||
| 59 | copyright_holder = Example Jones | ||||||||||||
| 60 | copyright_year = 2017 | ||||||||||||
| 61 | version = 0.001 | ||||||||||||
| 62 | |||||||||||||
| 63 | [@Starter::Git] ; all that is needed to start | ||||||||||||
| 64 | revision = 6 ; always defaults to revision 3 | ||||||||||||
| 65 | |||||||||||||
| 66 | ; configuring examples | ||||||||||||
| 67 | installer = ModuleBuildTiny | ||||||||||||
| 68 | -remove = Pod2Readme ; to use [Readme::Brief] instead, for example | ||||||||||||
| 69 | ExecDir.dir = script ; change the directory used by [ExecDir] | ||||||||||||
| 70 | managed_versions = 1 ; uses the main module version, and bumps module versions after release | ||||||||||||
| 71 | regenerate = LICENSE ; copy LICENSE to repository after release or dzil regenerate | ||||||||||||
| 72 | |||||||||||||
| 73 | =head1 DESCRIPTION | ||||||||||||
| 74 | |||||||||||||
| 75 | The C<[@Starter::Git]> plugin bundle for L<Dist::Zilla> is a subclass of the | ||||||||||||
| 76 | L<[@Starter]|Dist::Zilla::PluginBundle::Starter> plugin bundle designed to | ||||||||||||
| 77 | support a Git-based workflow. | ||||||||||||
| 78 | |||||||||||||
| 79 | In addition to the standard C<[@Starter]> behavior, this bundle restricts the | ||||||||||||
| 80 | gathered files to those committed to the git repository, allowing F<.gitignore> | ||||||||||||
| 81 | to also ignore files when assembling the distribution; and commits, tags, and | ||||||||||||
| 82 | pushes after a successful release. | ||||||||||||
| 83 | |||||||||||||
| 84 | See the L<Dist::Zilla::Starter> guide and the base | ||||||||||||
| 85 | L<[@Starter]|Dist::Zilla::PluginBundle::Starter> documentation for more | ||||||||||||
| 86 | information, as this documentation only details the specifics of this subclass. | ||||||||||||
| 87 | |||||||||||||
| 88 | For one-line initialization of a new C<[@Starter::Git]>-based distribution, try | ||||||||||||
| 89 | L<Dist::Zilla::MintingProfile::Starter::Git>. | ||||||||||||
| 90 | |||||||||||||
| 91 | =head1 OPTIONS | ||||||||||||
| 92 | |||||||||||||
| 93 | C<[@Starter::Git]> inherits the options from | ||||||||||||
| 94 | L<[@Starter]|Dist::Zilla::PluginBundle::Starter>, and can similarly be further | ||||||||||||
| 95 | configured by the composed roles, as in | ||||||||||||
| 96 | L<Dist::Zilla::PluginBundle::Starter/"CONFIGURING">. | ||||||||||||
| 97 | |||||||||||||
| 98 | =head2 revision | ||||||||||||
| 99 | |||||||||||||
| 100 | [@Starter::Git] | ||||||||||||
| 101 | revision = 6 | ||||||||||||
| 102 | |||||||||||||
| 103 | As in L<Dist::Zilla::PluginBundle::Starter/"revision">, but defaults to | ||||||||||||
| 104 | revision 3. C<[@Starter::Git]> requires at least revision 3. | ||||||||||||
| 105 | |||||||||||||
| 106 | =head2 installer | ||||||||||||
| 107 | |||||||||||||
| 108 | As in L<Dist::Zilla::PluginBundle::Starter/"installer">. | ||||||||||||
| 109 | |||||||||||||
| 110 | =head2 managed_versions | ||||||||||||
| 111 | |||||||||||||
| 112 | As in L<Dist::Zilla::PluginBundle::Starter/"managed_versions">, and | ||||||||||||
| 113 | additionally uses L<[Git::Commit]|Dist::Zilla::Plugin::Git::Commit> a second | ||||||||||||
| 114 | time after L<[BumpVersionAfterRelease]|Dist::Zilla::Plugin::BumpVersionAfterRelease> | ||||||||||||
| 115 | to commit the bumped versions (with the plugin name C<Version_Bump_Commit>). | ||||||||||||
| 116 | |||||||||||||
| 117 | =head2 regenerate | ||||||||||||
| 118 | |||||||||||||
| 119 | As in L<Dist::Zilla::PluginBundle::Starter/"regenerate">, and allows changes to | ||||||||||||
| 120 | the copied files to be committed in the C<Release_Commit>. | ||||||||||||
| 121 | |||||||||||||
| 122 | =head1 REVISIONS | ||||||||||||
| 123 | |||||||||||||
| 124 | The C<[@Starter::Git]> plugin bundle supports the following revisions. | ||||||||||||
| 125 | |||||||||||||
| 126 | =head2 Revision 6 | ||||||||||||
| 127 | |||||||||||||
| 128 | Revision 6 is the current set of best practices, equivalent to using the | ||||||||||||
| 129 | following plugins if not configured further: | ||||||||||||
| 130 | |||||||||||||
| 131 | =over 2 | ||||||||||||
| 132 | |||||||||||||
| 133 | =item L<[Git::GatherDir]|Dist::Zilla::Plugin::Git::GatherDir> | ||||||||||||
| 134 | |||||||||||||
| 135 | =item L<[MetaYAML]|Dist::Zilla::Plugin::MetaYAML> | ||||||||||||
| 136 | |||||||||||||
| 137 | =item L<[MetaJSON]|Dist::Zilla::Plugin::MetaJSON> | ||||||||||||
| 138 | |||||||||||||
| 139 | =item L<[License]|Dist::Zilla::Plugin::License> | ||||||||||||
| 140 | |||||||||||||
| 141 | =item L<[Pod2Readme]|Dist::Zilla::Plugin::Pod2Readme> | ||||||||||||
| 142 | |||||||||||||
| 143 | =item L<[PodSyntaxTests]|Dist::Zilla::Plugin::PodSyntaxTests> | ||||||||||||
| 144 | |||||||||||||
| 145 | =item L<[Test::ReportPrereqs]|Dist::Zilla::Plugin::Test::ReportPrereqs> | ||||||||||||
| 146 | |||||||||||||
| 147 | =item L<[Test::Compile]|Dist::Zilla::Plugin::Test::Compile> | ||||||||||||
| 148 | |||||||||||||
| 149 | xt_mode = 1 | ||||||||||||
| 150 | |||||||||||||
| 151 | =item L<[MakeMaker]|Dist::Zilla::Plugin::MakeMaker> | ||||||||||||
| 152 | |||||||||||||
| 153 | =item L<[Manifest]|Dist::Zilla::Plugin::Manifest> | ||||||||||||
| 154 | |||||||||||||
| 155 | =item L<[PruneCruft]|Dist::Zilla::Plugin::PruneCruft> | ||||||||||||
| 156 | |||||||||||||
| 157 | =item L<[PruneFiles]|Dist::Zilla::Plugin::PruneFiles> | ||||||||||||
| 158 | |||||||||||||
| 159 | filename = README.pod | ||||||||||||
| 160 | |||||||||||||
| 161 | =item L<[ManifestSkip]|Dist::Zilla::Plugin::ManifestSkip> | ||||||||||||
| 162 | |||||||||||||
| 163 | =item L<[RunExtraTests]|Dist::Zilla::Plugin::RunExtraTests> | ||||||||||||
| 164 | |||||||||||||
| 165 | =item L<[Git::Check]|Dist::Zilla::Plugin::Git::Check> | ||||||||||||
| 166 | |||||||||||||
| 167 | allow_dirty = dist.ini | ||||||||||||
| 168 | allow_dirty = Changes | ||||||||||||
| 169 | |||||||||||||
| 170 | =item L<[Git::Commit E<sol> Release_Commit]|Dist::Zilla::Plugin::Git::Commit> | ||||||||||||
| 171 | |||||||||||||
| 172 | allow_dirty = dist.ini | ||||||||||||
| 173 | allow_dirty = Changes | ||||||||||||
| 174 | add_files_in = / | ||||||||||||
| 175 | commit_msg = %v%n%n%c | ||||||||||||
| 176 | |||||||||||||
| 177 | =item L<[Git::Tag]|Dist::Zilla::Plugin::Git::Tag> | ||||||||||||
| 178 | |||||||||||||
| 179 | tag_format = %v | ||||||||||||
| 180 | tag_message = %v | ||||||||||||
| 181 | |||||||||||||
| 182 | =item L<[Git::Push]|Dist::Zilla::Plugin::Git::Push> | ||||||||||||
| 183 | |||||||||||||
| 184 | =item L<[TestRelease]|Dist::Zilla::Plugin::TestRelease> | ||||||||||||
| 185 | |||||||||||||
| 186 | =item L<[ConfirmRelease]|Dist::Zilla::Plugin::ConfirmRelease> | ||||||||||||
| 187 | |||||||||||||
| 188 | =item L<[UploadToCPAN]|Dist::Zilla::Plugin::UploadToCPAN> | ||||||||||||
| 189 | |||||||||||||
| 190 | =item L<[MetaMergeFile]|Dist::Zilla::Plugin::MetaMergeFile> | ||||||||||||
| 191 | |||||||||||||
| 192 | =item L<[PrereqsFile]|Dist::Zilla::Plugin::PrereqsFile> | ||||||||||||
| 193 | |||||||||||||
| 194 | =item L<[MetaNoIndex]|Dist::Zilla::Plugin::MetaNoIndex> | ||||||||||||
| 195 | |||||||||||||
| 196 | directory = t | ||||||||||||
| 197 | directory = xt | ||||||||||||
| 198 | directory = inc | ||||||||||||
| 199 | directory = share | ||||||||||||
| 200 | directory = eg | ||||||||||||
| 201 | directory = examples | ||||||||||||
| 202 | |||||||||||||
| 203 | =item L<[MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package> | ||||||||||||
| 204 | |||||||||||||
| 205 | inherit_version = 0 | ||||||||||||
| 206 | |||||||||||||
| 207 | =item L<[ShareDir]|Dist::Zilla::Plugin::ShareDir> | ||||||||||||
| 208 | |||||||||||||
| 209 | =item L<[ExecDir]|Dist::Zilla::Plugin::ExecDir> | ||||||||||||
| 210 | |||||||||||||
| 211 | =back | ||||||||||||
| 212 | |||||||||||||
| 213 | Revision 6 has no specific differences from Revision 5 beyond the changes in | ||||||||||||
| 214 | L<Revision 6 in [@Starter]|Dist::Zilla::PluginBundle::Starter/"Revision 6">. | ||||||||||||
| 215 | |||||||||||||
| 216 | =head2 Revision 5 | ||||||||||||
| 217 | |||||||||||||
| 218 | Revision 5 has no specific differences from Revision 4 beyond the changes in | ||||||||||||
| 219 | L<Revision 5 in [@Starter]|Dist::Zilla::PluginBundle::Starter/"Revision 5">. | ||||||||||||
| 220 | |||||||||||||
| 221 | =head2 Revision 4 | ||||||||||||
| 222 | |||||||||||||
| 223 | Revision 4 has no specific differences from Revision 3 beyond the changes in | ||||||||||||
| 224 | L<Revision 4 in [@Starter]|Dist::Zilla::PluginBundle::Starter/"Revision 4">. | ||||||||||||
| 225 | |||||||||||||
| 226 | =head2 Revision 3 | ||||||||||||
| 227 | |||||||||||||
| 228 | Revision 3 is the default if no revision is specified, and differs from | ||||||||||||
| 229 | L<Revision 3 in [@Starter]|Dist::Zilla::PluginBundle::Starter/"Revision 3"> as | ||||||||||||
| 230 | follows: | ||||||||||||
| 231 | |||||||||||||
| 232 | =over 2 | ||||||||||||
| 233 | |||||||||||||
| 234 | =item * | ||||||||||||
| 235 | |||||||||||||
| 236 | Uses L<[Git::GatherDir]|Dist::Zilla::Plugin::Git::GatherDir> | ||||||||||||
| 237 | instead of L<[GatherDir]|Dist::Zilla::Plugin::GatherDir>. | ||||||||||||
| 238 | |||||||||||||
| 239 | =item * | ||||||||||||
| 240 | |||||||||||||
| 241 | Includes the following additional plugins: | ||||||||||||
| 242 | L<[Git::Check]|Dist::Zilla::Plugin::Git::Check>, | ||||||||||||
| 243 | L<[Git::Commit]|Dist::Zilla::Plugin::Git::Commit>, | ||||||||||||
| 244 | L<[Git::Tag]|Dist::Zilla::Plugin::Git::Tag>, | ||||||||||||
| 245 | L<[Git::Push]|Dist::Zilla::Plugin::Git::Push>. | ||||||||||||
| 246 | |||||||||||||
| 247 | =back | ||||||||||||
| 248 | |||||||||||||
| 249 | =head1 BUGS | ||||||||||||
| 250 | |||||||||||||
| 251 | Report any issues on the public bugtracker. | ||||||||||||
| 252 | |||||||||||||
| 253 | =head1 AUTHOR | ||||||||||||
| 254 | |||||||||||||
| 255 | Dan Book <dbook@cpan.org> | ||||||||||||
| 256 | |||||||||||||
| 257 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 258 | |||||||||||||
| 259 | This software is Copyright (c) 2018 by Dan Book. | ||||||||||||
| 260 | |||||||||||||
| 261 | This is free software, licensed under: | ||||||||||||
| 262 | |||||||||||||
| 263 | The Artistic License 2.0 (GPL Compatible) | ||||||||||||
| 264 | |||||||||||||
| 265 | =head1 SEE ALSO | ||||||||||||
| 266 | |||||||||||||
| 267 | L<Dist::Zilla>, L<Dist::Zilla::PluginBundle::Starter>, L<Dist::Milla>, | ||||||||||||
| 268 | L<Dist::Zilla::MintingProfile::Starter::Git> | ||||||||||||