lib/rake/funnel/tasks/zip.rb in rake-funnel-0.0.4.pre vs lib/rake/funnel/tasks/zip.rb in rake-funnel-0.0.5.pre
- old
+ new
@@ -51,12 +51,19 @@
common_path = files.common_path
files.each do |file|
zipped_file = get_zipped_path(common_path, file)
- zip.add(zipped_file, file)
+ entry = zip.add(zipped_file, file)
+ set_mtime(entry, file)
end
end
+ end
+
+ # To work around this bug: https://github.com/rubyzip/rubyzip/issues/176
+ def set_mtime(entry, file)
+ entry.time = ::Zip::DOSTime.at(File.mtime(file))
+ entry.extra.delete('UniversalTime')
end
def get_zipped_path(common_path, file)
file = Pathname.new(file).relative_path_from(Pathname.new(common_path)).to_s unless common_path.nil?
file = File.join(zip_root, file) unless zip_root.nil? || zip_root.empty?