Skip to content

Instantly share code, notes, and snippets.

@chrisroberts
Forked from webframp/copy_cached_repo.rb
Created November 2, 2012 18:19
Show Gist options
  • Save chrisroberts/4003339 to your computer and use it in GitHub Desktop.
Save chrisroberts/4003339 to your computer and use it in GitHub Desktop.
copy_cached_repo.rb
unless(Chef::Provider::Deploy.instance_methods.map(&:to_sym).include?(:copy_command))
Chef::Log.info '** Patching deploy resource copy method to use rsync **'
class Chef::Provider::Deploy
def copy_cached_repo
target_dir_path = @new_resource.deploy_to + "/releases"
converge_by("deploy from repo to #{@target_dir_path} ") do
FileUtils.mkdir_p(target_dir_path)
run_command(:command => "rsync -a --exclude '.git*' #{::File.join(@new_resource.destination, ".")}/ #{release_path}"
Chef::Log.info "#{@new_resource} copied the cached checkout to #{release_path}"
release_created(release_path)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment