| 1 | package Module::Build::TAPArchive; | ||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use base 'Module::Build'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use TAP::Harness::Archive; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 2 | our $VERSION = '0.04'; | |||||||||||
| 8 | |||||||||||||
| 9 | 2 | __PACKAGE__->add_property(archive_file => 'test_archive.tar.gz'); | |||||||||||
| 10 | |||||||||||||
| 11 | =head1 NAME | ||||||||||||
| 12 | |||||||||||||
| 13 | Module::Build::TAPArchive - Extra build targets for creating TAP archives | ||||||||||||
| 14 | |||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||
| 16 | |||||||||||||
| 17 | Easily add support for extra build targets that create TAP archives of the tests. | ||||||||||||
| 18 | |||||||||||||
| 19 | In your Build.PL | ||||||||||||
| 20 | |||||||||||||
| 21 | use Module::Builder::TAPArchive; | ||||||||||||
| 22 | my $builder = Module::Builder::TAPArchive->new( | ||||||||||||
| 23 | ... | ||||||||||||
| 24 | ); | ||||||||||||
| 25 | |||||||||||||
| 26 | Now you get these build targets | ||||||||||||
| 27 | |||||||||||||
| 28 | ]$ perl Build.PL | ||||||||||||
| 29 | ]$ ./Build test_archive | ||||||||||||
| 30 | |||||||||||||
| 31 | =head1 NEW TARGETS | ||||||||||||
| 32 | |||||||||||||
| 33 | The following build targets are provided: | ||||||||||||
| 34 | |||||||||||||
| 35 | =head2 test_archive | ||||||||||||
| 36 | |||||||||||||
| 37 | Create a TAP archive to the test run. This archive is placed at | ||||||||||||
| 38 | F<test_archive.tar.gz> in the current directory by default. You can override this by | ||||||||||||
| 39 | specifying the C<--archive_file> parameter. | ||||||||||||
| 40 | |||||||||||||
| 41 | ./Build test_archive --archive_file mytests.tar.gz | ||||||||||||
| 42 | |||||||||||||
| 43 | =cut | ||||||||||||
| 44 | |||||||||||||
| 45 | 1 | ▶ | sub ACTION_test_archive { | ||||||||||
|
Subroutine
ACTION_test_archive: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 46 | 1 | my $self = shift; | |||||||||||
| 47 | 1 | $self->{properties}{use_tap_harness} = 1; | |||||||||||
| 48 | 1 | ▶ | my $archive_file = $self->{properties}{archive_file} || 'test_archive.tar.gz'; | ||||||||||
|
Condition50%1/2
$self->{'properties'}{'archive_file'} || 'test_archive.tar.gz'
MC/DC0%0/1
$self->{'properties'}{'archive_file'} || 'test_archive.tar.gz'
$self->{'properties'}{'archive_file'}
Truth table50%1/2
A
A= $self->{'properties'}{'archive_file'}
| |||||||||||||
| 49 | |||||||||||||
| 50 | # make Module::Build use our archive method instead of run_tap_harness | ||||||||||||
| 51 | 1 | ▶ | local *Module::Build::run_tap_harness = sub { | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 52 | 1 | my ($self, $tests) = @_; | |||||||||||
| 53 | TAP::Harness::Archive->new( | ||||||||||||
| 54 | { | ||||||||||||
| 55 | lib => \@INC, | ||||||||||||
| 56 | verbosity => $self->{properties}{verbose}, | ||||||||||||
| 57 | switches => [$self->harness_switches], | ||||||||||||
| 58 | archive => $archive_file, | ||||||||||||
| 59 | 1 | %{$self->tap_harness_args}, | |||||||||||
| 60 | } | ||||||||||||
| 61 | )->runtests(@$tests); | ||||||||||||
| 62 | 1 | }; | |||||||||||
| 63 | 1 | $self->add_to_cleanup($archive_file); | |||||||||||
| 64 | 1 | $self->generic_test(type => 'default'); | |||||||||||
| 65 | } | ||||||||||||
| 66 | |||||||||||||
| 67 | |||||||||||||
| 68 | =head1 AUTHOR | ||||||||||||
| 69 | |||||||||||||
| 70 | Michael Peters, C<< <mpeters at plusthree.com> >> | ||||||||||||
| 71 | |||||||||||||
| 72 | =head1 BUGS | ||||||||||||
| 73 | |||||||||||||
| 74 | Please report any bugs or feature requests to C<bug-module-build-taparchive at rt.cpan.org>, or through | ||||||||||||
| 75 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Build-TAPArchive>. I will be notified, and then you'll | ||||||||||||
| 76 | automatically be notified of progress on your bug as I make changes. | ||||||||||||
| 77 | |||||||||||||
| 78 | =head1 SUPPORT | ||||||||||||
| 79 | |||||||||||||
| 80 | You can find documentation for this module with the perldoc command. | ||||||||||||
| 81 | |||||||||||||
| 82 | perldoc Module::Build::TAPArchive | ||||||||||||
| 83 | |||||||||||||
| 84 | You can also look for information at: | ||||||||||||
| 85 | |||||||||||||
| 86 | =over 4 | ||||||||||||
| 87 | |||||||||||||
| 88 | =item * RT: CPAN's request tracker | ||||||||||||
| 89 | |||||||||||||
| 90 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Build-TAPArchive> | ||||||||||||
| 91 | |||||||||||||
| 92 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||
| 93 | |||||||||||||
| 94 | L<http://annocpan.org/dist/Module-Build-TAPArchive> | ||||||||||||
| 95 | |||||||||||||
| 96 | =item * CPAN Ratings | ||||||||||||
| 97 | |||||||||||||
| 98 | L<http://cpanratings.perl.org/d/Module-Build-TAPArchive> | ||||||||||||
| 99 | |||||||||||||
| 100 | =item * Search CPAN | ||||||||||||
| 101 | |||||||||||||
| 102 | L<http://search.cpan.org/dist/Module-Build-TAPArchive/> | ||||||||||||
| 103 | |||||||||||||
| 104 | =back | ||||||||||||
| 105 | |||||||||||||
| 106 | =head1 COPYRIGHT & LICENSE | ||||||||||||
| 107 | |||||||||||||
| 108 | Copyright 2009 Michael Peters, all rights reserved. | ||||||||||||
| 109 | |||||||||||||
| 110 | This program is free software; you can redistribute it and/or modify it | ||||||||||||
| 111 | under the same terms as Perl itself. | ||||||||||||
| 112 | |||||||||||||
| 113 | =cut | ||||||||||||
| 114 | |||||||||||||
| 115 | 2 | 1; | |||||||||||