Apache-Voodoo

 view release on metacpan or  search on metacpan

bin/voodoo-control  view on Meta::CPAN

		}
		else {
			exit;
		}
	}
	$newmod->create();
}

sub probetable {
	my %options = @_;

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

	my $mod_name = shift @ARGV;
	assert_mod_name($mod_name);

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

	my $newmod = Apache::Voodoo::Scaffold::NewModule->new('app_name' => $app_name, mod_name => $mod_name, %options);

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

sub do_post {
	my %options = @_;

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

	my $post = Apache::Voodoo::Install::Post->new(%options);

	$post->do_setup_checks();
}
	
sub show_usage {
	print "\nAutomated install / upgrade for Apache::Voodoo based applications.\n\n";
	print "Usage: voodoo-control [options] [command]\n";
	print "Commands:\n";
	print "    install \"installfile\" Install the given application.\n";
	print "    update \"app name\"     Run the update steps on an already installed application.\n";
	print "    showconfig            Show global configuration settings.\n";
	print "    setconfig             Change global configuration settings.\n";
	print "    anything else         Show this help message.\n";
	print "Options:\n";
	print "    --pretend    Step through operations.  Don't actually do anything\n";
	print "    -h --dbhost  Override database host name in config files\n";
	print "    -n --dbname  Override database name in conf files\n";
	print "    -u --dbuser  Override database username in conf files\n";
	print "    -p --dbpass  Override database password in conf files\n";
	print "    -r --dbroot  Database root password\n";
	print "    -v number    Increase verbosity \n";
	print "\n";
	print "Expert Options: (Useful in a development environment; dangerous in a production environment.)\n";
	print "    --ignore           Causes errors in the update command files to be ignored\n";
	print "    markupdatesapplied Makes the system believe all the update have been applied,\n";
	print "                       doesn't acutally process them.\n";
	print "\n";
	exit;
}

sub load_mod {
	my $mod = shift;
	eval "use $mod;";
	if ($@) { die $@; }
}

sub assert_app_name {
	my $app_name = shift;
	unless ($app_name =~ /^[a-z]\w*$/i) {
		print "Invalid application name.  Valid names must begin with a letter and only contain letters, numbers and _\n";
		exit;
	}
}

sub assert_mod_name {
	my $mod_name = shift;
	unless ($mod_name =~ /^[a-z]\w*(::[a-z]\w*)*$/i) {
		print "Invalid module name.  Modules must follow Perl's module naming convention\n";
		exit;
	}
}

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

=head1 AUTHOR

Maverick, /\/\averick@smurfbaneDOTorg

=head1 COPYRIGHT

Copyright (c) 2005 Steven Edwards.  All rights reserved.

You may use and distribute Voodoo under the terms described in the LICENSE file include
in this package or L<Apache::Voodoo::license>.  The summary is it's a legalese version
of the Artistic License :)

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



( run in 0.606 second using v1.01-cache-2.11-cpan-d8267643d1d )