http://www.perlmonks.org?node_id=1205749

nysus has asked for the wisdom of the Perl Monks concerning the following question:

I've been tinkering with the dist.ini file:

[Git::NextVersion] [PodVersion] [PkgVersion] [NextRelease] [ReadmeAnyFromPod] type = markdown location = root phase = release [Git::Check] [Git::Commit] allow_dirty = README.mkdn allow_dirty = Changes [Git::Tag] [Git::Push] [GatherDir] [PruneCruft] [ManifestSkip] [MetaYAML] [License] [Readme] [ExtraTests] [ExecDir] [ShareDir] [MakeMaker] [Manifest] [TestRelease] [FakeRelease]

I have it so that only the modules, a README.mkdn file, and a Changes files get uploaded to github. In the generated distro, the Changes file looks fine. But in the version that gets uploaded to GitHub from my repository's root, there is an unsightly {{$NEXT}} line in there. I'm wondering if there is an easy way to get rid of it using the tools available in Dist::Zilla.

Solution

The nifty Dist::Zilla::Plugin::Run came to the rescue. Here is how you do it:

[NextRelease] [Run::AfterRelease] run = cp Changes tmp && cp %n-%v/Changes . <snip> [Git::Commit] allow_dirty = README.mkdn allow_dirty = Changes [Git::Tag] [Git::Push] [Run::AfterRelease / MyAppAfter] run = cp tmp/Changes Changes

The [Run::AfterRelease] bit runs the command in the next line. The first run command has two commands. First it copies the Changes file with the {{$next}} code in it over to the tmp directory. Next, it gets overwritten by the "clean" version of the Changes file. The second run command simply moves the Changes file in the tmp directory back to the repository's root directory.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks