App-KGB
view release on metacpan or search on metacpan
+ Document web-link configuration via git-config.
* Client:
+ Add a few checks on the configuration file.
+ Add --man and --help command-line options.
+ Fix validation of --single-line-commits argument.
+ Support web-link option via git configuration.
* Server:
+ Avoid responding to senders having .bot. in their hostname.
+ change default port to 5391. Closes Debian bug #691562 -- port conflict
with approx.
+ kgb-add-project: chown/chmod config (snippet) like kgb.conf.
+ Use asterisk for web link separator (used also for commit message
separator).
+ Explicitly check and die if included conf file doesn't exist.
+ Put URL on first line of multi-line notifications.
+ Put back SVN in requirements now that Module::Build is fixed. See
https://rt.cpan.org/Public/Bug/Display.html?id=59593
1.23 2012-10-20
* t/compile*: use Test::Compile::Internal in order to show verbose errors
* Server:
eg/setup-test-git-env.sh view on Meta::CPAN
mkdir $ROOT/git-test/repo.git
cd $ROOT/git-test/repo.git
git init --bare
cat <<EOF > $ROOT/git-test/repo.git/hooks/post-receive
#!/bin/sh
tee -a $ROOT/git-test/reflog | PERL5LIB=$ROOT/lib $ROOT/script/kgb-client --repository git --uri http://localhost:9999 --pass "truely secret" --repo-id test --git-reflog -
EOF
chmod 0755 $ROOT/git-test/repo.git/hooks/post-receive
mkdir $ROOT/git-test/work
cd $ROOT/git-test/work
echo "testing" > a
git init
git add a
git commit -m "initial import"
git remote add origin file://$ROOT/git-test/repo.git
git config --add branch.master.remote origin
git config --add branch.master.merge refs/heads/master
t/50-client.t view on Meta::CPAN
my $R = getcwd;
my $client_script = $ENV{KGB_CLIENT_SCRIPT} || "$R/script/kgb-client";
my $ccf = $test_bot->client_config_file;
open my $fh, '>', "$repo/hooks/post-commit";
print $fh <<EOF;
#!/bin/sh
PERL5LIB=$R/lib $^X -- $client_script --conf $ccf \$1 \$2 >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, "$repo/hooks/post-commit";
}
# duplicate, talking to a different bot, connected to IRC
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
my $R = getcwd;
my $h;
open $h, '>>', "$repo/hooks/post-commit";
print $h <<"EOF";
t/52-client-git.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook);
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf
EOF
close $fh;
t/53-client-git-merges.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook );
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf --status-dir $dir
EOF
close $fh;
t/54-client-git-squash.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook );
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf --status-dir $dir
EOF
close $fh;
t/55-client-git-merges-ff.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook );
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf --status-dir $dir
EOF
close $fh;
t/56-client-git-ff-merge-2.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook );
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf --status-dir $dir
EOF
close $fh;
t/57-client-git-squash-tags.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook );
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf --status-dir $dir
EOF
close $fh;
t/58-client-git-unicode.t view on Meta::CPAN
# the real test client
{
my $ccf = $test_bot->client_config_file;
open my $fh, '>', $hook;
print $fh <<EOF;
#!/bin/sh
tee -a "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $ccf >> $hook_log 2>&1
EOF
close $fh;
chmod 0755, $hook;
}
if ( $ENV{TEST_KGB_BOT_RUNNING} ) {
diag "will try to send notifications to locally running bot";
open( my $fh, '>>', $hook);
print $fh <<"EOF";
cat "$dir/reflog" | PERL5LIB=$R/lib $^X -- $client_script --conf $R/eg/test-client.conf
EOF
close $fh;
t/TestBot.pm view on Meta::CPAN
network: dummy
repos:
- test
log_file: $dir/kgb-bot.log
webhook:
enabled: 1
allowed_networks:
- $addr
short_url_service: DummyShortener
EOF
chmod 0600, $fh;
close($fh);
my $bot_script =
$ENV{KGB_BOT_SCRIPT} || File::Spec->catfile( 'script', 'kgb-bot' );
my $t_dir = File::Spec->catdir(getcwd, 't');
my $dirs = $ENV{PERL5LIB};
if ($dirs) { $dirs .= ":$t_dir" }
else { $dirs = $t_dir }
$ENV{PERL5LIB} = $dirs;
( run in 0.366 second using v1.01-cache-2.11-cpan-496ff517765 )