-sub _plan {
- my $can_plan = shift;
-
- my $cvs = `which cvs`; chomp $cvs;
- my $cvsps = `which cvsps`; chomp $cvsps;
- return plan(skip_all => 'cvs or cvsps not available')
- unless -x $cvs && -x $cvsps;
-
- foreach my $module (qw(File::ReadBackwards File::MimeInfo)) {
- eval qq{use $module};
- if ($@) {
- return plan(skip_all => "$module not available");
- }
- }
-
- return plan(skip_all => "can't create $dir: $!")
- unless mkdir($dir);
-
- return unless $can_plan;
-
- return plan(tests => $total_tests);
-}
-
-sub _startup {
- my $can_plan = shift;
-
- _plan($can_plan);
- _generate_minimal_config();
- _create_test_repo();
-}
-
-sub _shutdown {
- my $had_plan = shift;
-
- system "rm -rf $dir";
- done_testing() unless $had_plan;
-}
-
-sub _generate_minimal_config {
- %config = IkiWiki::defaultconfig();
- $config{rcs} = "cvs";
- $config{srcdir} = "$dir/src";
- $config{cvsrepo} = "$dir/repo";
- $config{cvspath} = "ikiwiki";
- IkiWiki::loadplugins();
- IkiWiki::checkconfig();
-}
-
-sub _create_test_repo {
- my $cvs = "cvs -d $config{cvsrepo}";
- my $dn = ">/dev/null";
- system "$cvs init $dn";
- system "mkdir $dir/$config{cvspath} $dn";
- system "cd $dir/$config{cvspath} && "
- . "$cvs import -m import $config{cvspath} VENDOR RELEASE $dn";
- system "rm -rf $dir/$config{cvspath} $dn";
- system "$cvs co -d $config{srcdir} $config{cvspath} $dn";
-}