Author: dom
Date: 2013-01-02 00:53:20 +0000 (Wed, 02 Jan 2013)
New Revision: 1451
Modified:
trunk/Changes
trunk/lib/OpenGuides/Build.pm
Log:
Respect destdir when initialising database; also protect against undefined warnings when destdir is not set
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2013-01-02 00:32:36 UTC (rev 1450)
+++ trunk/Changes 2013-01-02 00:53:20 UTC (rev 1451)
@@ -10,7 +10,8 @@
not installed
Work around a "No such method textContent" bug in
Test::HTML::Content when XML::LibXML is not installed
- Respect destdir when installing scripts, templates, etc
+ Respect destdir when installing scripts, templates, etc and
+ when initialising SQLite databases
Use mkpath to create the custom template directory rather than
mkdir, for cases where the parent directory doesn't already
exist
Modified: trunk/lib/OpenGuides/Build.pm
===================================================================
--- trunk/lib/OpenGuides/Build.pm 2013-01-02 00:32:36 UTC (rev 1450)
+++ trunk/lib/OpenGuides/Build.pm 2013-01-02 00:53:20 UTC (rev 1451)
@@ -21,7 +21,13 @@
my $config = OpenGuides::Config->new( file => "wiki.conf" );
# Initialise the database if necessary.
- my $dbname = $config->dbname;
+ # Using destdir here is a bit far-fetched, unless we expect
+ # packagers to ship pre-initialised databases. However, it is
+ # better than ignoring it. A better solution would be to allow
+ # more control over whether the database is initialised here.
+ my $dbname = ( $config->dbtype eq 'sqlite' && defined $self->destdir ) ?
+ File::Spec->catdir($self->destdir, $config->dbname) :
+ $config->dbname;
my $dbuser = $config->dbuser;
my $dbpass = $config->dbpass;
my $dbhost = $config->dbhost;
@@ -59,12 +65,12 @@
my $config = OpenGuides::Config->new( file => "wiki.conf" );
# Install the scripts where we were told to.
- my $install_directory = File::Spec->catdir($self->destdir, $config->install_directory);
+ my $install_directory = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->install_directory ) : $config->install_directory;
my $script_name = $config->script_name;
- my $template_path = File::Spec->catdir($self->destdir, $config->template_path);
- my $custom_template_path = File::Spec->catdir($self->destdir, $config->custom_template_path);
+ my $template_path = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->template_path ) : $config->template_path;
+ my $custom_template_path = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->custom_template_path ) : $config->custom_template_path;
my $custom_lib_path = $config->custom_lib_path;
- my $static_path = File::Spec->catdir($self->destdir, $config->static_path);
+ my $static_path = defined $self->destdir ? File::Spec->catdir( $self->destdir, $config->static_path ) : $config->static_path;
my @extra_scripts = @{ $self->config_data( "__extra_scripts" ) };
my @templates = @{ $self->config_data( "__templates" ) };
my @static_files = @{ $self->config_data( "__static_files" ) };
Author: dom
Date: 2013-01-02 00:32:36 +0000 (Wed, 02 Jan 2013)
New Revision: 1450
Modified:
trunk/Build.PL
trunk/Changes
trunk/lib/OpenGuides/Build.pm
Log:
Use mkpath to create the custom template directory rather than mkdir, for cases where the parent directory doesn't already exist
Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL 2013-01-02 00:12:16 UTC (rev 1449)
+++ trunk/Build.PL 2013-01-02 00:32:36 UTC (rev 1450)
@@ -338,6 +338,7 @@
'Class::Accessor' => 0,
'Config::Tiny' => 0,
'Data::Dumper' => 0,
+ 'File::Path' => 0,
},
configure_requires => {
'Config::Tiny' => 0,
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2013-01-02 00:12:16 UTC (rev 1449)
+++ trunk/Changes 2013-01-02 00:32:36 UTC (rev 1450)
@@ -11,6 +11,9 @@
Work around a "No such method textContent" bug in
Test::HTML::Content when XML::LibXML is not installed
Respect destdir when installing scripts, templates, etc
+ Use mkpath to create the custom template directory rather than
+ mkdir, for cases where the parent directory doesn't already
+ exist
0.70 26 August 2012
New elements allowed in page content: span, dl, dt, dd (fixes #303).
Modified: trunk/lib/OpenGuides/Build.pm
===================================================================
--- trunk/lib/OpenGuides/Build.pm 2013-01-02 00:12:16 UTC (rev 1449)
+++ trunk/lib/OpenGuides/Build.pm 2013-01-02 00:32:36 UTC (rev 1450)
@@ -7,6 +7,7 @@
use Module::Build;
use OpenGuides::Config;
+use File::Path;
use base 'Module::Build';
sub ACTION_install {
@@ -155,7 +156,7 @@
} else {
unless (-d $custom_template_path) {
print "Creating directory $custom_template_path.\n";
- mkdir $custom_template_path or warn "Could not make $custom_template_path";
+ File::Path::mkpath $custom_template_path or warn "Could not make $custom_template_path";
}
}
Author: dom
Date: 2013-01-02 00:12:16 +0000 (Wed, 02 Jan 2013)
New Revision: 1449
Modified:
trunk/Changes
trunk/lib/OpenGuides/Build.pm
Log:
Respect destdir when installing scripts, templates, etc
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2012-12-18 22:27:01 UTC (rev 1448)
+++ trunk/Changes 2013-01-02 00:12:16 UTC (rev 1449)
@@ -9,7 +9,8 @@
Test::HTML::Content (et al) mode used when XML::LibXML is
not installed
Work around a "No such method textContent" bug in
- Test::HTML::Content when XML::LibXML is not installed
+ Test::HTML::Content when XML::LibXML is not installed
+ Respect destdir when installing scripts, templates, etc
0.70 26 August 2012
New elements allowed in page content: span, dl, dt, dd (fixes #303).
Modified: trunk/lib/OpenGuides/Build.pm
===================================================================
--- trunk/lib/OpenGuides/Build.pm 2012-12-18 22:27:01 UTC (rev 1448)
+++ trunk/lib/OpenGuides/Build.pm 2013-01-02 00:12:16 UTC (rev 1449)
@@ -58,12 +58,12 @@
my $config = OpenGuides::Config->new( file => "wiki.conf" );
# Install the scripts where we were told to.
- my $install_directory = $config->install_directory;
+ my $install_directory = File::Spec->catdir($self->destdir, $config->install_directory);
my $script_name = $config->script_name;
- my $template_path = $config->template_path;
- my $custom_template_path = $config->custom_template_path;
+ my $template_path = File::Spec->catdir($self->destdir, $config->template_path);
+ my $custom_template_path = File::Spec->catdir($self->destdir, $config->custom_template_path);
my $custom_lib_path = $config->custom_lib_path;
- my $static_path = $config->static_path;
+ my $static_path = File::Spec->catdir($self->destdir, $config->static_path);
my @extra_scripts = @{ $self->config_data( "__extra_scripts" ) };
my @templates = @{ $self->config_data( "__templates" ) };
my @static_files = @{ $self->config_data( "__static_files" ) };