Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

[SOLVED] Dist::Zilla Getting rid of {{$NEXT}} at top of Changes file on GitHub

by nysus (Vicar)
on Dec 17, 2017 at 21:31 UTC ( #1205749=perlquestion: print w/replies, xml ) Need Help??

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

Replies are listed 'Best First'.
Re: Dist::Zilla Getting rid of {{$NEXT}} at top of Changes file on GitHub
by 1nickt (Abbot) on Dec 17, 2017 at 23:51 UTC

    No, that would be silly because the version of CHANGES that you store in your source code repository is a template used to build the actual CHANGES file that is included in each release of your software distribution, and the {{NEXT}} token is used to generate the file and prepend the date and version info to the text you add before building.

    (Terminology emphasized for distinction.)


    The way forward always starts with a minimal test.

      Right, I get that. But I'm wondering if there might be a plugin to clean it up before it is committed. I'm thinking of taking a stab at it.

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

        Right, I get that. But I'm wondering if there might be a plugin to clean it up before it is committed.

        I don't think you do get it :-) If you remove the token, you're not "cleaning up" the template, you're breaking it!


        The way forward always starts with a minimal test.

        I had to update the solution in the OP a bit. The solution got mangled while editing. And it reminded me that I had a question. I'm forced to use [Run::AfterRelease / MyAppAfter] for the second run command. It's not clear at all to me what the / MyAppAfter bit does.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1205749]
Approved by beech
Front-paged by beech
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2019-11-16 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (85 votes). Check out past polls.

    Notices?