Fixed #76 by updating to Rubyzip 1.1.7.

This commit is contained in:
Sebastian Ludwig 2015-11-27 17:37:41 +01:00
parent c5286a4979
commit 8815c095d8
2 changed files with 16 additions and 14 deletions

View file

@ -148,18 +148,14 @@ module Twine
end
def generate_loc_drop
begin
require 'zip/zip'
rescue LoadError
raise Twine::Error.new "You must run 'gem install rubyzip' in order to create or consume localization drops."
end
require_rubyzip
if File.file?(@options[:output_path])
File.delete(@options[:output_path])
end
Dir.mktmpdir do |dir|
Zip::ZipFile.open(@options[:output_path], Zip::ZipFile::CREATE) do |zipfile|
Zip::File.open(@options[:output_path], Zip::File::CREATE) do |zipfile|
zipfile.mkdir('Locales')
formatter = formatter_for_format(@options[:format])
@ -177,18 +173,14 @@ module Twine
end
def consume_loc_drop
require_rubyzip
if !File.file?(@options[:input_path])
raise Twine::Error.new("File does not exist: #{@options[:input_path]}")
end
begin
require 'zip/zip'
rescue LoadError
raise Twine::Error.new "You must run 'gem install rubyzip' in order to create or consume localization drops."
end
Dir.mktmpdir do |dir|
Zip::ZipFile.open(@options[:input_path]) do |zipfile|
Zip::File.open(@options[:input_path]) do |zipfile|
zipfile.each do |entry|
if !entry.name.end_with?'/' and !File.basename(entry.name).start_with?'.'
real_path = File.join(dir, entry.name)
@ -289,5 +281,15 @@ module Twine
return
end
private
def require_rubyzip
begin
require 'zip'
rescue LoadError
raise Twine::Error.new "You must run 'gem install rubyzip' in order to create or consume localization drops."
end
end
end
end

View file

@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.test_files = Dir.glob("test/test_*")
s.required_ruby_version = ">= 1.8.7"
s.add_runtime_dependency('rubyzip', "~> 0.9.5")
s.add_runtime_dependency('rubyzip', "~> 1.1.7")
s.add_runtime_dependency('safe_yaml', "~> 1.0.3")
s.add_development_dependency('rake', "~> 0.9.2")
s.add_development_dependency('minitest', "> 5.5")