sugar high!
make it easy to handle syntactic sugar. In summary, compile now calls parse(sugar('gitolite.conf')). Details: - cleanup_conf_line went from subar.pm to common.pm - explode() and minions went from conf.pm to the new explode.pm - the callback went away; everyone just passes whole arrays around now - the new sugar() takes a filename and returns a listref - all sugar scripts take and return a listref - the first "built-in" sugar is written (setting gitweb.owner and gitweb.description) the new RC file format (of being a hash called %rc) is getting a nice workout :-)
This commit is contained in:
parent
4ab8db4925
commit
acb2f8fe8e
4 changed files with 219 additions and 170 deletions
|
@ -8,7 +8,7 @@ package Gitolite::Common;
|
|||
print2 dbg _mkdir _open ln_sf tsh_rc sort_u
|
||||
say _warn _chdir _print tsh_text list_phy_repos
|
||||
say2 _die slurp tsh_lines
|
||||
trace tsh_try
|
||||
trace cleanup_conf_line tsh_try
|
||||
usage tsh_run
|
||||
);
|
||||
#>>>
|
||||
|
@ -143,6 +143,19 @@ sub sort_u {
|
|||
return \@sort_u;
|
||||
}
|
||||
|
||||
sub cleanup_conf_line {
|
||||
my $line = shift;
|
||||
|
||||
# kill comments, but take care of "#" inside *simple* strings
|
||||
$line =~ s/^((".*?"|[^#"])*)#.*/$1/;
|
||||
# normalise whitespace; keeps later regexes very simple
|
||||
$line =~ s/=/ = /;
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/^ //;
|
||||
$line =~ s/ $//;
|
||||
return $line;
|
||||
}
|
||||
|
||||
{
|
||||
my @phy_repos = ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue