|
From: Chris W. <la...@us...> - 2001-11-28 05:55:10
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv433
Modified Files:
Startup.pm
Log Message:
add create_temp_lib() to create the temporary library directory
Index: Startup.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Startup.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** Startup.pm 2001/10/18 03:58:37 1.24
--- Startup.pm 2001/11/28 05:55:07 1.25
***************
*** 4,8 ****
--- 4,10 ----
use strict;
+ use Cwd qw( cwd );
use Data::Dumper qw( Dumper );
+ use File::Path qw();
use Getopt::Long qw( GetOptions );
use OpenInteract::Config;
***************
*** 17,22 ****
use constant DEBUG => 0;
! my $REPOS_CLASS = 'OpenInteract::PackageRepository';
! my $PKG_CLASS = 'OpenInteract::Package';
sub main_initialize {
--- 19,25 ----
use constant DEBUG => 0;
! my $TEMP_LIB_DIR = 'tmplib';
! my $REPOS_CLASS = 'OpenInteract::PackageRepository';
! my $PKG_CLASS = 'OpenInteract::Package';
sub main_initialize {
***************
*** 39,44 ****
# Read in our fundamental modules -- these should be in our @INC
! # already, since the 'request_class' is in 'OpenInteract/OpenInteract'
! # and the 'stash_class' is in 'MyApp/MyApp'
$class->require_module({ class => [ $bc->{request_class}, $bc->{stash_class} ] });
--- 42,48 ----
# Read in our fundamental modules -- these should be in our @INC
! # already, since the 'request_class' is in
! # 'OpenInteract/OpenInteract' and the 'stash_class' is in
! # 'MyApp/MyApp'
$class->require_module({ class => [ $bc->{request_class}, $bc->{stash_class} ] });
***************
*** 170,174 ****
--- 174,181 ----
}
+ $class->create_temp_lib( $bc );
+
unshift @INC, $website_dir;
+
my ( $init, $C ) = $class->main_initialize({ base_config => $bc,
alias_init => 1,
***************
*** 230,233 ****
--- 237,266 ----
+ # Method to copy all .pm files from all packages in a website to a
+ # separate directory -- if it currently exists we clear it out first.
+
+ sub create_temp_lib {
+ my ( $class, $base_config ) = @_;
+ my $site_dir = $base_config->{website_dir};
+
+ my $lib_dir = "$site_dir/$TEMP_LIB_DIR";
+ unshift @INC, $lib_dir;
+
+ File::Path::rmtree( $lib_dir ) if ( -d $lib_dir );
+ mkdir( $lib_dir );
+
+ my $site_repos = $REPOS_CLASS->fetch( undef,
+ { directory => $base_config->{website_dir} } );
+ my $packages = $site_repos->fetch_all_packages();
+ my ( @all_files );
+ foreach my $package ( @{ $packages } ) {
+ DEBUG && _w( 2, "Trying to copy files for package $package->{name}" );
+ my $files_copied = $PKG_CLASS->copy_modules( $package, $lib_dir );
+ push @all_files, @{ $files_copied };
+ }
+ DEBUG && _w( 3, "Copied ", scalar @all_files, " module files to ($lib_dir)" );
+ return \@all_files;
+ }
+
sub read_package_list {
***************
*** 333,359 ****
DEBUG && _w( 1, "Trying to process package ($pkg_name)" );
! # Note that app dir should be set earlier in the @INC list then the
! # base dir, since the app can override base
!
! my @package_dir_list = $PKG_CLASS->add_to_inc( $pkg_info );
! DEBUG && _w( 1, "Included @package_dir_list for $pkg_name" );
!
! # If we cannot find even one package directory, bail
!
! unless ( scalar @package_dir_list ) {
! _w( 0, "No package directories found for $pkg_name: was it installed correctly?" );
! return undef;
! }
!
! # Now we want the app dir to be *last*, so reverse the order
!
! @package_dir_list = reverse @package_dir_list;
# Plow through the directories and find the module listings (to
# include), action config (to parse and set) and the SPOPS config (to
! # parse and set)
my ( %spops, %action );
! foreach my $package_dir ( @package_dir_list ) {
my $conf_pkg_dir = "$package_dir/conf";
--- 366,379 ----
DEBUG && _w( 1, "Trying to process package ($pkg_name)" );
! my $site_pkg_dir = join( '/', $pkg_info->{website_dir}, $pkg_info->{package_dir} );
! my $base_pkg_dir = join( '/', $pkg_info->{base_dir}, $pkg_info->{package_dir} );
! DEBUG && _w( 1, "Pkg dirs: ($base_pkg_dir, $site_pkg_dir) for $pkg_name" );
# Plow through the directories and find the module listings (to
# include), action config (to parse and set) and the SPOPS config (to
! # parse and set). Base package first so its info can be overridden.
my ( %spops, %action );
! foreach my $package_dir ( $base_pkg_dir, $site_pkg_dir ) {
my $conf_pkg_dir = "$package_dir/conf";
***************
*** 585,589 ****
=head1 NAME
! OpenInteract::Startup -- Bootstrapper that reads in modules, manipulates @INC, etc.
=head1 SYNOPSIS
--- 605,609 ----
=head1 NAME
! OpenInteract::Startup -- Bootstrapper that reads in modules and initializes the environment
=head1 SYNOPSIS
|