Apache-SWIT

 view release on metacpan or  search on metacpan

lib/Apache/SWIT/Maker/Makefile.pm  view on Meta::CPAN

	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -I t -I blib/lib t/direct_test.pl $(APACHE_TEST_FILES)

test_apache :: pure_all
	%s
}, __PACKAGE__->find_tests_str('dual'), join("\n\t"
	, __PACKAGE__->test_apache_lines('$(APACHE_TEST_FILES)'))) : q{
test_dual :: pure_all
	./scripts/swit_app.pl test_root test_dual
test_apache :: pure_all
	./scripts/swit_app.pl test_root test_apache
test_direct :: pure_all
	./scripts/swit_app.pl test_root test_direct
};

	return __PACKAGE__->get_makefile_rules . $tests_str . q{
realclean ::
	$(RM_RF) t/htdocs t/logs
	$(RM_F) t/conf/apache_test_config.pm  t/conf/modperl_inc.pl t/T/Test.pm
	$(RM_F) t/conf/extra.conf t/conf/httpd.conf t/conf/modperl_startup.pl
	$(RM_F) blib/conf/httpd.conf t/conf/mime.types t/conf/schema.sql
};
}

my @_swit_overrides = qw(test postamble constants install);

sub _init_swit_sections {
	my $self = shift;
	return if $self->no_swit_overrides;
	$self->overrides({}) unless $self->overrides;
	for my $o (@_swit_overrides) {
		next if $self->overrides->{$o};
		my $f = $self->can("_mm_$o") or next;
		$self->overrides->{$o} = $f;
	}
}

sub write_makefile {
	my $self = shift;
	$self->_init_swit_sections;
	$self->_init_dirscan;
	my $o = $self->overrides || {};
	while (my ($n, $f) = each %$o) {
		no strict 'refs';
		no warnings 'redefine';
		*{ "MY::" . $n } = $f;
	}
	WriteMakefile(@_);
}

sub deploy_httpd_conf {
	my ($class, $from, $to) = @_;
	mkpath("$to/conf");
	my $from_ap = abs_path($from);
	my $to_ap = abs_path($to);
	$_ = read_file("$from_ap/conf/httpd.conf");
	s#$from_ap#$to_ap#g;
	conv_forced_write_file("$to_ap/conf/httpd.conf", "PerlSetEnv "
			. "APACHE_SWIT_DB_NAME $ENV{APACHE_SWIT_DB_NAME}\n$_");
}

sub update_db_schema {
	my ($class, $to) = @_;
	if (!$ENV{APACHE_SWIT_DB_NAME} && -f "$to/conf/httpd.conf") {
		my @lines = read_file("$to/conf/httpd.conf");
		($ENV{APACHE_SWIT_DB_NAME}) = ($lines[0]
				=~ /PerlSetEnv APACHE_SWIT_DB_NAME (\w+)/);
	}
	confess "No APACHE_SWIT_DB_NAME given" unless $ENV{APACHE_SWIT_DB_NAME};
	push @INC, "t", "blib/lib";

	# become_postgres_user changes uid of the process. We will not be
	# able to copy files afterwards. Do it in child then.
	if (fork) {
		wait;
	} else {
		conv_eval_use("T::TempDB");
		exit;
	}
}

sub install_files {
	my ($class, $from, $to) = @_;
	my $pf = "$to/.packfile";
	ExtUtils::Install::install({ $from, $to, "write" => $pf, "read", $pf });
}

sub do_install {
	my ($class, $from, $to) = @_;
	$class->update_db_schema($to);
	$class->install_files($from, $to);
	$class->deploy_httpd_conf($from, $to);
}

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.517 second using v1.00-cache-2.02-grep-82fe00e-cpan-1310916c57ae )