| 1 | package Test::Smoke::App::ConfigSmoke::Files; | ||
| 2 | use warnings; | ||
| 3 | use strict; | ||
| 4 | |||
| 5 | our $VERSION = '0.002'; | ||
| 6 | |||
| 7 | use Exporter 'import'; | ||
| 8 | our @EXPORT = qw/ config_files /; | ||
| 9 | |||
| 10 | use Cwd; | ||
| 11 | use File::Spec; | ||
| 12 | use Test::Smoke::App::Options; | ||
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Test::Smoke::App::ConfigSmoke::Files - Mixin for L<Test::Smoke::App::ConfigSmoke> | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | These methods will be added to the L<Test::Smoke::App::ConfigSmoke> class. | ||
| 21 | |||
| 22 | =head2 config_files | ||
| 23 | |||
| 24 | Configure options C<outfile>, C<rptfile>, C<jsnfile>, C<lfile>, C<adir> and C<qfile>. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | sub config_files { | ||
| 29 | my $self = shift; | ||
| 30 | |||
| 31 | print "\n-- Various files/directories section --\n"; | ||
| 32 | |||
| 33 | # just set defaults | ||
| 34 | for my $option (qw/ outfile rptfile jsnfile /) { | ||
| 35 | my $opt = Test::Smoke::App::Options->$option; | ||
| 36 | $self->current_values->{$option} = $opt->default; | ||
| 37 | } | ||
| 38 | $self->current_values->{lfile} = File::Spec->rel2abs($self->prefix . ".log", getcwd()); | ||
| 39 | |||
| 40 | $self->handle_option(Test::Smoke::App::Options->adir); | ||
| 41 | |||
| 42 | if ($self->current_values->{adir} && $self->current_values->{smokedb_url}) { | ||
| 43 | print "\nI see you post your reports to the Perl5 CoreSmokeDB\n"; | ||
| 44 | print "and archive previous reports...\n"; | ||
| 45 | my $qfile_option = Test::Smoke::App::Options->qfile; | ||
| 46 | my $qdft = $self->default_for_option($qfile_option); | ||
| 47 | if (!$qdft && !length($qdft)) { | ||
| 48 | $qfile_option->configdft(sub { $self->prefix . ".qfile" }); | ||
| 49 | } | ||
| 50 | $self->handle_option($qfile_option); | ||
| 51 | } | ||
| 52 | |||
| 53 | $self->current_values->{delay_report} = $^O eq 'VMS' ? 1 : 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | 1; | ||
| 57 | |||
| 58 | =head1 COPYRIGHT | ||
| 59 | |||
| 60 | (c) 2020, All rights reserved. | ||
| 61 | |||
| 62 | * Abe Timmerman <abeltje@cpan.org> | ||
| 63 | |||
| 64 | This library is free software; you can redistribute it and/or modify | ||
| 65 | it under the same terms as Perl itself. | ||
| 66 | |||
| 67 | See: | ||
| 68 | |||
| 69 | =over 4 | ||
| 70 | |||
| 71 | =item * L<http://www.perl.com/perl/misc/Artistic.html> | ||
| 72 | |||
| 73 | =item * L<http://www.gnu.org/copyleft/gpl.html> | ||
| 74 | |||
| 75 | =back | ||
| 76 | |||
| 77 | This program is distributed in the hope that it will be useful, | ||
| 78 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 79 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 80 | |||
| 81 | =cut | ||
| 82 |