1 require "chef/mixin/shell_out"
6 extend Chef::Mixin::ShellOut
9 if current_repository_matches_target_repository?
10 c = scm :update, new_resource.svn_arguments, verbose, authentication, proxy, "-r#{revision_int}", new_resource.destination
11 Chef::Log.debug "#{new_resource} updated working copy #{new_resource.destination} to revision #{new_resource.revision}"
13 c = scm :switch, new_resource.svn_arguments, verbose, authentication, proxy, "-r#{revision_int}", new_resource.repository, new_resource.destination
14 Chef::Log.debug "#{new_resource} updated working copy #{new_resource.destination} to #{new_resource.repository} revision #{new_resource.revision}"
19 def current_repository
20 @current_repository ||= repo_attrs["URL"]
23 def current_repository_matches_target_repository?
24 !current_repository.nil? && (new_resource.repository == current_repository)
28 return {} unless ::File.exist?(::File.join(new_resource.destination, ".svn"))
30 @repo_attrs ||= svn_info.lines.each_with_object({}) do |line, attrs|
31 next unless line =~ SVN_INFO_PATTERN
33 property = Regexp.last_match[1]
34 value = Regexp.last_match[2]
35 attrs[property] = value
38 raise "Could not parse `svn info` data: #{svn_info}" if @repo_attrs.empty?
45 shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout