Added initial version of svn module.
This commit is contained in:
parent
b08986eb37
commit
92bbdc0799
1 changed files with 50 additions and 0 deletions
50
svn/manifests/init.pp
Normal file
50
svn/manifests/init.pp
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Install svn client tools.
|
||||
#
|
||||
class svn::client {
|
||||
|
||||
package { "subversion":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Checkout working copy.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Destination directory.
|
||||
# $source:
|
||||
# Source URL.
|
||||
# $revision:
|
||||
# Revision. Defaults to HEAD.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# svn::checkout { "/usr/local/src/graphingwiki":
|
||||
# source => "http://svn.graphingwiki.webfactional.com/trunk",
|
||||
# revision => "1959",
|
||||
# }
|
||||
#
|
||||
define svn::checkout($source, $revision="HEAD") {
|
||||
|
||||
exec { "svn-co-${name}":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
command => "svn checkout --non-interactive -r ${revision} ${source} ${name}",
|
||||
unless => "test -d ${name}",
|
||||
require => Package["subversion"],
|
||||
}
|
||||
|
||||
exec { "svn-up-${name}":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
cwd => "${name}",
|
||||
command => "svn update --non-interactive -r ${revision}",
|
||||
onlyif => $revision ? {
|
||||
"HEAD" => "svn status --non-interactive -q -u 2>&1 | egrep '^[[:space:]]+\\*'",
|
||||
default => "test $(svn info --non-interactive 2>&1 | awk '/^Revision:/ { print \$2 }') != ${revision}",
|
||||
},
|
||||
require => Exec["svn-co-${name}"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue