source: trunk/lib/OpenGuides/Build.pm @ 61

Last change on this file since 61 was 61, checked in by kake, 19 years ago

Finished adding mysql support - no sqlite support yet as it's a bit messier

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.0 KB
Line 
1package OpenGuides::Build;
2
3use strict;
4use Module::Build;
5use base 'Module::Build';
6
7sub ACTION_install {
8    my $self = shift;
9    $self->SUPER::ACTION_install;
10
11    eval "use Config::Tiny";
12    die "Config::Tiny is required to set up this application.\n" if $@;
13
14    my $config = Config::Tiny->read("wiki.conf");
15    my $dbname = $config->{_}->{dbname};
16    my $dbuser = $config->{_}->{dbuser};
17    my $dbpass = $config->{_}->{dbpass};
18    my $dbhost = $config->{_}->{dbhost};
19    my $dbtype = $config->{_}->{dbtype};
20
21    my %cgi_wiki_exts = ( postgres => "Pg",
22                          mysql    => "MySQL" );
23
24    my $cgi_wiki_module = "CGI::Wiki::Setup::" . $cgi_wiki_exts{$dbtype};
25    eval "require $cgi_wiki_module";
26    die "CGI::Wiki is required to set up this application.\n" if $@;
27
28    print "Checking database schema...\n";
29    {
30        no strict 'refs';
31        &{$cgi_wiki_module . "::setup"}( $dbname, $dbuser, $dbpass, $dbhost );
32    }
33}
34
35sub ACTION_fakeinstall {
36    my $self = shift;
37    $self->SUPER::ACTION_fakeinstall;
38    print "Checking database schema...\n";
39}
40
411;
Note: See TracBrowser for help on using the repository browser.