#! /usr/bin/perl -w use strict ; use lib '..' ; use lib '../lib' ; use Repocafe ; my $prog = substr($0,rindex($0,'/')+1) ; my $Usage = < ---------------------------------------- USAGE sub Usage { die "$_[0]$Usage" ; } sub Error { die "$prog: $_[0]\n" ; } sub Warn { warn "$prog: $_[0]\n" ; } # usage: &GetOptions(ARG,ARG,..) defines $opt_ID as 1 or user spec'ed value # usage: &GetOptions(\%opt,ARG,ARG,..) defines $opt{ID} as 1 or user value # ARG = 'ID' | 'ID=SPC' | 'ID:SPC' for no-arg, required-arg or optional-arg # ID = perl identifier # SPC = i|f|s for integer, fixedpoint real or string argument use Getopt::Long ; Getopt::Long::config('no_ignore_case') ; our %opt = () ; Usage('') unless GetOptions ( \%opt, qw(v q d f c=s) ) ; Usage("Arg count\n") unless @ARGV == 2 ; Blib::Mods::Doc -> debug ( 1 ) if $opt{d} ; my $SRC = shift ; my $DST = shift ; my $Cafe = make_cafe ( %opt, d => 0, -conn => 0 ) ; my $conf = $Cafe -> conf ; Error "can't find source $SRC" unless -f $SRC ; @ARGV = ( $SRC ) ; sub pref { my @res = map " $_", @_ ; wantarray ? @res : join "" , @res ; } open DST, ">$DST" or Error "can't write $DST ($!)" ; my $version = Version ; my $revision = $Cafe -> revision ; my $date = gmtime $^T ; my $data = $conf -> dir_data ; my $auth = Blib::Mods::Doc -> pod_author ( $version, $revision, $date ) ; my $secret = SECRET () ; my @setup_data = $Cafe -> usage ( 'setup-data' ) ; my @setup_vhost = $Cafe -> usage ( 'setup-vhost' ) ; my @setup_db = $Cafe -> usage ( 'setup-db' ) ; my @upd_admins = $Cafe -> usage ( 'upd-admins' ) ; my @upd_xusers = $Cafe -> usage ( 'upd-xusers' ) ; my @configtest = $Cafe -> usage ( 'configtest' ) ; my @mk_stats = $Cafe -> usage ( 'mk_stats' ) ; my @mail_watchers = $Cafe -> usage ( 'mail-watchers' ) ; my @mk_guest_list = $Cafe -> usage ( 'mk_guest_list' ) ; my @new_hooks = $Cafe -> usage ( 'new-commit-hook' ) ; while ( defined ( my $line = <> ) ) { $line = $auth if $line =~ /%AUTHOR%/ ; $line = pref @setup_data if $line =~ /%SETUP_DATA%/ ; $line = pref @setup_vhost if $line =~ /%SETUP_VHOST%/ ; $line = pref @setup_db if $line =~ /%SETUP_DB%/ ; $line = pref @upd_admins if $line =~ /%UPD_ADMINS%/ ; $line = pref @upd_xusers if $line =~ /%UPD_XUSERS%/ ; $line = pref @configtest if $line =~ /%CONFIGTEST%/ ; $line = pref @mk_stats if $line =~ /%MK_STATS%/ ; $line = pref @mail_watchers if $line =~ /%MAIL_WATCHERS%/ ; $line = pref @mk_guest_list if $line =~ /%MK_GUEST_LIST%/ ; $line = pref @new_hooks if $line =~ /%NEW_HOOKS%/ ; $line =~ s/%%DATE%%/$date/go ; $line =~ s/%%VERSION%%/$version/go ; $line =~ s/%%Revision%%/$revision/go ; $line =~ s/%%DIR_DATA%%/$data/go ; $line =~ s/%SECRET%/$secret/go ; print DST $line ; } close $DST ; __END__ =pod =head1 NAME repocafe - self-service for svn hosting %AUTHOR% =cut