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 has_features :filesystem_types, :reference_tracking, :basic_auth
12 if !@resource.value(:source)
13 create_repository(@resource.value(:path))
15 checkout_repository(@resource.value(:source),
16 @resource.value(:path),
17 @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)[/^Last Changed Rev:\s+(\d+)/m, 1]
62 args = buildargs.push('info')
64 svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
68 def revision=(desired)
69 args = buildargs.push('update', '-r', desired)
78 def checkout_repository(source, path, revision)
79 args = buildargs.push('checkout')
81 args.push('-r', revision)
83 args.push(source, path)
87 def create_repository(path)
89 if @resource.value(:fstype)
90 args.push('--fs-type', @resource.value(:fstype))
97 if @resource.value(:owner) or @resource.value(:group)