Apache-Voodoo

 view release on metacpan or  search on metacpan

bin/voodoo-control  view on Meta::CPAN

#!/usr/bin/perl -I /data/apache/lib/perl

=pod ###########################################################################

=head1 NAME

voodoo-control - install / upgrade 

=head1 SYNOPSIS

FIXME: Add documentation

=cut ###########################################################################

use strict;
use warnings;

use Getopt::Long;
use Data::Dumper;

# turn off buffered output
$| = 1;

my %options = (
	'verbose' => 0,
	'ignore'  => 0,
	'pretend' => 0
);

GetOptions(
	\%options,
	'pretend!',
	'ignore!',
	'verbose|v:i',
	'dbhost|h:s',
	'dbname|n:s',
	'dbuser|u:s',
	'dbpass|p:s',
	'dbroot|r:s',
);

my %COMMANDS = (
	'install'    => \&install,
	'update'     => \&update,
	'showconfig' => \&showconfig,
	'setconfig'  => \&setconfig,
	'newapp'     => \&newapp,
	'newmodule'  => \&newmodule,
	'probetable' => \&probetable,
	'markupdatesapplied' => \&markupdatesapplied,
);

my $command = shift @ARGV;

if (defined($COMMANDS{$command})) {
	$COMMANDS{$command}->(%options);
}
else {
	show_usage();
}

sub install {
	my %options = @_;

	my $target = shift @ARGV;

	# use these on demand.  This has two benefits.
	# a) We don't spend time using in stuff we don't need.
	# b) This program will still run even if these fail to load because of bad configuration.
	# c) This allows this program to be used to fix the broken configuration.
	load_mod("Apache::Voodoo::Install::Distribution");
	load_mod("Apache::Voodoo::Install::Updater");

	################################################################################
	# make sure this file exists and that the name follows the correct format
	################################################################################
	my $distro = Apache::Voodoo::Install::Distribution->new('distribution' => $target, %options);

	$distro->do_install();



( run in 2.572 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )