Module: Selenium::WebDriver::Zipper Private
- Defined in:
- rb/lib/selenium/webdriver/common/zipper.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- EXTENSIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[.zip .xpi].freeze
- RUBYZIP_V3 =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Zip::VERSION >= '3.0.0'
Class Method Summary collapse
- .unzip(path) ⇒ Object private
- .zip(path) ⇒ Object private
-
.zip_root(path) ⇒ Object
(also: zip_file)
private
Keeps
path(a file or directory) as the archive's single top-level entry, unlike #zip which flattens a directory's contents; the Grid upload endpoint returns that one entry's path.
Class Method Details
.unzip(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'rb/lib/selenium/webdriver/common/zipper.rb', line 37 def unzip(path) destination = Dir.mktmpdir('webdriver-unzip') FileReaper << destination Zip::File.open(path) do |zip| zip.each do |entry| to = File.join(destination, entry.name) dirname = File.dirname(to) FileUtils.mkdir_p dirname if RUBYZIP_V3 zip.extract(entry, entry.name, destination_directory: destination) else zip.extract(entry, to) end end end destination end |
.zip(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 |
# File 'rb/lib/selenium/webdriver/common/zipper.rb', line 58 def zip(path) encode_zip(path, path) end |
.zip_root(path) ⇒ Object Also known as: zip_file
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Keeps path (a file or directory) as the archive's single top-level entry, unlike #zip
which flattens a directory's contents; the Grid upload endpoint returns that one entry's path.
64 65 66 |
# File 'rb/lib/selenium/webdriver/common/zipper.rb', line 64 def zip_root(path) encode_zip(path, File.dirname(path)) end |