SVN::Hooks::UpdateConfFile.3pm

Langue: en

Autres versions - même langue

Version: 2010-01-07 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

SVN::Hooks::UpdateConfFile - Maintain the repository configuration versioned.

SYNOPSIS

This SVN::Hooks plugin allows you to maintain the repository configuration files under version control.

The repository configuration is usually kept in the directory "conf" under the directory where the repository was created. In a brand new repository you see there the files "authz", "passwd", and "svnserve.conf". It's too bad that these important files are usually kept out of any version control system. This plugin tries to solve this problem allowing you to keep these files versioned under the same repository where they are used.

It's active in the "pre-commit" and the "post-commit" hooks.

It's configured by the following directive.

UPDATE_CONF_FILE(FROM, TO, @ARGS)

This directive tells that after a successful commit the file FROM, kept under version control, must be copied to TO.

FROM can be a string or a qr/Regexp/ specifying the file path relative to the repository's root (e.g. ``trunk/src/version.c'').

TO is a path relative to the "/repo/conf" directory in the server. It can be an explicit file name or a directory, in which case the basename of FROM is used as the name of the destination file.

If FROM is a qr/Regexp/ TO is evaluated as a string in order to allow for the interpolation of capture buffers from the regular expression. This is useful to map the copy operation to a diferent directory structure, for example.

The optional @ARGS must be a sequence of pairs like these:

validator => ARRAY or CODE
A validator is a function or a command (specified by an array of strings that will be passed to the shell) that will check the contents of FROM in the pre-commit hook to see if it's valid. If there is no validator, the contents are considered valid.

The function receives two string arguments: the contents of FROM and the relative path to FROM.

The command is called with two arguments: the path to a temporary copy of FROM and the relative path to FROM.

generator => ARRAY or CODE
A generator is a function or a command (specified by an array of strings that will be passed to the shell) that will transform the contents of FROM in the post-commit hook before copying it to TO. If there is no generator, the contents are copied as is.

The function receives two string arguments: the contents of FROM and the relative path to FROM.

The command is called with two arguments: the path to a temporary copy of FROM and the relative path to FROM.

actuator => ARRAY or CODE
An actuator is a function or a command (specified by an array of strings that will be passed to the shell) that will be invoked after a successful commit of FROM in the post-commit hook.

The function receives two string arguments: the contents of FROM and the relative path to FROM.

The command is called with two arguments: the path to a temporary copy of FROM and the relative path to FROM.

rotate => NUMBER
By default, after each successful commit the TO file is overwriten by the new contents of FROM. With this option, the last NUMBER versions of TO are kept on disk with numeric suffixes ranging from .0 to ".NUMBER-1". This can be useful, for instance, in case you manage to commit a wrong authz file that denies any subsequent commit.
         UPDATE_CONF_FILE(
             'conf/authz' => 'authz',
             validator    => ['/usr/local/bin/svnauthcheck'],
             generator    => ['/usr/local/bin/authz-expand-includes'],
             actuator     => ['/usr/local/bin/notify-auth-change'],
             rotate       => 2,
         );
 
         UPDATE_CONF_FILE(
             'conf/svn-hooks.conf' => 'svn-hooks.conf',
             validator    => [qw(/usr/bin/perl -c)],
             actuator     => sub {
                                 my ($contents, $file) = @_;
                                 die "Can't use Gustavo here." if $contents =~ /gustavo/;
                             },
             rotate       => 2,
         );
 
         UPDATE_CONF_FILE(
             qr:/file(\n+)$:' => 'subdir/$1/file',
             rotate       => 2,
         );
 
 

AUTHOR

Gustavo Chaves, "<gnustavo@cpan.org>"

BUGS

Please report any bugs or feature requests to "bug-svn-hooks-updaterepofile at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Hooks>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.
     perldoc SVN::Hooks
 
 

You can also look for information at:

RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Hooks>

AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/SVN-Hooks>

CPAN Ratings

<http://cpanratings.perl.org/d/SVN-Hooks>

Search CPAN

<http://search.cpan.org/dist/SVN-Hooks>

Copyright 2008-2009 CPqD, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.