Add one untracked file with Dist::Zilla::Plugin::Gatherdir

48 Views Asked by At

I am using Dist::Zilla to build a Perl module. I have replaced the standard GatherDir with Git::GatherDir. But my main module lib/XY.pm is generated and therefore not under version control. How can I add it?

2

There are 2 best solutions below

0
rjbs On BEST ANSWER

You say "my main module lib/XY.pm is generated", but not how. That could be a significant component in finding the best answer. If the file was being generated by part of Dist-Zilla's operation, you'd want that action to also gather the file.

Let's assume that you're not, though, and that some other program writes this file to the filesystem, but doesn't put it in git. Now you've added a bunch of things from ./lib to the dist, but you want to add one more file that isn't in git. You want to use the GatherFile plugin. It exists specifically to add one file to the dist.

[GatherFile]
filename = lib/XY.pm
0
Håkon Hægland On

Can you try running GatherDir with specific root attribute after running Git::GatherDir in dist.ini. E.g.

# ...
[Git::GatherDir]
[GatherDir]
root=lib
# ...