Permalink
Browse files

[CHEF-4456] Knife cookbook site share fails with Ruby 2 fix

  • Loading branch information...
zuazo committed Aug 14, 2013
1 parent 62148fe commit f39d7c9f68fa267d149ff919018789bf13112a9e
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/chef/cookbook_site_streaming_uploader.rb
@@ -208,8 +208,11 @@ def size
@parts.inject(0) {|size, part| size + part.size}
end
def read(how_much)
return nil if @part_no >= @parts.size
def read(how_much, dst_buf = nil)
if @part_no >= @parts.size
dst_buf.replace('') if dst_buf
return dst_buf
end
how_much_current_part = @parts[@part_no].size - @part_offset
@@ -228,15 +231,16 @@ def read(how_much)
@part_no += 1
@part_offset = 0
next_part = read(how_much_next_part)
current_part + if next_part
result = current_part + if next_part
next_part
else
''
end
else
@part_offset += how_much_current_part
current_part
result = current_part
end
dst_buf ? dst_buf.replace(result || '') : result
end
end

0 comments on commit f39d7c9

Please sign in to comment.