From: Chris W. <la...@us...> - 2005-02-02 13:09:03
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24063/Manage Modified Files: Website.pm Log Message: separate out the actual package installation so we can call that from elsewhere Index: Website.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage/Website.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Website.pm 5 Dec 2004 18:50:11 -0000 1.21 --- Website.pm 2 Feb 2005 13:08:47 -0000 1.22 *************** *** 51,76 **** my @files = (); - PACKAGE: foreach my $package_name ( @{ $package_names } ) { my $package_file = $package_dist->{ $package_name }; ! return unless ( $package_file ); ! my $install_task = OpenInteract2::Manage->new( ! 'install_package', { package_file => $package_file, ! website_dir => $website_dir } ! ); ! ! # The package install fires a 'progress' observation that it's done ! # installing the package, which is useful for *our* observers ! # to know ! ! $self->copy_observers( $install_task ); ! ! eval { $install_task->execute }; ! if ( $@ ) { ! $self->_fail( 'install package', ! "Failed to install $package_name: $@" ); ! } ! else { ! $self->_add_status( $install_task->get_status ); push @files, $package_file; } --- 51,60 ---- my @files = (); foreach my $package_name ( @{ $package_names } ) { my $package_file = $package_dist->{ $package_name }; ! next unless ( $package_file ); ! my $rv = $self->_install_package_file( ! $package_name, $package_file, $website_dir ); ! if ( $rv ) { push @files, $package_file; } *************** *** 79,82 **** --- 63,93 ---- } + sub _install_package_file { + my ( $self, $package_name, $package_file, $website_dir ) = @_; + my $install_task = OpenInteract2::Manage->new( + 'install_package', { + package_file => $package_file, + website_dir => $website_dir, + }); + + # The package install fires a 'progress' observation that it's done + # installing the package, which is useful for *our* observers + # to know + + $self->copy_observers( $install_task ); + + eval { $install_task->execute }; + if ( $@ ) { + $package_name ||= $package_file; + $self->_fail( 'install package', + "Failed to install $package_name: $@" ); + return undef; + } + else { + $self->_add_status( $install_task->get_status ); + return $package_file; + } + } + # Find all distribution packages in $source_dir/pkg |