aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/manifests/init.pp
blob: 46760af3ba1187cea2a0476cb8d23ee4d8df2391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class git {
    define svn_repository($source,
                          $std_layout = true,
                          $refresh = '*/5') {
        include git::svn
        include git::server
        # a cron job
        # a exec
        if $std_layout {
            $options = '-s'
        } else {
            $options =  ''
        }

        exec { "/usr/bin/git svn init $options $source $name":
            alias   => "git svn $name",
            creates => $name,
        }

        file { '/usr/local/bin/update_git_svn.sh':
            mode   => '0755',
            source => 'puppet:///modules/git/update_git_svn.sh',
        }

        cron { "update $name":
            # done in 2 times, so fetch can fill the repo after init
            command => "/usr/local/bin/update_git_svn.sh $name" ,
            minute  => $refresh
        }

        file { "$name/.git/hooks/pre-receive":
            mode    => '0755',
            content => template('git/pre-receive'),
            require => Exec["git svn $name"]
        }
    }

}