1 |
define git::svn_repository( $source, |
2 |
$std_layout = true, |
3 |
$refresh = '*/5') { |
4 |
include git::svn |
5 |
include git::server |
6 |
# a cron job |
7 |
# a exec |
8 |
if $std_layout { |
9 |
$options = '-s' |
10 |
} else { |
11 |
$options = '' |
12 |
} |
13 |
|
14 |
exec { "/usr/bin/git svn init $options $source $name": |
15 |
alias => "git svn $name", |
16 |
creates => $name, |
17 |
} |
18 |
|
19 |
file { '/usr/local/bin/update_git_svn.sh': |
20 |
mode => '0755', |
21 |
source => 'puppet:///modules/git/update_git_svn.sh', |
22 |
} |
23 |
|
24 |
cron { "update $name": |
25 |
# done in 2 times, so fetch can fill the repo after init |
26 |
command => "/usr/local/bin/update_git_svn.sh $name" , |
27 |
minute => $refresh |
28 |
} |
29 |
|
30 |
file { "$name/.git/hooks/pre-receive": |
31 |
mode => '0755', |
32 |
content => template('git/pre-receive'), |
33 |
require => Exec["git svn $name"] |
34 |
} |
35 |
} |