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 optional_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))
23 def working_copy_exists?
24 File.directory?(File.join(@resource.value(:path), '.svn'))
32 FileUtils.rm_rf(@resource.value(:path))
37 if self.revision < self.latest then
46 args = ['--non-interactive']
47 if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password)
48 args.push('--username', @resource.value(:basic_auth_username))
49 args.push('--password', @resource.value(:basic_auth_password))
50 args.push('--no-auth-cache')
56 args = buildargs.push('info', '-r', 'HEAD')
58 svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
63 args = buildargs.push('info')
65 svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
69 def revision=(desired)
70 args = buildargs.push('update', '-r', desired)
79 def checkout_repository(source, path, revision)
80 args = buildargs.push('checkout')
82 args.push('-r', revision)
84 args.push(source, path)
88 def create_repository(path)
90 if @resource.value(:fstype)
91 args.push('--fs-type', @resource.value(:fstype))
98 if @resource.value(:owner) or @resource.value(:group)