Dist::Zilla::Plugin::MetaResourcesFromGit

The CPAN META specification includes support for "resource" links to homepage, bug tracker, mail list, source code repository, and so on. These will appear on search.cpan.org if you ship a META.json with your distribution.

Dist::Zilla's MetaResources plugin allows you to set these links in the distribution config, but I wanted something a little more automagical. This can be done because I've set up my GitHub repositories with consistent naming and layout.

So my new plugin, Dist::Zilla::Plugin::MetaResourcesFromGit, is a drop-in replacement for the standard MetaResources plugin. It automatically generates four resource links based on the name of the distribution and the remote git repository settings. Simply use the plugin in your dist.ini file:

[MetaResourcesFromGit]

The default links are equivalent to:

homepage        = https://github.com/<account>/<repo>/wiki
bugtracker.web  = https://rt.cpan.org/Public/Dist/Display.html?Name=<dist-name>
repository.url  = git://github.com/<account>/<repo>.git
repository.web  = https://github.com/<account>/<repo>
repository.type = git

Any other resources provided to this Plugin are passed through to the MetaResources Plugin as-is. If you wish to override one of the above, some formatting codes are provided (described in the documentation) to assist. If you wish to suppress the appearance of one of the above resources, set an empty value.

If you want to know more about my Dist::Zilla and GitHub workflow, I discussed it in an earlier post on this blog. I wrote this plugin to assist me, and it's also shown how great the Moose-based Dist::Zilla architecture is for extending features.

The Plugin is GitHub centric at the moment, but I'd be happy to accept a patch to work with other cloud-based Git services (Gitorious, SourceForge, etc).

3 Comments

Shouldn’t that be Dist::Zilla::Plugin::MetaResourcesFromGitHub ? There are lots of other Git hosting services besides GitHub and some people use their own Git repos/servers.

Leave a comment

About Oliver Gorwits

user-pic Computer Networks is my business, so Perl is my glue.