Apache-Voodoo

 view release on metacpan or  search on metacpan

bin/voodoo-control  view on Meta::CPAN

	################################################################################
	# 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();

	my $app_name = $distro->app_name();

	my $updater = Apache::Voodoo::Install::Updater->new('app_name' => $app_name, %options);

	if ($distro->existing()) {
		$updater->do_update();
	}
	else {
		$updater->do_new_install();
	}
}

sub update {
	my %options = @_;

	my $app_name = shift @ARGV;
	assert_app_name($app_name);

	load_mod("Apache::Voodoo::Install::Updater");

	my $updater = Apache::Voodoo::Install::Updater->new('app_name' => $app_name, %options);

	$updater->do_update();
	do_post(app_name => $app_name, %options);
}

sub markupdatesapplied {
	my %options = @_;

	my $app_name = shift @ARGV;
	assert_app_name($app_name);

	load_mod("Apache::Voodoo::Install::Updater");

	my $updater = Apache::Voodoo::Install::Updater->new('app_name' => $app_name, %options);

	$updater->mark_updates_applied();
}

sub showconfig {
	load_mod("Apache::Voodoo::Constants");

	my $cnf = Apache::Voodoo::Constants->new();

	print " Apache Prefix Path: ", $cnf->prefix(),"\n";
	print "   App Install Path: ", $cnf->install_path(),"\n";
	print "       Session Path: ", $cnf->session_path(),"\n";
	print "   Config File Path: ", $cnf->conf_path(),"\n";
	print "   Config File Name: ", $cnf->conf_file(),"\n";
	print "   Update File Path: ", $cnf->updates_path(),"\n";
	print " Template File Path: ", $cnf->tmpl_path(),"\n";
	print "   Perl Module Path: ", $cnf->code_path(),"\n";
	print "         Apache UID: ", $cnf->apache_uid(),"\n";
	print "         Apache GID: ", $cnf->apache_gid(),"\n";
	print "Debug DB Connection: ", $cnf->debug_dbd()->[0],"\n";
	print "  Debug DB Username: ", $cnf->debug_dbd()->[1],"\n";
	print "  Debug DB Password: ", $cnf->debug_dbd()->[2],"\n";
	print "     Debug URL Path: ", $cnf->debug_path(),"\n";
	print "\n";
	print "Config settings stored in: ", $INC{'Apache/Voodoo/MyConfig.pm'},"\n";
	exit 0;	
}

sub setconfig {
	my %options = @_;

	my $cnf = {};

	eval "use Apache::Voodoo::MyConfig;";
	unless ($@) {
		# There is one, so we'll use the settings in it as the default
		if (ref($Apache::Voodoo::MyConfig::Config) eq "HASH") {
			$cnf = $Apache::Voodoo::MyConfig::Config;
		}
	}

	load_mod("Apache::Voodoo::Install::Config");

	my $cfg = Apache::Voodoo::Install::Config->new(%{$cnf});

	$cfg->do_config_setup($options{pretend});
}

sub newapp {
	my %options = @_;

	my $app_name = shift @ARGV;
	assert_app_name($app_name);

	load_mod("Apache::Voodoo::Scaffold::NewApplication");

	my $newapp = Apache::Voodoo::Scaffold::NewApplication->new('app_name' => $app_name, %options);

	if ($newapp->already_exists()) {
		print "An application with this name already exists.\n";
		print "Are you sure you want to replace it with a new blank application?\n";
		print "[y/N]?";
		my $answer = <STDIN>;
		if ($answer =~ /^y/) {
			$newapp->delete_existing();
		}
		else {
			exit;
		}
	}
	$newapp->create();
}

sub newmodule {
	my %options = @_;

	my $app_name = shift @ARGV;
	assert_app_name($app_name);



( run in 0.777 second using v1.01-cache-2.11-cpan-5735350b133 )