blob: 7616f418c1efb3c92c93021ed03f883b2d490c55 (
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
|
require 'pathname'
Puppet::Type.newtype(:vcsrepo) do
desc "A local version control repository"
ensurable do
defaultvalues
newvalue :bare do
provider.create
end
def retrieve
prov = @resource.provider
if prov
if prov.respond_to?(:bare_exists?)
if prov.respond_to?(:working_copy_exists?) && prov.working_copy_exists?
:present
elsif prov.respond_to?(:bare_exists?) && prov.bare_exists?
:bare
else
:absent
end
else
if prov.exists?
:present
else
:absent
end
end
else
:absent
end
end
end
newparam(:path) do
desc "Absolute path to repository"
isnamevar
validate do |value|
path = Pathname.new(value)
unless path.absolute?
raise ArgumentError, "Path must be absolute: #{path}"
end
end
end
newparam(:source) do
desc "The source URI for the repository"
end
newparam(:fstype) do
desc "Filesystem type (for providers that support it, eg subversion)"
end
newproperty(:revision) do
desc "The revision of the repository"
newvalue(/^\S+$/)
end
newparam :compression do
desc "Compression level (used by CVS)"
validate do |amount|
unless Integer(amount).between?(0, 6)
raise ArgumentError, "Unsupported compression level: #{amount} (expected 0-6)"
end
end
end
end
|