File Coverage

alienfile
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1 1     1   250937 use strict;
  1         4  
  1         48  
2 1     1   4 use warnings;
  1         2  
  1         34  
3 1     1   5 use alienfile;
  1         1  
  1         7  
4              
5 1     1   152 use Capture::Tiny qw(capture);
  1         3  
  1         73  
6 1     1   458 use File::Copy;
  1         2976  
  1         59  
7 1     1   6 use Path::Tiny;
  1         1  
  1         343  
8              
9             my %minimap2_programs = (
10             minimap2 => 'minimap2',
11             );
12             probe sub {
13             ## see if the minimap2 suite is installed
14             my ( $cmd, $stder ) = capture { system( 'minimap2', ) };
15             my $is_minimap2_installed_installed = $$stder =~ /minimap2/m;
16             print $is_minimap2_installed_installed
17             ? "The minimap2 suite is already installed in your system\n"
18             : "The minimap2 suite is not installed, so will install from source\n";
19             $is_minimap2_installed_installed ? 'system' : 'share';
20             };
21              
22             share {
23             plugin 'Download::GitHub' => (
24             github_user => 'lh3',
25             github_repo => 'minimap2',
26             );
27             plugin Extract => 'tar.gz';
28             build [
29             '%{make}',
30             ];
31              
32             after 'build' => sub {
33             my ($build) = @_;
34             my $install_root = Path::Tiny->new( $build->install_prop->{stage} );
35              
36             my $source_directory = path($build->install_prop->{extract});
37             my $binary_dest_directory = path( $install_root, 'bin' );
38             $binary_dest_directory->mkdir;
39             foreach my $key ( keys %minimap2_programs ) {
40             path( $source_directory, $minimap2_programs{$key} )->move(
41             path( $binary_dest_directory, $minimap2_programs{$key} ));
42             }
43              
44             };
45             };
46              
47             gather sub {
48             my ($build) = @_;
49             while ( my ( $key, $value ) = each %minimap2_programs ) {
50             $build->runtime_prop->{command}->{$key} = $value;
51             }
52             };
53              
54             1;