使用 Dist::Zilla::Plugin::Gatherdir 添加一个未跟踪的文件

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

我正在使用 Dist::Zilla 构建 Perl 模块。我已将标准 GatherDir 替换为 Git::GatherDir。但是我的主模块 lib/XY.pm 是生成的,因此不受版本控制。如何添加?

您能否在 dist.ini 中的 运行 Git::GatherDir 之后尝试 运行 GatherDir 使用特定的 root 属性。例如

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

你说“我的主模块 lib/XY.pm 已生成”,但不是如何生成的。这可能是找到最佳答案的重要组成部分。如果该文件是由 Dist-Zilla 的部分操作生成的,您希望该操作也能收集该文件。

不过,我们假设您不是,并且某个其他程序将此文件写入文件系统,但没有将其放入 git。现在您已经将 ./lib 中的一堆内容添加到 dist,但您还想添加一个不在 git 中的文件。你想使用 GatherFile 插件。专门为dist添加一个文件而存在的

[GatherFile]
filename = lib/XY.pm