From 22b50aa52fc3167415af08d0e6ee0cbbeb35e833 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 19 Mar 2012 19:51:44 +0000 Subject: split pre_commit and post_commit in separate file, and simplify the layout, by renaming commit_hook to hook directly --- modules/subversion/manifests/hook.pp | 31 ++++++------------------ modules/subversion/manifests/hook/post_commit.pp | 6 +++++ modules/subversion/manifests/hook/pre_commit.pp | 6 +++++ 3 files changed, 19 insertions(+), 24 deletions(-) create mode 100644 modules/subversion/manifests/hook/post_commit.pp create mode 100644 modules/subversion/manifests/hook/pre_commit.pp (limited to 'modules/subversion') diff --git a/modules/subversion/manifests/hook.pp b/modules/subversion/manifests/hook.pp index 5a347573..08b626ad 100644 --- a/modules/subversion/manifests/hook.pp +++ b/modules/subversion/manifests/hook.pp @@ -1,26 +1,9 @@ -class subversion { - class hook { - define post_commit($content) { - commit_hook { $name: - content => $content, - type => "post-commit", - } - } - define pre_commit($content) { - commit_hook { $name: - content => $content, - type => "pre-commit", - } - } - - define commit_hook($content, $type) { - $array = split($name,'\|') - $repo = $array[0] - $script = $array[1] - file { "$repo/hooks/$type.d/$script": - content => $content, - mode => 755, - } - } +define subversion::hook($content, $type) { + $array = split($name,'\|') + $repo = $array[0] + $script = $array[1] + file { "$repo/hooks/$type.d/$script": + content => $content, + mode => '0755', } } diff --git a/modules/subversion/manifests/hook/post_commit.pp b/modules/subversion/manifests/hook/post_commit.pp new file mode 100644 index 00000000..90d939cd --- /dev/null +++ b/modules/subversion/manifests/hook/post_commit.pp @@ -0,0 +1,6 @@ +define subversion::hook::post_commit($content) { + hook { $name: + content => $content, + type => 'post-commit', + } +} diff --git a/modules/subversion/manifests/hook/pre_commit.pp b/modules/subversion/manifests/hook/pre_commit.pp new file mode 100644 index 00000000..fa44b168 --- /dev/null +++ b/modules/subversion/manifests/hook/pre_commit.pp @@ -0,0 +1,6 @@ +define subversion::hook::pre_commit($content) { + hook { $name: + content => $content, + type => 'pre-commit', + } +} -- cgit v1.2.1