aboutsummaryrefslogtreecommitdiffstats
path: root/modules/subversion/manifests/init.pp
blob: f4b148dba3a54a53305fc99470756099db41b70c (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# should be replaced by vcsrepo
# https://github.com/reductivelabs/puppet-vcsrepo
# but not integrated in puppet directly for the moment
class subversion {
   class server {
        include subversion::tools

        package { "subversion-server": }
        
        $svn_base_path = '/svn/'

        xinetd::service { "svnserve":
            content => template('subversion/xinetd')
        }

        file { "$svn_base_path":
            ensure => directory,
        }

        package { ["perl-SVN-Notify-Config", "perl-SVN-Notify-Mirror"]: }
       
        $local_dir = "/usr/local/share/subversion/"
        $local_dirs = ["$local_dir/pre-commit.d", "$local_dir/post-commit.d"] 
        file { [$local_dir,$local_dirs]:
             ensure => directory,
        }

        # workaround the lack of umask command in puppet < 2.7
        local_script { "create_svn_repo.sh":
             content => template('subversion/create_svn_repo.sh') 
        }

        file { "$local_dir/pre-commit.d/no_binary":
            mode => 755,
            content => template('subversion/no_binary') 
        }

        file { "$local_dir/pre-commit.d/no_root_commit":
            mode => 755,
            content => template('subversion/no_root_commit') 
        }

        file { "$local_dir/pre-commit.d/no_empty_message":
            mode => 755,
            content => template('subversion/no_empty_message') 
        }

        file { "$local_dir/pre-commit.d/single_word_commit":
            mode => 755,
            content => template('subversion/single_word_commit') 
        }

        file { "$local_dir/pre-revprop-change":
            mode => 755,
            content => template('subversion/pre-revprop-change') 
        }

        # TODO : add check for
        #    - ym       perl -MYAML -e 'YAML::LoadFile("-");'
        #    - tt       ( do not seem to be possible, but this would be great )
        #    - php      php -l
        #    - python
        #    - named    named-checkzone/named-checkconf ( may requires some interaction with facter/erb )
        #    - po       msgfmt -c
        #    - openldap , like named

        define syntax_check($regexp_ext,$check_cmd) {
            file { "$local_dir/pre-commit.d/$name":
                mode => 755,
                content => template('subversion/syntax_check.sh') 
            }
        }


        syntax_check{"check_perl":
            regexp_ext => '\.p[lm]$',
            check_cmd => 'perl -c'
        }

        syntax_check{"check_puppet":
            regexp_ext => '\.pp$',
            check_cmd => 'puppet parser validate -'
        }

        syntax_check{"check_ruby":
            regexp_ext => '\.rb$',
            check_cmd => 'ruby -c'
        }

        syntax_check{"check_puppet_templates":
            regexp_ext => 'modules/.*/templates/.*$',
            check_cmd => 'erb -P -x -T - | ruby -c'
        }

        syntax_check{"check_po":
            regexp_ext => '\.po$',
            check_cmd => 'msgfmt -c -'
        }

        syntax_check{"check_php":
            regexp_ext => '\.php$',
            check_cmd => 'php -d display_errors=1 -d error_reporting="E_ALL|E_STRICT" -l'
        }

	# needed for check_php
        package { "php-cli": }

    }

    # TODO 
    #   deploy a cronjob to make a backup file ( ie, dump in some directory )
}