Changeset 1451 for trunk


Ignore:
Timestamp:
Jan 2, 2013, 12:53:20 AM (9 years ago)
Author:
Dominic Hargreaves
Message:

Respect destdir when initialising database; also protect against undefined warnings when destdir is not set

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1450 r1451  
    1111        Work around a "No such method textContent" bug in
    1212          Test::HTML::Content when XML::LibXML is not installed
    13         Respect destdir when installing scripts, templates, etc
     13        Respect destdir when installing scripts, templates, etc and
     14          when initialising SQLite databases
    1415        Use mkpath to create the custom template directory rather than
    1516          mkdir, for cases where the parent directory doesn't already
  • trunk/lib/OpenGuides/Build.pm

    r1450 r1451  
    2222
    2323    # Initialise the database if necessary.
    24     my $dbname = $config->dbname;
     24    # Using destdir here is a bit far-fetched, unless we expect
     25    # packagers to ship pre-initialised databases. However, it is
     26    # better than ignoring it. A better solution would be to allow
     27    # more control over whether the database is initialised here.
     28    my $dbname = ( $config->dbtype eq 'sqlite' && defined $self->destdir ) ?
     29        File::Spec->catdir($self->destdir, $config->dbname) :
     30        $config->dbname;
    2531    my $dbuser = $config->dbuser;
    2632    my $dbpass = $config->dbpass;
     
    6066
    6167    # Install the scripts where we were told to.
    62     my $install_directory    = File::Spec->catdir($self->destdir, $config->install_directory);
     68    my $install_directory    = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->install_directory ) : $config->install_directory;
    6369    my $script_name          = $config->script_name;
    64     my $template_path        = File::Spec->catdir($self->destdir, $config->template_path);
    65     my $custom_template_path = File::Spec->catdir($self->destdir, $config->custom_template_path);
     70    my $template_path        = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->template_path ) : $config->template_path;
     71    my $custom_template_path = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->custom_template_path ) : $config->custom_template_path;
    6672    my $custom_lib_path      = $config->custom_lib_path;
    67     my $static_path          = File::Spec->catdir($self->destdir, $config->static_path);
     73    my $static_path          = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->static_path ) : $config->static_path;
    6874    my @extra_scripts        = @{ $self->config_data( "__extra_scripts" ) };
    6975    my @templates            = @{ $self->config_data( "__templates" ) };
Note: See TracChangeset for help on using the changeset viewer.