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