File Coverage

lib/Module/Provision/Config.pm
Criterion Covered Total %
statement 15 29 51.7
branch 0 4 0.0
condition 0 5 0.0
subroutine 5 15 33.3
pod n/a
total 20 53 37.7


line stmt bran cond sub pod time code
1             package Module::Provision::Config;
2              
3 1     1   436 use namespace::autoclean;
  1         1  
  1         4  
4              
5 1     1   49 use Class::Usul::Constants qw( NUL TRUE );
  1         1  
  1         6  
6 1         5 use Class::Usul::Functions qw( fullname loginid logname untaint_cmdline
7 1     1   380 untaint_identifier );
  1         2  
8 1         5 use File::DataClass::Types qw( ArrayRef HashRef NonEmptySimpleStr
9 1     1   1116 Path SimpleStr Undef );
  1         2  
10 1     1   676 use Moo;
  1         1  
  1         4  
11              
12             extends qw(Class::Usul::Config::Programs);
13              
14             # Object attributes (public)
15             has 'author' => is => 'lazy', isa => NonEmptySimpleStr,
16             builder => sub {
17 0   0 0     my $author = untaint_cmdline $ENV{AUTHOR} || fullname || logname;
18 0           $author =~ s{ [\'] }{\'}gmx; return $author };
  0            
19              
20             has 'author_email' => is => 'lazy', isa => NonEmptySimpleStr,
21             builder => sub {
22 0   0 0     my $email = untaint_cmdline $ENV{EMAIL} || 'dave@example.com';
23 0           $email =~ s{ [\'] }{\'}gmx; return $email };
  0            
24              
25             has 'author_id' => is => 'lazy', isa => NonEmptySimpleStr,
26 0     0     builder => sub { loginid };
27              
28             has 'base' => is => 'lazy', isa => Path, coerce => TRUE,
29 0     0     builder => sub { $_[ 0 ]->my_home };
30              
31             has 'builder' => is => 'lazy', isa => NonEmptySimpleStr,
32             default => 'MB';
33              
34             has 'coverage_server' => is => 'ro', isa => NonEmptySimpleStr,
35             default => 'http://localhost:5000/coverage';
36              
37             has 'default_branches' => is => 'lazy', isa => HashRef,
38 0     0     builder => sub { { git => 'master', svn => 'trunk' } };
39              
40             has 'delete_files_uri' => is => 'lazy', isa => NonEmptySimpleStr,
41             builder => sub { untaint_cmdline $ENV{CPAN_DELETE_FILES_URI}
42 0 0   0     || 'https://pause.perl.org/pause/authenquery' };
43              
44             has 'editor' => is => 'lazy', isa => NonEmptySimpleStr,
45 0 0   0     builder => sub { untaint_identifier $ENV{EDITOR} || 'emacs' };
46              
47             has 'home_page' => is => 'lazy', isa => NonEmptySimpleStr,
48             default => 'http://example.com';
49              
50             has 'hooks' => is => 'lazy', isa => ArrayRef[NonEmptySimpleStr],
51 0     0     builder => sub { [ 'commit-msg', 'pre-commit' ] };
52              
53             has 'license' => is => 'lazy', isa => NonEmptySimpleStr,
54             default => 'perl';
55              
56             has 'localdir' => is => 'ro', isa => NonEmptySimpleStr,
57             default => 'local';
58              
59             has 'min_perl_ver' => is => 'lazy', isa => NonEmptySimpleStr,
60             default => '5.010001';
61              
62             has 'module_abstract' => is => 'lazy', isa => NonEmptySimpleStr,
63             default => 'One-line description of the modules purpose';
64              
65             has 'pub_repo_prefix' => is => 'ro', isa => SimpleStr, default => 'p5-';
66              
67             has 'remote_test_id' => is => 'ro', isa => NonEmptySimpleStr,
68             default => 'test@testhost';
69              
70             has 'remote_script' => is => 'ro', isa => NonEmptySimpleStr,
71             default => 'install_perl_module';
72              
73             has 'repository' => is => 'lazy', isa => NonEmptySimpleStr,
74             default => 'repository';
75              
76             has 'seed_file' => is => 'lazy', isa => Path | Undef, coerce => TRUE,
77 0     0     builder => sub { [ qw( ~ .ssh pause.key ) ] };
78              
79             has 'signing_key' => is => 'lazy', isa => SimpleStr,
80             default => NUL;
81              
82             has 'tag_message' => is => 'lazy', isa => NonEmptySimpleStr,
83             default => 'Releasing';
84              
85             has 'template_index' => is => 'lazy', isa => NonEmptySimpleStr,
86             default => 'index.json';
87              
88             has 'test_env_vars' => is => 'lazy', isa => ArrayRef,
89             documentation => 'Set these environment vars to true when testing',
90             builder => sub {
91 0     0     [ qw( AUTHOR_TESTING TEST_MEMORY TEST_SPELLING ) ] };
92              
93             has 'vcs' => is => 'lazy', isa => NonEmptySimpleStr,
94             default => 'git';
95              
96             1;
97              
98             __END__
99              
100             =pod
101              
102             =encoding utf-8
103              
104             =head1 Name
105              
106             Module::Provision::Config - Attributes set from the config file
107              
108             =head1 Synopsis
109              
110             use Moo;
111              
112             extends 'Class::Usul::Programs';
113              
114             has '+config_class' => default => sub { 'Module::Provision::Config' };
115              
116             =head1 Description
117              
118             Defines attributes which can be set from the config file
119              
120             =head1 Configuration and Environment
121              
122             Defines the following attributes;
123              
124             =over 3
125              
126             =item C<author>
127              
128             A non empty simple string which defaults to the value of the environment
129             variable C<AUTHOR>. If the environment variable is unset
130             defaults to C<fullname> and then C<logname>
131              
132             =item C<author_email>
133              
134             A non empty simple string which defaults to the value of the environment
135             variable C<EMAIL>. If the environment variable is unset
136             defaults to C<dave@example.com>
137              
138             =item C<author_id>
139              
140             A non empty simple string which defaults to the author's login identity
141              
142             =item C<base>
143              
144             A path object which defaults to the authors home directory. The default
145             directory in which to create new distributions
146              
147             =item C<builder>
148              
149             A non empty simple string default to C<MB>. Selects the build system to
150             use when creating new distributions
151              
152             =item C<coverage_server>
153              
154             The HTTP address of the coverage server. Used by the badge markup feature
155              
156             =item C<default_branches>
157              
158             A hash reference. The default branch names for the C<git> and C<svn> VCSs
159             which are C<master> and C<trunk> respectively
160              
161             =item C<delete_files_uri>
162              
163             A non empty simple string which defaults to the value of the environment
164             variable C<CPAN_DELETE_FILES_URI>. If the environment variable is unset
165             defaults to C<https://pause.perl.org/pause/authenquery>. The URI of the
166             PAUSE service
167              
168             =item C<editor>
169              
170             A non empty simple string which defaults to the value of the environment
171             variable C<EDITOR>. If the environment variable is unset defaults to
172             C<emacs>. Which editor to invoke which C<edit_project> is called
173              
174             =item C<home_page>
175              
176             A non empty simple string which default to C<http://example.com>. Override
177             this in the configuration file to set the meta data used when creating a
178             distribution
179              
180             =item C<hooks>
181              
182             An array reference of non empty simple strings which defaults to F<commit-msg>
183             and F<pre-commit>. This list of Git hooks is operated on by the C<add_hooks>
184             method
185              
186             =item C<license>
187              
188             A non empty simple string which defaults to C<perl>. The default license for
189             new distributions
190              
191             =item C<localdir>
192              
193             A non empty simple string which defaults to F<local>. The directory into which
194             L<local::lib> should be installed
195              
196             =item C<min_perl_ver>
197              
198             Non empty simple string that is used as the default in the meta data of a
199             newly minted distribution
200              
201             =item C<module_abstract>
202              
203             A non empty simple string which is used as the default abstract for newly
204             minted modules
205              
206             =item C<pub_repo_prefix>
207              
208             A simple string which default to C<p5->. Prepended to the lower cased
209             distribution name it forms the name of the public repository
210              
211             =item C<remote_test_id>
212              
213             A non empty simple string that defaults to C<test@testhost>. The identity
214             and host used to perform test installations
215              
216             =item C<remote_script>
217              
218             A non empty simple string that defaults to C<install_perl_module>. The command
219             to execute on the test installation server
220              
221             =item C<repository>
222              
223             A non empty simple string which defaults to C<repository>. Name of the
224             L</appbase> subdirectory expected to contain a Git repository
225              
226             =item C<seed_file>
227              
228             File object reference or undefined. This optionally points to the file
229             containing the key to decrypt the author's PAUSE account password which
230             is stored in the F<~/.pause> file
231              
232             =item C<signing_key>
233              
234             Simple string that defaults to C<NUL>. If non null then this string is used
235             as a fingerprint to find the author distribution signing key
236              
237             =item C<tag_message>
238              
239             Non empty simple string defaults to C<Releasing>. This is the default message
240             to apply to the commit which creates a tagged release
241              
242             =item C<template_index>
243              
244             Name of the file containing the index of templates. Defaults to F<index.json>
245              
246             =item C<test_env_vars>
247              
248             Array reference. Set these environment vars to true when testing. Defaults
249             to; C<AUTHOR_TESTING TEST_MEMORY>, and C<TEST_SPELLING>
250              
251             =item C<vcs>
252              
253             A non empty simple string that defaults to C<git>. The default version control
254             system
255              
256             =back
257              
258             =head1 Subroutines/Methods
259              
260             None
261              
262             =head1 Diagnostics
263              
264             None
265              
266             =head1 Dependencies
267              
268             =over 3
269              
270             =item L<Class::Usul>
271              
272             =item L<File::DataClass>
273              
274             =item L<User::pwent>
275              
276             =back
277              
278             =head1 Incompatibilities
279              
280             There are no known incompatibilities in this module
281              
282             =head1 Bugs and Limitations
283              
284             There are no known bugs in this module.
285             Please report problems to the address below.
286             Patches are welcome
287              
288             =head1 Acknowledgements
289              
290             Larry Wall - For the Perl programming language
291              
292             =head1 Author
293              
294             Peter Flanigan, C<< <pjfl@cpan.org> >>
295              
296             =head1 License and Copyright
297              
298             Copyright (c) 2016 Peter Flanigan. All rights reserved
299              
300             This program is free software; you can redistribute it and/or modify it
301             under the same terms as Perl itself. See L<perlartistic>
302              
303             This program is distributed in the hope that it will be useful,
304             but WITHOUT WARRANTY; without even the implied warranty of
305             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
306              
307             =cut
308              
309             # Local Variables:
310             # mode: perl
311             # tab-width: 3
312             # End: