1 require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
3 Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) do
4 desc "Supports Subversion repositories"
6 commands :svn => 'svn',
7 :svnadmin => 'svnadmin'
9 defaultfor :svn => :exists
10 has_features :filesystem_types, :reference_tracking, :basic_auth
13 if !@resource.value(:source)
14 create_repository(@resource.value(:path))
16 checkout_repository(@resource.value(:source),
17 @resource.value(:path),
18 @resource.value(:revision))
22 def working_copy_exists?
23 File.directory?(File.join(@resource.value(:path), '.svn'))
31 FileUtils.rm_rf(@resource.value(:path))
36 if self.revision < self.latest then
45 args = ['--non-interactive']
46 if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password)
47 args.push('--username', @resource.value(:basic_auth_username))
48 args.push('--password', @resource.value(:basic_auth_password))
49 args.push('--no-auth-cache')
55 args = buildargs.push('info', '-r', 'HEAD')
57 svn(*args)[/^Revision:\s+(\d+)/m, 1]
62 args = buildargs.push('info')
64 svn(*args)[/^Revision:\s+(\d+)/m, 1]
68 def revision=(desired)
69 args = buildargs.push('update', '-r', desired)
77 def checkout_repository(source, path, revision)
78 args = buildargs.push('checkout')
80 args.push('-r', revision)
82 args.push(source, path)
86 def create_repository(path)
88 if @resource.value(:fstype)
89 args.push('--fs-type', @resource.value(:fstype))