diff --git a/lib/gepub/book.rb b/lib/gepub/book.rb index d003ba6..40ff37f 100644 --- a/lib/gepub/book.rb +++ b/lib/gepub/book.rb @@ -102,14 +102,14 @@ def self.parse(io) package = nil package_path = nil book = nil - Zip::File.open_buffer(io) { + Zip::File.open_buffer(io) do |zip_file| package, package_path = parse_container(zip_file, files) check_consistency_of_package(package, package_path) parse_files_into_package(files, package) book = Book.new(package.path) book.instance_eval { @package = package; @optional_files = files } - } + end book end diff --git a/spec/gepub_spec.rb b/spec/gepub_spec.rb index 2714bc5..4015157 100644 --- a/spec/gepub_spec.rb +++ b/spec/gepub_spec.rb @@ -2,6 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper.rb' require 'rubygems' require 'nokogiri' +require 'rbconfig' describe GEPUB::Item do it "should return atttributes" do @@ -79,7 +80,12 @@ end after do - FileUtils.remove_entry_secure @tempdir + if RbConfig::CONFIG['host_os'] =~ /mswin/ + # workaround; rubyzip opened files could not be deleted with remove_entry_secure on windows. + FileUtils.rm_rf @tempdir + else + FileUtils.remove_entry_secure @tempdir + end end it "should have title" do