Here I talked about creating a new catalyst project using a minting profile for Dist::Zilla. If you don’t know how to create a minting profile read that first. I’m sure once you’ve tried that you’ll agree that having a little bit more than the basics in a newly minted dist would be a good thing.

first we need to create our profile.ini correctly

1
2
3
[GatherDir::Template]
    root = repo
    include_dotfiles = 1

(note: if you’ve got [DistINI] plugin loaded you’ll probably want to remove it) Now you can put any file in the subdirectory repo of your profile (if you leave out include_dotfiles = 1 then anything beginning with a . won’t be included), and it can be a template using Text::Template. Dist::Zilla uses {{ }} for Text::Template Delimiters.

Let’s start with adding a .gitignore file (if you’re using git) we can create{profile}/repo/.gitignore

1
2
/{{$dist->name}}*
.build

the {{$dist->name}}* will exclude the directories and archives dzil creates on release and .build, will of course, ignore the .build dirctory.

Now for a more complex issue, creating a Changes file that has the the {{$NEXT}} variable in it to insert the date and such on build.

{{$dist->name}}
{{ '{{$NEXT}}' }}
    -

Obviously you can format your Changes file however you want.

Now we want to create a much more complicated dist.ini

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{{
    $username = 'xenoterracide';

    $license = ref $dist->license;
    if ( $license =~ /^Software::License::(.+)$/ ) {
        $license = $1;
    } else {
        $license = "=$license";
    }

    $authors .= $_ for @{$dist->authors};
    '';
}}name    = {{$dist->name}}
author  = {{$authors}}
license =  {{$license}}
version = 0.1.0
copyright_holder = {{$dist->copyright_holder}}

[MetaResources]
bugtracker.web  = http://github.com/{{$username}}}/{{$dist->name}}/issues
repository.web  = http://github.com/{{$username}}/{{$dist->name}}
repository.url  = git://github.com/{{$username}}/{{$dist->name}}.git
repository.type = git

[ReadmeFromPod]
[@Filter]
-bundle = @Basic
-remove = Readme

[AutoPrereq]

[SubmittingPatches]
[PkgVersion]
[PodWeaver]

[NextRelease]
    format = %-9v %{MMM dd yyyy}d

[CompileTests]
[CriticTests]
[DistManifestTests]
[EOLTests]
[ExtraTests]
[HasVersionTests]
[KwaliteeTests]
[MetaTests]
[MinimumVersionTests]
[PodCoverageTests]
[PodSyntaxTests]
[ReportVersions]
[UnusedVarsTests]

[PruneFiles]
filenames = dist.ini
filenames = weaver.ini

[@Git]
push_to = my
tag_format = %v

[Git::CommitBuild]

All of the stuff between the first set of {{ }} is boilerplate mostly taken from the DistINI plugin so that we can use our settings from our config.ini, I really wish there were some convenience accessors for this. I also wish we had an arbitrary stash we could use in config.ini so I wouldn’t have had to hardcode my username in this. I think it’s all fairly self explanatory beyond that. Of course you can set up your dist.ini anyway you want. Also if you use this format you have to have your module’s repo name on GitHub in camel case like it is on CPAN.