blib/lib/Bio/Installer/EMBOSS.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 11 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 81 CC 4 SCAR 16.4
CC
4
Cov
0%
_execute_typical_nix_install
12.0
_remember_env_is_in_path
6.0
BEGIN
2.0
CRAP 5.2
1  
2 # BioPerl module for Bio::Installer::EMBOSS
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Albert Vilella
7 #
8 # Copyright Albert Vilella
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 Bio::Installer::EMBOSS - DESCRIPTION of Object
17  
18 =head1 SYNOPSIS
19  
20 Give standard usage here
21  
22 =head1 DESCRIPTION
23  
24 Describe the object here
25  
26 =head1 FEEDBACK
27  
28 =head2 Mailing Lists
29  
30 User feedback is an integral part of the evolution of this and other
31 Bioperl modules. Send your comments and suggestions preferably to
32 the Bioperl mailing list. Your participation is much appreciated.
33  
34 bioperl-l@bioperl.org - General discussion
35 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36  
37 =head2 Support
38  
39 Please direct usage questions or support issues to the mailing list:
40  
41 I<bioperl-l@bioperl.org>
42  
43 rather than to the module maintainer directly. Many experienced and
44 reponsive experts will be able look at the problem and quickly
45 address it. Please include a thorough description of the problem
46 with code and data examples if at all possible.
47  
48 =head2 Reporting Bugs
49  
50 Report bugs to the Bioperl bug tracking system to help us keep track
51 of the bugs and their resolution. Bug reports can be submitted via
52 the web:
53  
54 http://redmine.open-bio.org/projects/bioperl/
55  
56 =head1 AUTHOR - Albert Vilella
57  
58 Email avilella-AT-gmail-DOT-com
59  
60 Describe contact details here
61  
62 =head1 CONTRIBUTORS
63  
64 Additional contributors names and emails here
65  
66 =head1 APPENDIX
67  
68 The rest of the documentation details each of the object methods.
69 Internal methods are usually preceded with a _
70  
71 =cut
72  
73  
74 # Let the code begin...
75  
76  
77 package Bio::Installer::EMBOSS;
78 use vars qw(@ISA %DEFAULTS);
79 use strict;
80  
81 # Object preamble - inherits from Bio::Root::Root
82  
83 use Bio::Root::Root;
84 use Bio::Installer::Generic;
85  
86 @ISA = qw(Bio::Installer::Generic );
87  
88 BEGIN {
89 %DEFAULTS =
90 ( 'ORIGIN_DOWNLOAD_DIR' => 'ftp://ftp.uk.embnet.org/pub/EMBOSS/',
91 'DESTINATION_DOWNLOAD_DIR' => '/tmp',
92 'DESTINATION_INSTALL_DIR' => "/usr/local",
93 'PACKAGE_NAME' => 'EMBOSS-latest.tar.gz',
94 'DIRECTORY_NAME' => 'EMBOSS-2.9.0'
95 );
96 }
97 #FIXME: regexp directory_name so that is not hardcoded
98  
99 =head2 get_default
100  
101 Title : get_default
102 Usage :
103 Function:
104 Example :
105 Returns :
106 Args :
107  
108  
109 =cut
110  
111 sub get_default {
112 my $self = shift;
113 my $param = shift;
114 return $DEFAULTS{$param};
115 }
116  
117  
118 =head2 install
119  
120 Title : install
121 Usage : $installer->install();
122 Function:
123 Example :
124 Returns :
125 Args :
126  
127  
128 =cut
129  
130 sub install{
131 my ($self,@args) = @_;
132 $self->_decompress;
133 $self->_execute_typical_nix_install;
134 $self->_remember_env_is_in_path;
135 }
136  
137  
138 =head2 _execute_typical_nix_install
139  
140 Title : _execute_typical_nix_install
141 Usage :
142 Function:
143 Example :
144 Returns :
145 Args :
146  
147  
148 =cut
149  
150 sub _execute_typical_nix_install{
151 my ($self,@args) = @_;
152 my $call;
153  
154 #FIXME: regexp directory_name so that is not hardcoded, after EMBOSS-latest is downloaded
155 my $destination = $self->destination_install_dir . "/" . $self->directory_name;
156  
157 print "\n\nTypical linux install -- configure -- make -- make install (this might take a while)\n\n";sleep 1;
158 if (($^O =~ /dec_osf|linux|unix|bsd|solaris|darwin/i)) {
159 chdir $destination or die "Cant cd to $destination $!\n";
160  
161 print "\n\nCalling configure (this might take a while)\n\n";sleep 1;
162 $call = "./configure --prefix=$destination";
163 system("$call") == 0 or $self->throw("Error when trying to run configure");
164  
165 print "\n\nCalling make (this might take a while)\n\n";sleep 1;
166 $call = "make";
167 system("$call") == 0 or $self->throw("Error when trying to run make");
168 print "\n\nCalling make install (this might take a while)\n\n";sleep 1;
169 if (-w "$destination") {
170 $call = "make install";
171 } else {
172 print "\n\n You may need administrative password to install\n"
173 ."this program so that bioperl can see it in the binary PATH\n";
174 $call = "su -c \"make install\"";
175 }
176 system("$call") == 0 or $self->throw("Error when trying to run make install");
177  
178 } else {
179 $self->throw("_execute_typical_nix not yet implemented in this platform");
180 }
181 }
182  
183  
184 =head2 _remember_env_is_in_path
185  
186 Title : _remember_env_is_in_path
187 Usage :
188 Function:
189 Example :
190 Returns :
191 Args :
192  
193  
194 =cut
195  
196 sub _remember_env_is_in_path{
197 my ($self,@args) = @_;
198 my $dir;
199 $dir = $self->destination_install_dir;
200 unless ($dir =~ m|/usr/local|) {
201 print STDERR <<END;
202  
203 You may need to make $dir visible for \$PATH to help bioperl find the
204 program. This can be done with a symbolic link (as root):
205  
206 ln -s $dir/bin /usr/local/bin
207 END
208 ;
209 }
210  
211 }
212  
213  
214 1;