File Coverage

blib/lib/Dist/Zilla/PluginBundle/Author/TABULO/Config.pm
Criterion Covered Total %
statement 31 33 93.9
branch 2 6 33.3
condition n/a
subroutine 11 12 91.6
pod 0 3 0.0
total 44 54 81.4


line stmt bran cond sub pod time code
1 21     21   5833735 use 5.014; # because we use the 'non-destructive substitution' feature (s///r)
  21         105  
2 21     21   174 use strict;
  21         61  
  21         518  
3 21     21   162 use warnings;
  21         59  
  21         1435  
4             package Dist::Zilla::PluginBundle::Author::TABULO::Config;
5             # vim: set ts=2 sts=2 sw=2 tw=115 et :
6             # ABSTRACT: Configuration module for <Dist::Zilla::PluginBundle::Author::TABULO>
7             # KEYWORDS: author bundle distribution tool
8              
9             our $VERSION = '0.198';
10             # AUTHORITY
11              
12 21     21   9807 use Git::Wrapper;
  21         513194  
  21         851  
13 21     21   302 use List::Util 1.45 qw(pairs);
  21         432  
  21         1619  
14              
15 21     21   9472 use Banal::Util::Mini qw(hash_access);
  21         274959  
  21         220  
16 21     21   28278 use Banal::Dist::Util::Git qw(detect_settings_from_git);
  21         65511  
  21         161  
17              
18             #use Memoize;
19 21     21   4681 use Exporter::Shiny qw(configuration detect_settings);
  21         59  
  21         149  
20 21     21   1228 use namespace::autoclean;
  21         64  
  21         134  
21              
22             # PLUGIN-bundle info
23             my $bundle_name = (__PACKAGE__ =~ /^Dist::Zilla::PluginBundle::(.*)::Config$/) ? $1 : undef;
24             my %bundle = (
25             name => $bundle_name,
26             ini_section_name => '@' . $bundle_name,
27             ini_section => '[' . '@' . $bundle_name . ']',
28             pkg_name => 'Dist::Zilla::PluginBundle::' . $bundle_name,
29             );
30             $bundle{dist_name} ||= $bundle{pkg_name} =~ s/::/-/gr;
31             $bundle{msg_pfx} ||= $bundle{ini_section} . ' ', # prefix for error message output (warnings, etc)
32              
33             # SETTINGS, DEFAULTS, ...
34             my %config = (
35              
36             # Info about this plugin-bundle
37             bundle => \%bundle,
38              
39             # These are the last resort defaults,
40             # which would be beaten by any known preferences of the 'authority' for the distribution at hand,
41             # which would in turn be beaten by the settings in dist.ini (payload)
42             defaults => {
43             airplane => 0,
44             authority => 'cpan:TABULO',
45             changes_version_columns => 12, # The version string gets formatted with : (this value - 2)
46             commit_files_copied_from_release => 1,
47             commit_file_after_release_implicit => [ qw(README.md README.pod Changes) ],
48             copy_file_from_release_implicit => [ qw(LICENCE LICENSE CONTRIBUTING ppport.h INSTALL) ],
49             fake_release => 0,
50             installer => [ 'MakeMaker::Fallback', 'ModuleBuildTiny' ],
51             server => 'github',
52             spelling => 'US',
53             static_install_mode => 'auto',
54             stopword => [ qw(irc IRC) ],
55             surgical_podweaver => 0,
56              
57             # Updating .ackrc is no longer needed after ack v2.16+ (which now supports the 'match:' operator for directories)
58             update_ackrc_after_build => 0,
59              
60             # Ufff... But just conforming to the existing the behavior of ETHER's bundle (and adding some more OS user names)...
61             verify_phases => ( ($ENV{USER} // '') =~ /^ether|tabulo|ayhan$/i ) ? 1 : 0,
62              
63              
64             # default settings for POD Weaver (applies also to 'SurgicalPodWeaver' in the absence of specific settings for that)
65             'PodWeaver.replacer' => 'replace_with_comment',
66             'PodWeaver.post_code_replacer' => 'replace_with_nothing',
67              
68             'MetaNoIndex.directory' => [ qw(t xt), qw(inc local perl5 fatlib examples share corpus demo) ],
69             'Test::ReportPrereqs.include' => [ qw(Dist::CheckConflicts Pod::Elemental::PerlMunger) ],
70              
71              
72              
73             # files that might be in the repository that should never be gathered
74             never_gather_implicit => [ grep { -e } qw(
75             Makefile.PL ppport.h META.json META.yml cpanfile
76             README README.md README.mkdn README.pod
77             TODO CONTRIBUTING LICENCE LICENSE INSTALL
78             TODO.yml todo.yml todo.txt notes.txt notes.COMMIT.txt
79             .dzil.out
80             inc/ExtUtils/MakeMaker/Dist/Zilla/Develop.pm
81             )],
82              
83             # configs are applied when plugins match ->isa($key) or ->does($key)
84             extra_args => {
85             'Dist::Zilla::Plugin::MakeMaker' => { default_jobs => 9, 'eumm_version' => '0' },
86             'Dist::Zilla::Plugin::ModuleBuildTiny' => { default_jobs => 9, ':version' => '0.012', version_method => 'conservative', static => 'auto' },
87             'Dist::Zilla::Plugin::MakeMaker::Fallback' => { default_jobs => 9, ':version' => '0.012' },
88             # default_jobs is no-op until Dist::Zilla 5.014
89             'Dist::Zilla::Role::TestRunner' => { default_jobs => 9 },
90             'Dist::Zilla::Plugin::ModuleBuild' => { mb_version => '0.28' },
91             'Dist::Zilla::Plugin::ModuleBuildTiny::Fallback' => { default_jobs => 9, static => 'auto',
92             ':version' => '0.018', version_method => 'conservative', },
93             },
94              
95             # Update '.ackrc' file.
96             'update_ackrc.cmd' => <<'__EOD__' =~ tr/\n/ /r, # replace newlines with spaces, just in case
97             bash -c "test -e .ackrc && grep -q -- '--ignore-dir=.latest' .ackrc || echo '--ignore-dir=.latest' >> .ackrc;
98             if [[ `dirname '%d'` != .build ]]; then
99             test -e .ackrc && grep -q -- '--ignore-dir=%d' .ackrc || echo '--ignore-dir=%d' >> .ackrc;
100             fi"
101             __EOD__
102              
103              
104             'update_latest_links.eval' => <<'__EOD__'
105             if ('%d' =~ /^%n-[.[:xdigit:]]+$/) { unlink '.latest'; symlink '%d', '.latest'; }
106             __EOD__
107              
108              
109             },
110              
111              
112              
113             known_authors => {
114             map {; ( 'cpan:'. $_->key => $_->value ) }
115             pairs (
116             'TABULO' => { prefs => {
117             spelling => 'US', keen_on_static_install => 0,
118             surgical_podweaver => 1,
119             'Authority.do_munging' => 1, 'Authority.locate_comment' => 1,
120              
121             # options for [AutoMetaResources]
122             server_amr_opts_bitbucket => 'user:tabulo',
123             server_amr_opts_github => 'user:tabulon',
124              
125             max_target_perl => 5.014, # Commented out, because we don't want to force distros for something ike this.
126              
127             portability_options => 'test_dos_length = 0, test_one_dot = 0',
128              
129             }
130             },
131             'ETHER' => { prefs =>{ spelling => 'GB', keen_on_static_install => 1 }},
132             map { $_ => { prefs =>{ spelling => 'GB'} } } qw(
133             ABERGMAN AVAR BINGOS BOBTFISH CHANSEN CHOLET FLORA GETTY ILMARI
134             CHANSEN CHOLET FLORA GETTY ILMARI JAWNSY JQUELIN LEONT LLAP
135             MSTROUT NUFFIN PERIGRIN PHAYLON
136             ))
137             },
138              
139             );
140              
141              
142             # Method to retrieve configuration settings
143             # - Without any arguments, it will return the entire config hash (tree)
144             # - If given arguments, it return the item by 'diving' into the hash like so : $config{k0}{k1}{k2}
145             # except that we try real hard to avoid auto-vivification
146             # (hence the function call to the utility routine 'hash_access')
147 236     236 0 1743 sub configuration { hash_access( \%config, @_) }
148              
149              
150 0 0   0 0 0 sub pause_config { my $o = @_ % 2 ? shift : undef; Banal::Dist::Util::Pause::pause_config(@_) }
  0         0  
151              
152             # Detects settings that may serve as defaults in the current execution
153             # environment
154             #memoize qw(detect_settings);
155             sub detect_settings {
156 39 50   39 0 247 my $o = @_ % 2 ? shift : undef;
157 39         181 my %args = @_;
158 39         359 my %detected = detect_settings_from_git(dir => $args{dir}, %args);
159 39 50       531974 wantarray ? (%detected) : \%detected;
160             }
161              
162              
163             1;
164              
165             __END__
166              
167             =pod
168              
169             =encoding UTF-8
170              
171             =head1 NAME
172              
173             Dist::Zilla::PluginBundle::Author::TABULO::Config - Configuration module for <Dist::Zilla::PluginBundle::Author::TABULO>
174              
175             =head1 VERSION
176              
177             version 0.198
178              
179             =head1 SUPPORT
180              
181             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-PluginBundle-Author-TABULO>
182             (or L<bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org|mailto:bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org>).
183              
184             =head1 AUTHOR
185              
186             Tabulo <tabulo@cpan.org>
187              
188             =head1 COPYRIGHT AND LICENSE
189              
190             This software is copyright (c) 2018 by Tabulo.
191              
192             This is free software; you can redistribute it and/or modify it under
193             the same terms as the Perl 5 programming language system itself.
194              
195             =cut