Initial version of mercurial module
This commit is contained in:
parent
533bd88744
commit
0082372e3c
1 changed files with 42 additions and 0 deletions
42
mercurial/manifests/init.pp
Normal file
42
mercurial/manifests/init.pp
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Install Mercurial.
|
||||
#
|
||||
class mercurial::client {
|
||||
|
||||
package { "mercurial":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Clone repository.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Destination directory.
|
||||
# $source:
|
||||
# Source URL.
|
||||
# $ensure:
|
||||
# Revision. Defaults to tip.
|
||||
#
|
||||
define mercurial::clone($source, $ensure="tip") {
|
||||
|
||||
exec { "hg-clone-${name}":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
command => "hg -y clone -r ${ensure} ${source} ${name}",
|
||||
creates => "${name}",
|
||||
require => Package["mercurial"],
|
||||
}
|
||||
|
||||
exec { "hg-pull-${name}":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
cwd => "${name}",
|
||||
command => "hg -y pull -u -r ${ensure}",
|
||||
onlyif => $ensure ? {
|
||||
"tip" => "hg -y in",
|
||||
default => "test $(hg -y id -i) != ${ensure}",
|
||||
},
|
||||
require => Exec["hg-clone-${name}"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue