Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit ff1e3443eb97691261df91c034383f597729f9c1 @ohadlevy ohadlevy committed with ohadlevy Feb 29, 2012
Showing with 36 additions and 0 deletions.
  1. +4 −0 manifests/init.pp
  2. +3 −0 manifests/install.pp
  3. +7 −0 manifests/params.pp
  4. +22 −0 manifests/repo.pp
@@ -0,0 +1,4 @@
+class git {
+ include git::params
+ include git::install
+}
@@ -0,0 +1,3 @@
+class git::install {
+ package {$git::params::pkg: ensure => installed }
+}
@@ -0,0 +1,7 @@
+class git::params {
+ $bin = '/usr/bin/git'
+ $pkg = $::operatingsystem ? {
+ /(Debian|Ubuntu)/ => ['git-core'],
+ default => ['git'],
+ }
+}
@@ -0,0 +1,22 @@
+define git::repo($target, $bare = false, $source = false, $user = 'root') {
+
+ if $source {
+ $cmd = "${git::params::bin} clone $source $target --recursive"
+ } else {
+ if $bare {
+ $cmd = "${git::params::bin} init --bare $target"
+ } else {
+ $cmd = "${git::params::bin} init $target"
+ }
+ }
+
+ exec { "git_repo_for_${name}":
+ command => $cmd,
+ creates => $bare ? {
+ true => "${target}/objects",
+ false => $target,
+ },
+ require => Class['git::install'],
+ user => $user
+ }
+}

0 comments on commit ff1e344

Please sign in to comment.