Make sure $webguiRoot is setup consistently in all utility scripts.

Some scripts had a hardcoded use lib "../lib" and "../.." on
Session/Config method calls. This was changed to a BEGIN prologue
where @INC gets $webguiRoot added, and the method calls use
$webguiRoot instead.

This eases the creation of patches for filesystem reorganization of
the installed files (e.g. for Debian packages).
This commit is contained in:
Ernesto Hernández-Novich 2008-06-09 15:23:26 +00:00
parent 8dc4216edd
commit 8be24aec80
8 changed files with 59 additions and 17 deletions

View file

@ -8,8 +8,14 @@
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
our ($webguiRoot);
BEGIN {
$webguiRoot = "..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use lib '../lib';
use Getopt::Long;
use WebGUI::Asset;
use WebGUI::Config;
@ -39,7 +45,7 @@ GetOptions(
pod2usage( verbose => 2 ) if $help;
if ($configFile) {
my $session = WebGUI::Session->open("..", $configFile);
my $session = WebGUI::Session->open($webguiRoot, $configFile);
if ($indexsite) {
reindexSite($session);
} elsif ($updatesite) {
@ -59,10 +65,10 @@ if ($configFile) {
#-------------------------------------------------------------------
sub reindexAllSites {
my $configs = WebGUI::Config->readAllConfigs("..");
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
foreach my $site (keys %{$configs}) {
print "Indexing ".$site."...\n";
my $session = WebGUI::Session->open("..",$site);
my $session = WebGUI::Session->open($webguiRoot,$site);
reindexSite($session);
$session->var->end;
$session->close;