package SVN::Hooks::Notify::Config;

use strict;
use warnings;
use SVN::Hooks;

use Exporter qw/import/;
my $HOOK = 'NOTIFY_CONFIG';
our @EXPORT = qw/NOTIFY_CONFIG/;

our $VERSION = $SVN::Hooks::VERSION;




sub NOTIFY_CONFIG {
    my $conf = $SVN::Hooks::Confs->{$HOOK};
    $conf->{option} = shift;
    $conf->{'post-commit'} = \&post_commit;
    return 1;
};

$SVN::Hooks::Inits{$HOOK} = sub {
    return { option => undef };
};

sub post_commit {
  my ($self, $svnlook) = @_;

  require SVN::Notify::Config;

  my $opt_set = $self->{option};
  my $notifier = SVN::Notify::Config->new(
					  $opt_set,
					 );
  $notifier->prepare;
  $notifier->execute(
		     repos_path => $svnlook->repo(),
		     revision   => $svnlook->rev(),
		    );
  return;
}



1; # End of SVN::Hooks::Notify
