Skip to content

Commit

Permalink
trying to upgrade zip plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Tesinsky authored and Jakub Tesinsky committed Jun 10, 2014
1 parent 6168b56 commit 0e98b8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/rspreadsheet/workbook.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'zip/zipfilesystem'
require 'zip'
require 'libxml'

module Rspreadsheet
Expand All @@ -9,7 +9,7 @@ def initialize afilename=nil
@filename = afilename
if filename.nil?
else
@content_xml = Zip::ZipFile.open(filename) do |zip|
@content_xml = Zip::File.open(filename) do |zip|
LibXML::XML::Document.io zip.get_input_stream('content.xml')
end

Expand All @@ -29,7 +29,7 @@ def save(new_filename=nil)
FileUtils.cp(@filename || './lib/rspreadsheet/empty_file_template.ods', new_filename)
@filename = new_filename
end
Zip::ZipFile.open(@filename) do |zip|
Zip::File.open(@filename) do |zip|
# it is easy, because @content_xml in in sync with contents all the time
zip.get_output_stream('content.xml') do |f|
f.write @content_xml
Expand Down
8 changes: 4 additions & 4 deletions spec/rspreadsheet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
book.save(tmp_filename) # and save it as temp file

# now compare them
@content_xml1 = Zip::ZipFile.open($test_filename) do |zip|
@content_xml1 = Zip::File.open($test_filename) do |zip|
LibXML::XML::Document.io zip.get_input_stream('content.xml')
end
@content_xml2 = Zip::ZipFile.open(tmp_filename) do |zip|
@content_xml2 = Zip::File.open(tmp_filename) do |zip|
LibXML::XML::Document.io zip.get_input_stream('content.xml')
end
@content_doc1.eql?(@content_doc2).should == true
Expand All @@ -54,10 +54,10 @@
book.save(tmp_filename) # and save it as temp file

# now compare them
@content_doc1 = Zip::ZipFile.open($test_filename) do |zip|
@content_doc1 = Zip::File.open($test_filename) do |zip|
LibXML::XML::Document.io zip.get_input_stream('content.xml')
end
@content_doc2 = Zip::ZipFile.open(tmp_filename) do |zip|
@content_doc2 = Zip::File.open(tmp_filename) do |zip|
LibXML::XML::Document.io zip.get_input_stream('content.xml')
end
@content_doc1.eql?(@content_doc2).should == false
Expand Down

0 comments on commit 0e98b8c

Please sign in to comment.