File Coverage

blib/lib/App/cpanmigrate/bash.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 11 12 91.6


line stmt bran cond sub pod time code
1             package App::cpanmigrate::bash;
2 2     2   777 use strict;
  2         4  
  2         82  
3 2     2   11 use warnings;
  2         5  
  2         230  
4              
5             sub script {
6 1     1 0 9 my ($class, $version) = @_;
7              
8 1         8 return <<"EOS";
9             echo "@@@@@ Start migration to $version"; sleep 1;
10              
11             echo "@@@@@ Installing ExtUtils::Installed"; sleep 1;
12             cpanm ExtUtils::Installed;
13              
14             echo "@@@@@ Extracting all modules"; sleep 1;
15             if [[ -e /tmp/modules.list ]]; then rm /tmp/modules.list; fi;
16             perl -MExtUtils::Installed -E 'say for ExtUtils::Installed->new->modules' > /tmp/modules.list;
17              
18             echo "@@@@@ Upgrading perlbrew"; sleep 1;
19             curl -L http://xrl.us/perlbrewinstall | bash;
20             source ~/perl5/perlbrew/etc/bashrc;
21              
22             echo "@@@@@ Installing $version"; sleep 1;
23             perlbrew install "$version" -v &&
24              
25             echo "@@@@@ Switching new environment"; sleep 1;
26             perlbrew switch "$version" &&
27              
28             echo "@@@@@ Installing cpanminus for new environment"; sleep 1;
29             perlbrew install-cpanm &&
30              
31             echo "@@@@@ Installing all modules into new environment"; sleep 1;
32             cpanm < /tmp/modules.list;
33              
34             echo "@@@@@ Re-running cpanminus to check everything is OK"; sleep 1;
35             cpanm < /tmp/modules.list;
36              
37             echo "@@@@@ Done migration!";
38             perl -V;
39             EOS
40             }
41              
42             1;
43             __END__