diff options
-rw-r--r-- | lib/puppet/provider/vcsrepo/svn.rb | 19 | ||||
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/svn_spec.rb | 1 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/puppet/provider/vcsrepo/svn.rb b/lib/puppet/provider/vcsrepo/svn.rb index 7485ff5..3132c36 100644 --- a/lib/puppet/provider/vcsrepo/svn.rb +++ b/lib/puppet/provider/vcsrepo/svn.rb @@ -4,7 +4,8 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) desc "Supports Subversion repositories" optional_commands :svn => 'svn', - :svnadmin => 'svnadmin' + :svnadmin => 'svnadmin', + :svnlook => 'svnlook' has_features :filesystem_types, :reference_tracking, :basic_auth, :configuration @@ -20,7 +21,13 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) end def working_copy_exists? - File.directory?(File.join(@resource.value(:path), '.svn')) + if File.directory?(@resource.value(:path)) + # :path is an svn checkout + return true if File.directory?(File.join(@resource.value(:path), '.svn')) + # :path is an svn server + return true if svnlook('uuid', @resource.value(:path)) + end + false end def exists? @@ -33,11 +40,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) def latest? at_path do - if self.revision < self.latest then - return false - else - return true - end + self.revision >= self.latest end end @@ -57,7 +60,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) args.push('--config-dir', @resource.value(:configuration)) end - return args + args end def latest diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb index 75d58f9..a533b7c 100644 --- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb @@ -49,6 +49,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do describe "checking existence" do it "should check for the directory" do + expects_directory?(true, resource.value(:path)) expects_directory?(true, File.join(resource.value(:path), '.svn')) provider.exists? end |