File Coverage

blib/lib/Bio/GMOD/Admin/Archive.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             =pod
2              
3             # NOT YET CONVERTED!!!
4              
5             =head1 NAME
6              
7             WormBase::Archive::Build - Create archives of Wormbase releases
8              
9             =head1 SYNOPSIS
10              
11             use Bio::GMOD::Admin::Archive;
12             my $archive = Bio::GMOD::Admin::Archive->new();
13              
14             $archive->create_archive();
15              
16             =head1 METHODS
17              
18             =over 4
19              
20             =item Bio::GMOD::Admin::Archive->new(@options)
21              
22             Create a new WormBase::Archive object for archiving WormBase releases.
23              
24             The options consist largely of file system and remote paths. If none
25             are provided, they will all be populated from the default file located
26             on the primary WormBase server. This is the recommended idiom as it
27             insulates your programs from structural changes at WormBase. In this
28             case, archives will be built in /pub/wormbase/RELEASE where RELEASE is
29             a WSXXX release.
30              
31             There are, however, at least two options that you will wish to
32             provide:
33              
34             --database_repository Full path where to store archives on your filesystem
35             --mysql_path Full path to the mysql data dir
36              
37             See WormBase.pm for additional details on all system-dependent paths
38             that can be overridden.
39              
40             =head1 ARCHIVING RELEASES
41              
42             Creating an archive of a release is as easy as
43              
44             my $result = $archive->create_archive();
45              
46             Read on for full details about how this works.
47              
48             =head1 PUBLIC METHODS
49              
50             =item $archive->create_archive(@options)
51              
52             Build tarballs of WormBase releases. Available options are:
53              
54             -components Which packages to create (see below)
55             -release WSXXX release version (default is the current release)
56             -rebuild Pass a boolean true to force rebuilding of a package that
57             has already been built.
58              
59             The --components option accepts an array reference of which packages
60              
61             to create.
62              
63             Available components are:
64             acedb the acedb database for the current release
65             elegans_gff the C. elegans GFF database
66             briggsae_gff the C. briggsae GFF database
67             blast the blast and blat databases
68              
69             If --components is not specified, all of the above will be packaged.
70              
71             =item _package_acedb
72             _package_elegans_gff
73             _package_briggsae_gff
74             _package_blast_blat
75              
76             Subroutines that handle packaging of each of the individual
77             components.
78              
79             =cut
80              
81             package Bio::GMOD::Admin::Archive;
82              
83 1     1   43406 use vars qw/@ISA $VERSION/;
  1         2  
  1         68  
84 1     1   793 use Bio::GMOD;
  1         6  
  1         31  
85 1     1   794 use Bio::GMOD::Util::CheckVersions;
  0            
  0            
86             use Bio::GMOD::Util::Rearrange;
87             @ISA = qw/Bio::GMOD Bio::GMOD::Util::CheckVersions/;
88              
89             sub create_archive {
90             my ($self,@p) = @_;
91             my ($to_package,$rebuild,$components) = rearrange([qw/RELEASE REBUILD COMPONENTS/],@p);
92             my $current_db = $self->local_version();
93              
94             # Is the requested version on the server?
95             if ($to_package) {
96             if ($to_package ne $current_db) {
97             return "The currently installed version ($current_db) does not match the requested package build ($to_package). Package not created. Exiting...";
98             }
99             } else {
100             $to_package = $current_db;
101             }
102              
103             # Check to see if this release has already been packaged
104             my $current_package = $self->package_version();
105             if ($current_package eq $to_package && !$rebuild) {
106             return "$to_package has already been packaged. Pass the --rebuild option to build_package() to rebuild"
107             }
108              
109             $self->{to_package} = $to_package;
110             my @components = @$components if ($components);
111             @components = qw/acedb elegans_gff briggsae_gff blast/ unless @components > 0;
112             my %components = map {$_ => 1 } @components;
113             $self->_package_acedb() or die "Couldn't package acedb database for $to_package: $!\n"
114             if (defined $components{acedb});
115             $self->_package_elegans_gff() or die "Couldn't package elegans GFF database for $to_package: $!\n"
116             if (defined $components{elegans_gff});
117             $self->_package_briggsae_gff() or die "Couldn't package briggsae GFF database for $to_package: $!\n"
118             if (defined $components{briggsae_gff});
119             $self->_package_blast() or die "Couldn't package blast/blat databases for $to_package: $!\n"
120             if (defined $components{blast});
121             $self->_adjust_symlink() or die "Couldn't adjust symlinks to new database tarballs for $to_package: $!\n";
122             $self->do_archive() or die "Couldn't do archiving for $to_package: $!\n";
123             }
124              
125              
126              
127             # This should be handling tarring and gzipping
128             sub create_archive {
129              
130             }
131              
132              
133             =head1 BUGS
134              
135             None reported.
136              
137             =head1 SEE ALSO
138              
139             =head1 AUTHOR
140              
141             Todd W. Harris Eharris@cshl.eduE.
142              
143             Copyright (c) 2003-2005 Cold Spring Harbor Laboratory.
144              
145             This library is free software; you can redistribute it and/or modify
146             it under the same terms as Perl itself.
147              
148             =cut
149              
150