-
Notifications
You must be signed in to change notification settings - Fork 319
Open
Description
Gems that include rubyzip
conflict with gems that include zip
since both call their main module Zip
. A way to separate the two is absolutely necessary if we want to avoid dirty hackery to the tune of:
unless ::Object.const_defined?(:RubyZip, false) if ::Object.const_defined?(:Zip, false) then if ::Zip.const_defined?(:File, false) then puts "DEBUG: RubyZip detected" ::RubyZip = ::Zip else puts "DEBUG: Conflicting Zip detected" zip_backup = ::Zip ::Zip = nil require 'rubygems' gem 'rubyzip', :require => 'zip' ::RubyZip = ::Zip ::Zip = zip_backup end else puts "DEBUG: Zip not detected at all" require 'rubygems' gem 'rubyzip', :require => 'zip' ::RubyZip = ::Zip end end
Note that the main include file should also be renamed to rubyzip.rb
, otherwise loading the right gem also turns into a Russian roulette game.
KitaitiMakoto, tronable1, vsppedro, antoinesaliba, slondr and 1 more
Metadata
Metadata
Assignees
Labels
No labels