Skip to content

Commit

Permalink
[COOK-3542] Fixed zip bug related to breaking changes in rubyzip gem
Browse files Browse the repository at this point in the history
  • Loading branch information
torresdal committed Sep 5, 2013
1 parent b86b10c commit 453ef82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions providers/zipfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ensure_rubyzip_gem_installed
Chef::Log.debug("unzip #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})")

Zip::ZipFile.open(cached_file(@new_resource.source, @new_resource.checksum)) do |zip|
Zip::File.open(cached_file(@new_resource.source, @new_resource.checksum)) do |zip|
zip.each do |entry|
path = ::File.join(@new_resource.path, entry.name)
FileUtils.mkdir_p(::File.dirname(path))
Expand Down Expand Up @@ -57,7 +57,7 @@
end
# only supporting compression of a single directory (recursively).
if ::File.directory?(@new_resource.source)
z = Zip::ZipFile.new(@new_resource.path, true)
z = Zip::File.new(@new_resource.path, true)
unless @new_resource.source =~ /::File::ALT_SEPARATOR$/
@new_resource.source << ::File::ALT_SEPARATOR
end
Expand All @@ -80,12 +80,12 @@
private
def ensure_rubyzip_gem_installed
begin
require 'zip/zip'
require 'zip'
rescue LoadError
Chef::Log.info("Missing gem 'rubyzip'...installing now.")
chef_gem "rubyzip" do
version node['windows']['rubyzipversion']
end
require 'zip/zip'
require 'zip'
end
end

0 comments on commit 453ef82

Please sign in to comment.