1 Puppet::Type.type(:vcsrepo).provide(:svn) do
2 desc "Supports Subversion repositories"
4 commands :svn => 'svn',
5 :svnadmin => 'svnadmin'
8 if !@resource.value(:source)
9 create_repository(@resource.value(:path))
11 checkout_repository(@resource.value(:source),
12 @resource.value(:path),
13 @resource.value(:revision))
18 File.directory?(@resource.value(:path))
22 FileUtils.rm_rf(@resource.value(:path))
27 svn('info')[/^Revision:\s+(\d+)/m, 1]
31 def revision=(desired)
33 svn('update', '-r', desired)
39 def checkout_repository(source, path, revision = nil)
42 args.push('-r', revision)
44 args.push(source, path)
48 def create_repository(path)
50 if @resource.value(:fstype)
51 args.push('--fs-type', @resource.value(:fstype))
59 git('reset', '--hard', desired)
63 # Note: We don't rely on Dir.chdir's behavior of automatically returning the
64 # value of the last statement -- for easier stubbing.
65 def at_path(&block) #:nodoc:
67 Dir.chdir(@resource.value(:path)) do