From: Chris W. <la...@us...> - 2005-02-26 23:31:37
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2901/lib/OpenInteract2 Modified Files: Constants.pm Context.pm Manage.pm Repository.pm Log Message: OIN-136: replace all OI2::Config::Base references with ::Bootstrap and all 'base.conf' references with 'bootstrap.ini' Index: Constants.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Constants.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Constants.pm 17 Feb 2004 04:30:13 -0000 1.9 --- Constants.pm 26 Feb 2005 23:31:24 -0000 1.10 *************** *** 49,55 **** ); ! use constant BASE_CONF_DIR => 'conf'; ! use constant BASE_CONF_FILE => 'base.conf'; ! my @FILE = qw( BASE_CONF_DIR BASE_CONF_FILE ); use constant ACTION_KEY => 'ACTION'; --- 49,55 ---- ); ! use constant BOOTSTRAP_CONF_DIR => 'conf'; ! use constant BOOTSTRAP_CONF_FILE => 'bootstrap.ini'; ! my @FILE = qw( BOOTSTRAP_CONF_DIR BOOTSTRAP_CONF_FILE ); use constant ACTION_KEY => 'ACTION'; *************** *** 159,167 **** These are default filenames and directories for various items in OI2: ! B<BASE_CONF_DIR>: This is the default directory under the website where ! you can find the base configuration. This is normally 'conf'. ! B<BASE_CONF_FILE>: This is the default filename for the base ! configuration. It is normally 'base.conf'. =head2 Template Keys --- 159,167 ---- These are default filenames and directories for various items in OI2: ! B<BOOTSTRAP_CONF_DIR>: This is the default directory under the website where ! you can find the bootstrap configuration. This is normally 'conf'. ! B<BOOTSTRAP_CONF_FILE>: This is the default filename for the ! bootstrap configuration. It is normally 'bootstrap.ini'. =head2 Template Keys Index: Context.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Context.pm,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Context.pm 25 Feb 2005 05:35:59 -0000 1.85 --- Context.pm 26 Feb 2005 23:31:24 -0000 1.86 *************** *** 42,46 **** require OpenInteract2::Config; ! require OpenInteract2::Config::Base; require OpenInteract2::DatasourceManager; require OpenInteract2::Observer; --- 42,46 ---- require OpenInteract2::Config; ! require OpenInteract2::Config::Bootstrap; require OpenInteract2::DatasourceManager; require OpenInteract2::Observer; *************** *** 53,57 **** require OpenInteract2::I18N; ! my @CORE_FIELDS = qw( base_config repository packages cache datasource_manager timezone timezone_object setup_class ); my @REQUEST_FIELDS = qw( request response controller user group is_logged_in is_admin ); --- 53,57 ---- require OpenInteract2::I18N; ! my @CORE_FIELDS = qw( bootstrap repository packages cache datasource_manager timezone timezone_object setup_class ); my @REQUEST_FIELDS = qw( request response controller user group is_logged_in is_admin ); *************** *** 62,66 **** # $item should be either a hashref of parameters (preferably with one ! # parameter 'website_dir') or an OI2::Config::Base object sub create { --- 62,66 ---- # $item should be either a hashref of parameters (preferably with one ! # parameter 'website_dir') or an OI2::Config::Bootstrap object sub create { *************** *** 75,91 **** my $ctx = bless( {}, $class ); ! my ( $base_config ); ! if ( ref $item eq 'OpenInteract2::Config::Base' ) { ! $base_config = $item; ! $website_dir = $base_config->website_dir; } elsif ( $item->{website_dir} ) { ! $base_config = eval { ! OpenInteract2::Config::Base->new({ ! website_dir => $item->{website_dir} }) }; if ( $@ ) { OpenInteract2::Exception->throw( ! "Cannot create base config object using website ", "directory '$item->{website_dir}': $@" ); } --- 75,92 ---- my $ctx = bless( {}, $class ); ! my ( $bootstrap ); ! if ( ref $item eq 'OpenInteract2::Config::Bootstrap' ) { ! $bootstrap = $item; ! $website_dir = $bootstrap->website_dir; } elsif ( $item->{website_dir} ) { ! $bootstrap = eval { ! OpenInteract2::Config::Bootstrap->new({ ! website_dir => $item->{website_dir} ! }) }; if ( $@ ) { OpenInteract2::Exception->throw( ! "Cannot create bootstrap object using website ", "directory '$item->{website_dir}': $@" ); } *************** *** 104,110 **** $log_init ||= get_logger( LOG_INIT ); ! if ( $base_config ) { ! $ctx->base_config( $base_config ); ! $log_init->is_debug && $log_init->debug( "Assigned base config ok" ); eval { $ctx->setup( $params ) }; if ( $@ ) { --- 105,112 ---- $log_init ||= get_logger( LOG_INIT ); ! if ( $bootstrap ) { ! $ctx->bootstrap( $bootstrap ); ! $log_init->is_debug && ! $log_init->debug( "Assigned bootstrap ok; setting up..." ); eval { $ctx->setup( $params ) }; if ( $@ ) { *************** *** 149,167 **** $log_init->info( "Will skip setup tasks: ", join( ', ', @skip ) ); } ! my $base_config = $self->base_config; ! unless ( $base_config and ! ref( $base_config ) eq 'OpenInteract2::Config::Base' ) { ! $log_init->error( "Cannot run setup() without base_config defined" ); OpenInteract2::Exception->throw( ! "Cannot run setup() on context without a valid base ", ! "configuration object set" ); } # This should call _initialize_singleton() when it's got the ! # context in a decent state OpenInteract2::Setup->run_all_actions( $self, @skip ); - $log_init->info( "Initialized context ok" ); return $self; } --- 151,170 ---- $log_init->info( "Will skip setup tasks: ", join( ', ', @skip ) ); } ! my $bootstrap = $self->bootstrap; ! unless ( $bootstrap and ! ref( $bootstrap ) eq 'OpenInteract2::Config::Bootstrap' ) { ! $log_init->error( "Cannot run setup() without bootstrap defined" ); OpenInteract2::Exception->throw( ! "Cannot run setup() on context without a valid ", ! "bootstrap configuration object set" ); } # This should call _initialize_singleton() when it's got the ! # context in a decent state... + $log_init->info( "Running setup actions..." ); OpenInteract2::Setup->run_all_actions( $self, @skip ); + $log_init->info( "Setup actions ran ok, context now initialized" ); return $self; } *************** *** 187,191 **** if ( $config ) { $log_init ||= get_logger( LOG_INIT ); ! $config->{dir}{website} = $self->base_config->website_dir; $config->translate_dirs; $log_init->info( "Translated server config directories ok" ); --- 190,194 ---- if ( $config ) { $log_init ||= get_logger( LOG_INIT ); ! $config->{dir}{website} = $self->bootstrap->website_dir; $config->translate_dirs; $log_init->info( "Translated server config directories ok" ); *************** *** 567,573 **** sub lookup_temp_lib_directory { my ( $self ) = @_; ! my $base_config = $self->base_config; ! my $lib_dir = $base_config->temp_lib_dir || DEFAULT_TEMP_LIB_DIR; ! return File::Spec->catdir( $base_config->website_dir, $lib_dir ); } --- 570,576 ---- sub lookup_temp_lib_directory { my ( $self ) = @_; ! my $bootstrap = $self->bootstrap; ! my $lib_dir = $bootstrap->temp_lib_dir || DEFAULT_TEMP_LIB_DIR; ! return File::Spec->catdir( $bootstrap->website_dir, $lib_dir ); } *************** *** 979,989 **** Returns: L<OpenInteract2::Context|OpenInteract2::Context> object ! B<create( $base_config|\%config_params, [ \%setup_params ] )> Creates a new context. If you pass in a ! L<OpenInteract2::Config::Base|OpenInteract2::Config::Base> object or ! specify 'website_dir' in C<\%setup_params>, it will run the server ! initialization routines in C<setup()>. (If you pass in an invalid ! directory for the parameter an exception is thrown.) If you do not know these items when the context is created, you can do --- 982,992 ---- Returns: L<OpenInteract2::Context|OpenInteract2::Context> object ! B<create( $bootstrap|\%config_params, [ \%setup_params ] )> Creates a new context. If you pass in a ! L<OpenInteract2::Config::Bootstrap|OpenInteract2::Config::Bootstrap> ! object or specify 'website_dir' in C<\%setup_params>, it will run the ! server initialization routines in C<setup()>. (If you pass in an ! invalid directory for the parameter an exception is thrown.) If you do not know these items when the context is created, you can do *************** *** 994,1001 **** ... some time later ... ! my $base_config = OpenInteract2::Config::Base->new({ website_dir => $dir } ); ... or ... ! my $base_config = OpenInteract2::Config::Base->new({ filename => $file } ); ! $ctx->base_config( $base_config ); $ctx->setup(); --- 997,1008 ---- ... some time later ... ! my $bootstrap = OpenInteract2::Config::Bootstrap->new({ ! website_dir => $dir ! }); ... or ... ! my $bootstrap = OpenInteract2::Config::Bootstrap->new({ ! filename => $file ! }); ! $ctx->bootstrap( $bootstrap ); $ctx->setup(); *************** *** 1022,1031 **** Runs a series of routines, mostly from L<OpenInteract2::Setup|OpenInteract2::Setup>, to initialize the ! singleton context object. If the C<base_config> property has not been set with a valid ! L<OpenInteract2::Config::Base|OpenInteract2::Config::Base> object, an exception is thrown. ! If you pass to C<create()> a C<base_config> object or a valid website directory, C<setup()> will be called automatically. --- 1029,1038 ---- Runs a series of routines, mostly from L<OpenInteract2::Setup|OpenInteract2::Setup>, to initialize the ! singleton context object. If the C<bootstrap> property has not been set with a valid ! L<OpenInteract2::Config::Bootstrap|OpenInteract2::Config::Bootstrap> object, an exception is thrown. ! If you pass to C<create()> a C<bootstrap> object or a valid website directory, C<setup()> will be called automatically. *************** *** 1492,1498 **** Creates the fully-qualified name for the temporary library ! directory. This can be specified in the base configuration ! (C<conf/base.conf>) or a default (C<tmplib/>) is provided. Both are ! relative to the website directory. This method does not care of the directory exists or not, it just --- 1499,1505 ---- Creates the fully-qualified name for the temporary library ! directory. This can be specified in the bootstrap configuration ! (C<conf/bootstrap.ini>) or a default (C<tmplib/>) is provided. Both ! are relative to the website directory. This method does not care of the directory exists or not, it just *************** *** 1579,1584 **** methods. ! B<base_config>: Holds the ! L<OpenInteract2::Config::Base|OpenInteract2::Config::Base> object. This must be defined for the context to be initialized. --- 1586,1591 ---- methods. ! B<bootstrap>: Holds the ! L<OpenInteract2::Config::Bootstrap|OpenInteract2::Config::Bootstrap> object. This must be defined for the context to be initialized. *************** *** 1601,1605 **** L<OpenInteract2::Action|OpenInteract2::Action> ! L<OpenInteract2::Config::Base|OpenInteract2::Config::Base> L<OpenInteract2::Setup|OpenInteract2::Setup> --- 1608,1612 ---- L<OpenInteract2::Action|OpenInteract2::Action> ! L<OpenInteract2::Config::Bootstrap|OpenInteract2::Config::Bootstrap> L<OpenInteract2::Setup|OpenInteract2::Setup> Index: Manage.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Manage.pm,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Manage.pm 13 Feb 2005 20:16:36 -0000 1.46 --- Manage.pm 26 Feb 2005 23:31:24 -0000 1.47 *************** *** 500,507 **** } $log->info( "Website directory '$website_dir' exists, setting up context..." ); ! my $base_config = OpenInteract2::Config::Base->new({ website_dir => $website_dir }); ! OpenInteract2::Context->create( $base_config, $params ); $log->info( "Context setup for management task(s) ok" ); } --- 500,508 ---- } $log->info( "Website directory '$website_dir' exists, setting up context..." ); ! my $bootstrap = OpenInteract2::Config::Bootstrap->new({ website_dir => $website_dir }); ! $log->info( "Created bootstrap config ok, creating context..." ); ! OpenInteract2::Context->create( $bootstrap, $params ); $log->info( "Context setup for management task(s) ok" ); } Index: Repository.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Repository.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Repository.pm 24 Jan 2005 17:11:54 -0000 1.21 --- Repository.pm 26 Feb 2005 23:31:24 -0000 1.22 *************** *** 27,31 **** # CONSTRUCTOR ! # Open up the repository, using the OpenInteract2::Config::Base object # or a specified website directory. Can also open up from a separate # file if specified. --- 27,31 ---- # CONSTRUCTOR ! # Open up the repository, using the OpenInteract2::Config::Bootstrap object # or a specified website directory. Can also open up from a separate # file if specified. *************** *** 41,45 **** my $repository_file = REPOSITORY_FILE; my $typeof = ref $item; ! if ( $typeof eq 'OpenInteract2::Config::Base' ) { $self->website_dir( $item->website_dir ); $self->config_dir( $item->config_dir ); --- 41,45 ---- my $repository_file = REPOSITORY_FILE; my $typeof = ref $item; ! if ( $typeof eq 'OpenInteract2::Config::Bootstrap' ) { $self->website_dir( $item->website_dir ); $self->config_dir( $item->config_dir ); *************** *** 333,337 **** # Get a reference to a repository ! my $repository = OpenInteract2::Repository->new( CTX->base_config ); # OR a handy shortcut once the setup actions have run --- 333,337 ---- # Get a reference to a repository ! my $repository = OpenInteract2::Repository->new( CTX->bootstrap ); # OR a handy shortcut once the setup actions have run *************** *** 415,419 **** =head1 METHODS ! B<new( [ $base_config | \%params ] )> Creates a new repository object. You normally do not call this --- 415,419 ---- =head1 METHODS ! B<new( [ $bootstrap | \%params ] )> Creates a new repository object. You normally do not call this *************** *** 421,426 **** context. ! Initialization is preferred with C<$base_config>, which is a ! L<OpenInteract2::Config::Base|OpenInteract2::Config::Base> object. This contains the website, config and package directories we need to initialize the repository. --- 421,426 ---- context. ! Initialization is preferred with C<$bootstrap>, which is a ! L<OpenInteract2::Config::Bootstrap|OpenInteract2::Config::Bootstrap> object. This contains the website, config and package directories we need to initialize the repository. |