Skip to content

Commit

Permalink
modififed after review
Browse files Browse the repository at this point in the history
  • Loading branch information
thanizebra committed May 18, 2015
1 parent 4bfc182 commit b8d00da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 0 additions & 8 deletions Rakefile
Expand Up @@ -1418,14 +1418,6 @@ def wait_and_get_build(app_id, build_id, proxy, save_to = nil, unzip_to = nil)
if is_ok
if !(unzip_to.nil? || unzip_to.empty?)
if (status == "completed")
#TODO: this is Jake Error, remove this ,once Rhodes framework upgraded to ruby 2.3 with default zip support
require 'zip'
dir_names = Zip::File.open(result_link).collect {|e| File.dirname(e.name)}.uniq-["."]
dir_names.collect {|e|
full_name = File.join(unzip_to,e)
Dir.mkdir(full_name) unless Dir.exists?(full_name)
}

Jake.unzip(result_link, unzip_to) do |a,b,msg|
put_message_with_timestamp("Current status: #{msg}", true)
end
Expand Down
4 changes: 3 additions & 1 deletion lib/build/jake.rb
Expand Up @@ -724,6 +724,7 @@ def self.build_file_map(dir, file_name, in_memory = false)
# @param block [block, optional] Block code will be called before each file entry extracting and it's parameters are: file entry size in bytes, archive total size in bytes, string like "Unpacking files: NN%" where NN% - unzipping progress in percents
def self.unzip(src_zip, dest_dir)
require 'zip'
require 'fileutils'

unless File.exist?(dest_dir)
FileUtils.mkdir_p(dest_dir)
Expand All @@ -740,7 +741,8 @@ def self.unzip(src_zip, dest_dir)
unzipped_bytes = unzipped_bytes + entry.size
yield(unzipped_bytes, total_bytes, "Unpacking files: #{(unzipped_bytes * 100) / total_bytes}%")
end

file_dir_name = File.join(dest_dir,File.dirname(entry.name))
FileUtils::mkdir_p file_dir_name unless Dir.exists?(file_dir_name)
entry.extract(File.join(dest_dir, entry.name))

end
Expand Down

0 comments on commit b8d00da

Please sign in to comment.