Test.pm learned confreset() and confadd()

This commit is contained in:
Sitaram Chamarty 2012-03-14 15:29:44 +05:30
parent 356ff2b757
commit 89cc3a303d

View file

@ -9,12 +9,16 @@ package Gitolite::Test;
put put
text text
dump dump
confreset
confadd
); );
#>>> #>>>
use Exporter 'import'; use Exporter 'import';
use File::Path qw(mkpath); use File::Path qw(mkpath);
use Carp qw(carp cluck croak confess); use Carp qw(carp cluck croak confess);
use Gitolite::Common;
BEGIN { BEGIN {
require Gitolite::Test::Tsh; require Gitolite::Test::Tsh;
*{'try'} = \&Tsh::try; *{'try'} = \&Tsh::try;
@ -65,4 +69,25 @@ sub dump {
} }
} }
sub _confargs {
return @_ if ($_[1]);
return 'gitolite.conf', $_[0];
}
sub confreset {
system("rm", "-rf", "conf");
mkdir("conf");
put "conf/gitolite.conf", '
repo gitolite-admin
RW+ = admin
repo testing
RW+ = @all
';
}
sub confadd {
my ($file, $string) = _confargs(@_);
put "|cat >> conf/$file", $string;
}
1; 1;