Ignore:
Timestamp:
May 2, 2003, 6:02:48 PM (19 years ago)
Author:
kake
Message:

Bumped version number.
Redid the script and template installation so the script does actually get called what you said it should be (code copied somewhat from Siesta::Build).
Also you now need to specify the template installation directory.
Fixed the support for non-local databases/IDENT authentication. I think.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Build.pm

    r84 r85  
    88    my $self = shift;
    99    $self->SUPER::ACTION_install;
     10    $self->ACTION_install_extras;
    1011
    1112    eval "use Config::Tiny";
     
    1314
    1415    my $config = Config::Tiny->read("wiki.conf");
     16
     17    # Initialise the database if necessary.
    1518    my $dbname = $config->{_}->{dbname};
    1619    my $dbuser = $config->{_}->{dbuser};
     
    3639    my $self = shift;
    3740    $self->SUPER::ACTION_fakeinstall;
     41    $self->ACTION_install_extras( fake => 1 );
    3842    print "Checking database schema...\n";
    3943}
    4044
     45sub ACTION_install_extras {
     46    my ($self, %args) = @_;
     47    my $FAKE = $args{fake} || 0;
     48
     49    eval "use Config::Tiny";
     50    die "Config::Tiny is required to set up this application.\n" if $@;
     51
     52    my $config = Config::Tiny->read("wiki.conf");
     53
     54    # Install the scripts where we were told to.
     55    my $install_directory = $config->{_}->{install_directory};
     56    my $script_name       = $config->{_}->{script_name};
     57    my $template_path     = $config->{_}->{template_path};
     58    my @extra_scripts     = @{ $self->{config}{__extra_scripts} };
     59    my @templates         = @{ $self->{config}{__templates} };
     60
     61    print "Installing scripts to $install_directory:\n";
     62    if ( $FAKE ) {
     63        print "wiki.cgi -> $install_directory/$script_name (FAKE)\n";
     64    } else {
     65        if ( $script_name ne "wiki.cgi" ) {
     66            File::Copy::copy("wiki.cgi", $script_name)
     67                or die "Can't copy('wiki.cgi', '$script_name'): $!";
     68        }
     69        my $copy = $self->copy_if_modified( $script_name, $install_directory );
     70        if ( $copy ) {
     71            $self->fix_shebang_line($copy);
     72            $self->make_executable($copy);
     73        } else {
     74            print "Skipping $install_directory/$script_name (unchanged)\n";
     75        }
     76        print "(Really: wiki.cgi -> $install_directory/$script_name)\n"
     77            unless $script_name eq "wiki.cgi";
     78    }
     79
     80    foreach my $script ( @extra_scripts ) {
     81        if ( $FAKE ) {
     82            print "$script -> $install_directory/$script (FAKE)\n";
     83        } else {
     84            my $copy = $self->copy_if_modified( $script, $install_directory );
     85            if ( $copy ) {
     86                $self->fix_shebang_line($copy);
     87                $self->make_executable($copy);
     88            } else {
     89                print "Skipping $install_directory/$script (unchanged)\n";
     90            }
     91        }
     92    }
     93
     94    print "Installing templates to $template_path:\n";
     95    foreach my $template ( @templates ) {
     96        if ( $FAKE ) {
     97            print "templates/$template -> $template_path/$template (FAKE)\n";
     98        } else {
     99            $self->copy_if_modified( "templates/$template", $template_path )
     100                or print "Skipping $template_path/$template (unchanged)\n";
     101        }
     102    }
     103}
     104
    411051;
Note: See TracChangeset for help on using the changeset viewer.