【问题标题】:prevent Dist::Zilla from inserting the copyright year?防止 Dist::Zilla 插入版权年份?
【发布时间】:2012-10-12 20:10:35
【问题描述】:

默认情况下,如果Dist::Zilla 找不到版权年份,它将使用当前年份,因为它似乎不支持多个年份或年份范围,我认为当前年份最合适。但是,每当我运行dzil new Module 时,它会自动将版权年份插入我的dist.ini。有没有办法阻止 Dist::Zilla 这样做?

【问题讨论】:

    标签: perl dist-zilla


    【解决方案1】:

    从您的铸币配置文件中删除 [DistINI],并改用带有 GatherDir::Template 的模板 dist.ini 文件。这更加灵活。

    例如,这是我的skel/dist.ini

    ;                                                       -*-conf-windows-*-{{
        $license = ref $dist->license;
        if ( $license =~ /^Software::License::(.+)$/ ) {
            $license = $1;
        } else {
            $license = "=$license";
        }
    
        $authors = join( "\n", map { "author  = $_" } @{$dist->authors} );
        '';
    }}
    name    = {{$dist->name}}
    {{$authors}}
    license = {{$license}}
    copyright_holder = {{$dist->copyright_holder}}
    
    [@Author::CJM / CJM]
    
    [AutoPrereqs]
    skip = ^(?:lib|strict|utf8|warnings)$
    

    然后我的profile.ini 包括:

    [GatherDir::Template]
    root = skel
    include_dotfiles = 1 ; want .gitignore
    

    【讨论】:

    • 没错!这也是我会做的。
    • 看来我也做了模板(在家里失传已久的铸币厂)......除了我没有为时髦的逻辑而烦恼,我只是复制了我的许可证、版权所有者等。不这样做似乎没有任何好处。
    • @rjbs 为什么不能只是让[DistINI] 插件更可配置地包括哪些部分,所以像作者加入这样的逻辑,许可证选择不必在模板中。另外,既然copyright_year 在配置中完全是可选的,为什么还要在[DistINI] 插件中包含copyright_year?似乎是一个糟糕的默认值。
    猜你喜欢
    • 1970-01-01
    • 2018-06-18
    • 2019-10-03
    • 2019-09-22
    • 2016-03-23
    • 1970-01-01
    • 2013-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多