vagrant-unbundled 2.2.6.1 → 2.2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -9
  3. data/vagrant.gemspec +1 -1
  4. data/vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/vagrant-spec.gemspec +1 -1
  5. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/CHANGELOG +79 -0
  6. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/MIT-LICENSE +21 -0
  7. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/README.rdoc +109 -0
  8. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/Rakefile +78 -0
  9. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/lib/erubi/capture_end.rb +52 -0
  10. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/lib/erubi.rb +211 -0
  11. data/vendor/bundle/ruby/2.6.0/gems/erubi-1.9.0/test/test.rb +780 -0
  12. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/README.md +354 -0
  13. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/Rakefile +18 -0
  14. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/TODO +15 -0
  15. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/central_directory.rb +208 -0
  16. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/compressor.rb +9 -0
  17. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/constants.rb +63 -0
  18. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/encryption.rb +11 -0
  19. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/null_encryption.rb +43 -0
  20. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/crypto/traditional_encryption.rb +99 -0
  21. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/decompressor.rb +13 -0
  22. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/deflater.rb +34 -0
  23. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/dos_time.rb +48 -0
  24. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/entry.rb +700 -0
  25. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/entry_set.rb +86 -0
  26. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/errors.rb +18 -0
  27. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/generic.rb +43 -0
  28. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/ntfs.rb +90 -0
  29. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/old_unix.rb +44 -0
  30. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/universal_time.rb +47 -0
  31. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/unix.rb +37 -0
  32. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/zip64.rb +68 -0
  33. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field/zip64_placeholder.rb +15 -0
  34. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/extra_field.rb +101 -0
  35. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/file.rb +443 -0
  36. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/filesystem.rb +627 -0
  37. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/inflater.rb +66 -0
  38. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/input_stream.rb +173 -0
  39. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras/abstract_input_stream.rb +111 -0
  40. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras/abstract_output_stream.rb +43 -0
  41. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/ioextras.rb +36 -0
  42. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_compressor.rb +15 -0
  43. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_decompressor.rb +27 -0
  44. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/null_input_stream.rb +10 -0
  45. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/output_stream.rb +189 -0
  46. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/pass_thru_compressor.rb +23 -0
  47. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/pass_thru_decompressor.rb +40 -0
  48. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/streamable_directory.rb +15 -0
  49. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/streamable_stream.rb +56 -0
  50. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip/version.rb +3 -0
  51. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/lib/zip.rb +71 -0
  52. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example.rb +81 -0
  53. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example_filesystem.rb +31 -0
  54. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/example_recursive.rb +54 -0
  55. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/gtk_ruby_zip.rb +84 -0
  56. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/qtzip.rb +92 -0
  57. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/write_simple.rb +12 -0
  58. data/vendor/bundle/ruby/2.6.0/gems/rubyzip-2.0.0/samples/zipfind.rb +66 -0
  59. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/LICENSE +202 -0
  60. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/README.md +276 -0
  61. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/bin/rwinrm +90 -0
  62. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/connection.rb +84 -0
  63. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/connection_opts.rb +90 -0
  64. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/exceptions.rb +88 -0
  65. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/response_handler.rb +127 -0
  66. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/transport.rb +462 -0
  67. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/http/transport_factory.rb +64 -0
  68. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/output.rb +58 -0
  69. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/create_pipeline.xml.erb +167 -0
  70. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/fragment.rb +68 -0
  71. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/init_runspace_pool.xml.erb +224 -0
  72. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message.rb +128 -0
  73. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/base.rb +47 -0
  74. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/error_record.rb +66 -0
  75. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_host_call.rb +30 -0
  76. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_output.rb +48 -0
  77. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/pipeline_state.rb +38 -0
  78. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/runspacepool_host_call.rb +30 -0
  79. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/runspacepool_state.rb +37 -0
  80. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data/session_capability.rb +34 -0
  81. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_data.rb +40 -0
  82. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_defragmenter.rb +62 -0
  83. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_factory.rb +86 -0
  84. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/message_fragmenter.rb +58 -0
  85. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/powershell_output_decoder.rb +142 -0
  86. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/receive_response_reader.rb +95 -0
  87. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/session_capability.xml.erb +7 -0
  88. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/psrp/uuid.rb +39 -0
  89. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/base.rb +187 -0
  90. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/cmd.rb +63 -0
  91. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/power_shell.rb +206 -0
  92. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/retryable.rb +44 -0
  93. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/shells/shell_factory.rb +56 -0
  94. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/version.rb +5 -0
  95. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/base.rb +57 -0
  96. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/cleanup_command.rb +60 -0
  97. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/close_shell.rb +49 -0
  98. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command.rb +100 -0
  99. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command_output.rb +75 -0
  100. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/command_output_decoder.rb +54 -0
  101. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/configuration.rb +44 -0
  102. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/create_pipeline.rb +64 -0
  103. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/create_shell.rb +115 -0
  104. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/header.rb +213 -0
  105. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/init_runspace_pool.rb +96 -0
  106. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/iso8601_duration.rb +58 -0
  107. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/keep_alive.rb +66 -0
  108. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/receive_response_reader.rb +128 -0
  109. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/send_data.rb +66 -0
  110. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/soap.rb +49 -0
  111. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/wql_pull.rb +54 -0
  112. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/wql_query.rb +98 -0
  113. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm/wsmv/write_stdin.rb +86 -0
  114. data/vendor/bundle/ruby/2.6.0/gems/winrm-2.3.3/lib/winrm.rb +37 -0
  115. data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/LICENSE +202 -0
  116. data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/README.md +99 -0
  117. data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm/shells/elevated.rb +108 -0
  118. data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm-elevated/scripts/elevated_shell.ps1 +116 -0
  119. data/vendor/bundle/ruby/2.6.0/gems/winrm-elevated-1.1.2/lib/winrm-elevated.rb +17 -0
  120. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/LICENSE +202 -0
  121. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/README.md +82 -0
  122. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/bin/rwinrmcp +87 -0
  123. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/core/file_transporter.rb +569 -0
  124. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/core/tmp_zip.rb +178 -0
  125. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/exceptions.rb +29 -0
  126. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/file_manager.rb +158 -0
  127. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
  128. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
  129. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
  130. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
  131. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/download.ps1.erb +17 -0
  132. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
  133. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
  134. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs/scripts/scripts.rb +47 -0
  135. data/vendor/bundle/ruby/2.6.0/gems/winrm-fs-1.3.4/lib/winrm-fs.rb +29 -0
  136. data/vendor/bundle/ruby/2.6.0/specifications/erubi-1.9.0.gemspec +38 -0
  137. data/vendor/bundle/ruby/2.6.0/specifications/rubyzip-2.0.0.gemspec +45 -0
  138. data/vendor/bundle/ruby/2.6.0/specifications/winrm-2.3.3.gemspec +73 -0
  139. data/vendor/bundle/ruby/2.6.0/specifications/winrm-elevated-1.1.2.gemspec +50 -0
  140. data/vendor/bundle/ruby/2.6.0/specifications/winrm-fs-1.3.4.gemspec +58 -0
  141. data/version.txt +1 -1
  142. metadata +142 -6
@@ -0,0 +1,354 @@
1
+ # rubyzip
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rubyzip.svg)](http://badge.fury.io/rb/rubyzip)
4
+ [![Build Status](https://secure.travis-ci.org/rubyzip/rubyzip.svg)](http://travis-ci.org/rubyzip/rubyzip)
5
+ [![Code Climate](https://codeclimate.com/github/rubyzip/rubyzip.svg)](https://codeclimate.com/github/rubyzip/rubyzip)
6
+ [![Coverage Status](https://img.shields.io/coveralls/rubyzip/rubyzip.svg)](https://coveralls.io/r/rubyzip/rubyzip?branch=master)
7
+
8
+ Rubyzip is a ruby library for reading and writing zip files.
9
+
10
+ ## Important note
11
+
12
+ The Rubyzip interface has changed!!! No need to do `require "zip/zip"` and `Zip` prefix in class names removed.
13
+
14
+ If you have issues with any third-party gems that require an old version of rubyzip, you can use this workaround:
15
+
16
+ ```ruby
17
+ gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version
18
+ gem 'zip-zip' # will load compatibility for old rubyzip API.
19
+ ```
20
+
21
+ ## Requirements
22
+
23
+ - Ruby 2.4 or greater (for rubyzip 2.0; use 1.x for older rubies)
24
+
25
+ ## Installation
26
+
27
+ Rubyzip is available on RubyGems:
28
+
29
+ ```
30
+ gem install rubyzip
31
+ ```
32
+
33
+ Or in your Gemfile:
34
+
35
+ ```ruby
36
+ gem 'rubyzip'
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### Basic zip archive creation
42
+
43
+ ```ruby
44
+ require 'rubygems'
45
+ require 'zip'
46
+
47
+ folder = "Users/me/Desktop/stuff_to_zip"
48
+ input_filenames = ['image.jpg', 'description.txt', 'stats.csv']
49
+
50
+ zipfile_name = "/Users/me/Desktop/archive.zip"
51
+
52
+ Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
53
+ input_filenames.each do |filename|
54
+ # Two arguments:
55
+ # - The name of the file as it will appear in the archive
56
+ # - The original file, including the path to find it
57
+ zipfile.add(filename, File.join(folder, filename))
58
+ end
59
+ zipfile.get_output_stream("myFile") { |f| f.write "myFile contains just this" }
60
+ end
61
+ ```
62
+
63
+ ### Zipping a directory recursively
64
+
65
+ Copy from [here](https://github.com/rubyzip/rubyzip/blob/9d891f7353e66052283562d3e252fe380bb4b199/samples/example_recursive.rb)
66
+
67
+ ```ruby
68
+ require 'zip'
69
+
70
+ # This is a simple example which uses rubyzip to
71
+ # recursively generate a zip file from the contents of
72
+ # a specified directory. The directory itself is not
73
+ # included in the archive, rather just its contents.
74
+ #
75
+ # Usage:
76
+ # directory_to_zip = "/tmp/input"
77
+ # output_file = "/tmp/out.zip"
78
+ # zf = ZipFileGenerator.new(directory_to_zip, output_file)
79
+ # zf.write()
80
+ class ZipFileGenerator
81
+ # Initialize with the directory to zip and the location of the output archive.
82
+ def initialize(input_dir, output_file)
83
+ @input_dir = input_dir
84
+ @output_file = output_file
85
+ end
86
+
87
+ # Zip the input directory.
88
+ def write
89
+ entries = Dir.entries(@input_dir) - %w[. ..]
90
+
91
+ ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|
92
+ write_entries entries, '', zipfile
93
+ end
94
+ end
95
+
96
+ private
97
+
98
+ # A helper method to make the recursion work.
99
+ def write_entries(entries, path, zipfile)
100
+ entries.each do |e|
101
+ zipfile_path = path == '' ? e : File.join(path, e)
102
+ disk_file_path = File.join(@input_dir, zipfile_path)
103
+
104
+ if File.directory? disk_file_path
105
+ recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)
106
+ else
107
+ put_into_archive(disk_file_path, zipfile, zipfile_path)
108
+ end
109
+ end
110
+ end
111
+
112
+ def recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)
113
+ zipfile.mkdir zipfile_path
114
+ subdir = Dir.entries(disk_file_path) - %w[. ..]
115
+ write_entries subdir, zipfile_path, zipfile
116
+ end
117
+
118
+ def put_into_archive(disk_file_path, zipfile, zipfile_path)
119
+ zipfile.add(zipfile_path, disk_file_path)
120
+ end
121
+ end
122
+ ```
123
+
124
+ ### Save zip archive entries in sorted by name state
125
+
126
+ To save zip archives in sorted order like below, you need to set `::Zip.sort_entries` to `true`
127
+
128
+ ```
129
+ Vegetable/
130
+ Vegetable/bean
131
+ Vegetable/carrot
132
+ Vegetable/celery
133
+ fruit/
134
+ fruit/apple
135
+ fruit/kiwi
136
+ fruit/mango
137
+ fruit/orange
138
+ ```
139
+
140
+ After this, entries in the zip archive will be saved in ordered state.
141
+
142
+ ### Default permissions of zip archives
143
+
144
+ On Posix file systems the default file permissions applied to a new archive
145
+ are (0666 - umask), which mimics the behavior of standard tools such as `touch`.
146
+
147
+ On Windows the default file permissions are set to 0644 as suggested by the
148
+ [Ruby File documentation](http://ruby-doc.org/core-2.2.2/File.html).
149
+
150
+ When modifying a zip archive the file permissions of the archive are preserved.
151
+
152
+ ### Reading a Zip file
153
+
154
+ ```ruby
155
+ MAX_SIZE = 1024**2 # 1MiB (but of course you can increase this)
156
+ Zip::File.open('foo.zip') do |zip_file|
157
+ # Handle entries one by one
158
+ zip_file.each do |entry|
159
+ puts "Extracting #{entry.name}"
160
+ raise 'File too large when extracted' if entry.size > MAX_SIZE
161
+
162
+ # Extract to file or directory based on name in the archive
163
+ entry.extract
164
+
165
+ # Read into memory
166
+ content = entry.get_input_stream.read
167
+ end
168
+
169
+ # Find specific entry
170
+ entry = zip_file.glob('*.csv').first
171
+ raise 'File too large when extracted' if entry.size > MAX_SIZE
172
+ puts entry.get_input_stream.read
173
+ end
174
+ ```
175
+
176
+ #### Notice about ::Zip::InputStream
177
+
178
+ `::Zip::InputStream` usable for fast reading zip file content because it not read Central directory.
179
+
180
+ But there is one exception when it is not working - General Purpose Flag Bit 3.
181
+
182
+ > If bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written. The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure (optionally preceded by a 4-byte signature) immediately after the compressed data
183
+
184
+ If `::Zip::InputStream` finds such entry in the zip archive it will raise an exception.
185
+
186
+ ### Password Protection (Experimental)
187
+
188
+ Rubyzip supports reading/writing zip files with traditional zip encryption (a.k.a. "ZipCrypto"). AES encryption is not yet supported. It can be used with buffer streams, e.g.:
189
+
190
+ ```ruby
191
+ Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |out|
192
+ out.put_next_entry("my_file.txt")
193
+ out.write my_data
194
+ end.string
195
+ ```
196
+
197
+ This is an experimental feature and the interface for encryption may change in future versions.
198
+
199
+ ## Known issues
200
+
201
+ ### Modify docx file with rubyzip
202
+
203
+ Use `write_buffer` instead `open`. Thanks to @jondruse
204
+
205
+ ```ruby
206
+ buffer = Zip::OutputStream.write_buffer do |out|
207
+ @zip_file.entries.each do |e|
208
+ unless [DOCUMENT_FILE_PATH, RELS_FILE_PATH].include?(e.name)
209
+ out.put_next_entry(e.name)
210
+ out.write e.get_input_stream.read
211
+ end
212
+ end
213
+
214
+ out.put_next_entry(DOCUMENT_FILE_PATH)
215
+ out.write xml_doc.to_xml(:indent => 0).gsub("\n","")
216
+
217
+ out.put_next_entry(RELS_FILE_PATH)
218
+ out.write rels.to_xml(:indent => 0).gsub("\n","")
219
+ end
220
+
221
+ File.open(new_path, "wb") {|f| f.write(buffer.string) }
222
+ ```
223
+
224
+ ## Configuration
225
+
226
+ ### Existing Files
227
+
228
+ By default, rubyzip will not overwrite files if they already exist inside of the extracted path. To change this behavior, you may specify a configuration option like so:
229
+
230
+ ```ruby
231
+ Zip.on_exists_proc = true
232
+ ```
233
+
234
+ If you're using rubyzip with rails, consider placing this snippet of code in an initializer file such as `config/initializers/rubyzip.rb`
235
+
236
+ Additionally, if you want to configure rubyzip to overwrite existing files while creating a .zip file, you can do so with the following:
237
+
238
+ ```ruby
239
+ Zip.continue_on_exists_proc = true
240
+ ```
241
+
242
+ ### Non-ASCII Names
243
+
244
+ If you want to store non-english names and want to open them on Windows(pre 7) you need to set this option:
245
+
246
+ ```ruby
247
+ Zip.unicode_names = true
248
+ ```
249
+
250
+ Sometimes file names inside zip contain non-ASCII characters. If you can assume which encoding was used for such names and want to be able to find such entries using `find_entry` then you can force assumed encoding like so:
251
+
252
+ ```ruby
253
+ Zip.force_entry_names_encoding = 'UTF-8'
254
+ ```
255
+
256
+ Allowed encoding names are the same as accepted by `String#force_encoding`
257
+
258
+ ### Date Validation
259
+
260
+ Some zip files might have an invalid date format, which will raise a warning. You can hide this warning with the following setting:
261
+
262
+ ```ruby
263
+ Zip.warn_invalid_date = false
264
+ ```
265
+
266
+ ### Size Validation
267
+
268
+ By default (in rubyzip >= 2.0), rubyzip's `extract` method checks that an entry's reported uncompressed size is not (significantly) smaller than its actual size. This is to help you protect your application against [zip bombs](https://en.wikipedia.org/wiki/Zip_bomb). Before `extract`ing an entry, you should check that its size is in the range you expect. For example, if your application supports processing up to 100 files at once, each up to 10MiB, your zip extraction code might look like:
269
+
270
+ ```ruby
271
+ MAX_FILE_SIZE = 10 * 1024**2 # 10MiB
272
+ MAX_FILES = 100
273
+ Zip::File.open('foo.zip') do |zip_file|
274
+ num_files = 0
275
+ zip_file.each do |entry|
276
+ num_files += 1 if entry.file?
277
+ raise 'Too many extracted files' if num_files > MAX_FILES
278
+ raise 'File too large when extracted' if entry.size > MAX_FILE_SIZE
279
+ entry.extract
280
+ end
281
+ end
282
+ ```
283
+
284
+ If you need to extract zip files that report incorrect uncompressed sizes and you really trust them not too be too large, you can disable this setting with
285
+ ```ruby
286
+ Zip.validate_entry_sizes = false
287
+ ```
288
+
289
+ Note that if you use the lower level `Zip::InputStream` interface, `rubyzip` does *not* check the entry `size`s. In this case, the caller is responsible for making sure it does not read more data than expected from the input stream.
290
+
291
+ ### Default Compression
292
+
293
+ You can set the default compression level like so:
294
+
295
+ ```ruby
296
+ Zip.default_compression = Zlib::DEFAULT_COMPRESSION
297
+ ```
298
+
299
+ It defaults to `Zlib::DEFAULT_COMPRESSION`. Possible values are `Zlib::BEST_COMPRESSION`, `Zlib::DEFAULT_COMPRESSION` and `Zlib::NO_COMPRESSION`
300
+
301
+ ### Zip64 Support
302
+
303
+ By default, Zip64 support is disabled for writing. To enable it do this:
304
+
305
+ ```ruby
306
+ Zip.write_zip64_support = true
307
+ ```
308
+
309
+ _NOTE_: If you will enable Zip64 writing then you will need zip extractor with Zip64 support to extract archive.
310
+
311
+ ### Block Form
312
+
313
+ You can set multiple settings at the same time by using a block:
314
+
315
+ ```ruby
316
+ Zip.setup do |c|
317
+ c.on_exists_proc = true
318
+ c.continue_on_exists_proc = true
319
+ c.unicode_names = true
320
+ c.default_compression = Zlib::BEST_COMPRESSION
321
+ end
322
+ ```
323
+
324
+ ## Developing
325
+
326
+ To run the test you need to do this:
327
+
328
+ ```
329
+ bundle install
330
+ rake
331
+ ```
332
+
333
+ ## Website and Project Home
334
+
335
+ http://github.com/rubyzip/rubyzip
336
+
337
+ http://rdoc.info/github/rubyzip/rubyzip/master/frames
338
+
339
+ ## Authors
340
+
341
+ Alexander Simonov ( alex at simonov.me)
342
+
343
+ Alan Harper ( alan at aussiegeek.net)
344
+
345
+ Thomas Sondergaard (thomas at sondergaard.cc)
346
+
347
+ Technorama Ltd. (oss-ruby-zip at technorama.net)
348
+
349
+ extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org)
350
+
351
+ ## License
352
+
353
+ Rubyzip is distributed under the same license as ruby. See
354
+ http://www.ruby-lang.org/en/LICENSE.txt
@@ -0,0 +1,18 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ task default: :test
5
+
6
+ Rake::TestTask.new(:test) do |test|
7
+ test.libs << 'lib'
8
+ test.libs << 'test'
9
+ test.pattern = 'test/**/*_test.rb'
10
+ test.verbose = true
11
+ end
12
+
13
+ # Rake::TestTask.new(:zip64_full_test) do |test|
14
+ # test.libs << File.join(File.dirname(__FILE__), 'lib')
15
+ # test.libs << File.join(File.dirname(__FILE__), 'test')
16
+ # test.pattern = File.join(File.dirname(__FILE__), 'test/zip64_full_test.rb')
17
+ # test.verbose = true
18
+ # end
@@ -0,0 +1,15 @@
1
+
2
+ * ZipInputStream: Support zip-files with trailing data descriptors
3
+ * Adjust rdoc stylesheet to advertise inherited methods if possible
4
+ * Suggestion: Add ZipFile/ZipInputStream example that demonstrates extracting all entries.
5
+ * Suggestion: ZipFile#extract destination should default to "."
6
+ * Suggestion: ZipEntry should have extract(), get_input_stream() methods etc
7
+ * (is buffering used anywhere with write?)
8
+ * Inflater.sysread should pass the buffer to produce_input.
9
+ * Implement ZipFsDir.glob
10
+ * ZipFile.checkIntegrity method
11
+ * non-MSDOS permission attributes
12
+ ** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2"
13
+ * Packager version, required unpacker version in zip headers
14
+ ** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2"
15
+ * implement storing attributes and ownership information
@@ -0,0 +1,208 @@
1
+ module Zip
2
+ class CentralDirectory
3
+ include Enumerable
4
+
5
+ END_OF_CDS = 0x06054b50
6
+ ZIP64_END_OF_CDS = 0x06064b50
7
+ ZIP64_EOCD_LOCATOR = 0x07064b50
8
+ MAX_END_OF_CDS_SIZE = 65_536 + 18
9
+ STATIC_EOCD_SIZE = 22
10
+
11
+ attr_reader :comment
12
+
13
+ # Returns an Enumerable containing the entries.
14
+ def entries
15
+ @entry_set.entries
16
+ end
17
+
18
+ def initialize(entries = EntrySet.new, comment = '') #:nodoc:
19
+ super()
20
+ @entry_set = entries.kind_of?(EntrySet) ? entries : EntrySet.new(entries)
21
+ @comment = comment
22
+ end
23
+
24
+ def write_to_stream(io) #:nodoc:
25
+ cdir_offset = io.tell
26
+ @entry_set.each { |entry| entry.write_c_dir_entry(io) }
27
+ eocd_offset = io.tell
28
+ cdir_size = eocd_offset - cdir_offset
29
+ if ::Zip.write_zip64_support
30
+ need_zip64_eocd = cdir_offset > 0xFFFFFFFF || cdir_size > 0xFFFFFFFF || @entry_set.size > 0xFFFF
31
+ need_zip64_eocd ||= @entry_set.any? { |entry| entry.extra['Zip64'] }
32
+ if need_zip64_eocd
33
+ write_64_e_o_c_d(io, cdir_offset, cdir_size)
34
+ write_64_eocd_locator(io, eocd_offset)
35
+ end
36
+ end
37
+ write_e_o_c_d(io, cdir_offset, cdir_size)
38
+ end
39
+
40
+ def write_e_o_c_d(io, offset, cdir_size) #:nodoc:
41
+ tmp = [
42
+ END_OF_CDS,
43
+ 0, # @numberOfThisDisk
44
+ 0, # @numberOfDiskWithStartOfCDir
45
+ @entry_set ? [@entry_set.size, 0xFFFF].min : 0,
46
+ @entry_set ? [@entry_set.size, 0xFFFF].min : 0,
47
+ [cdir_size, 0xFFFFFFFF].min,
48
+ [offset, 0xFFFFFFFF].min,
49
+ @comment ? @comment.bytesize : 0
50
+ ]
51
+ io << tmp.pack('VvvvvVVv')
52
+ io << @comment
53
+ end
54
+
55
+ private :write_e_o_c_d
56
+
57
+ def write_64_e_o_c_d(io, offset, cdir_size) #:nodoc:
58
+ tmp = [
59
+ ZIP64_END_OF_CDS,
60
+ 44, # size of zip64 end of central directory record (excludes signature and field itself)
61
+ VERSION_MADE_BY,
62
+ VERSION_NEEDED_TO_EXTRACT_ZIP64,
63
+ 0, # @numberOfThisDisk
64
+ 0, # @numberOfDiskWithStartOfCDir
65
+ @entry_set ? @entry_set.size : 0, # number of entries on this disk
66
+ @entry_set ? @entry_set.size : 0, # number of entries total
67
+ cdir_size, # size of central directory
68
+ offset, # offset of start of central directory in its disk
69
+ ]
70
+ io << tmp.pack('VQ<vvVVQ<Q<Q<Q<')
71
+ end
72
+
73
+ private :write_64_e_o_c_d
74
+
75
+ def write_64_eocd_locator(io, zip64_eocd_offset)
76
+ tmp = [
77
+ ZIP64_EOCD_LOCATOR,
78
+ 0, # number of disk containing the start of zip64 eocd record
79
+ zip64_eocd_offset, # offset of the start of zip64 eocd record in its disk
80
+ 1 # total number of disks
81
+ ]
82
+ io << tmp.pack('VVQ<V')
83
+ end
84
+
85
+ private :write_64_eocd_locator
86
+
87
+ def read_64_e_o_c_d(buf) #:nodoc:
88
+ buf = get_64_e_o_c_d(buf)
89
+ @size_of_zip64_e_o_c_d = Entry.read_zip_64_long(buf)
90
+ @version_made_by = Entry.read_zip_short(buf)
91
+ @version_needed_for_extract = Entry.read_zip_short(buf)
92
+ @number_of_this_disk = Entry.read_zip_long(buf)
93
+ @number_of_disk_with_start_of_cdir = Entry.read_zip_long(buf)
94
+ @total_number_of_entries_in_cdir_on_this_disk = Entry.read_zip_64_long(buf)
95
+ @size = Entry.read_zip_64_long(buf)
96
+ @size_in_bytes = Entry.read_zip_64_long(buf)
97
+ @cdir_offset = Entry.read_zip_64_long(buf)
98
+ @zip_64_extensible = buf.slice!(0, buf.bytesize)
99
+ raise Error, 'Zip consistency problem while reading eocd structure' unless buf.empty?
100
+ end
101
+
102
+ def read_e_o_c_d(buf) #:nodoc:
103
+ buf = get_e_o_c_d(buf)
104
+ @number_of_this_disk = Entry.read_zip_short(buf)
105
+ @number_of_disk_with_start_of_cdir = Entry.read_zip_short(buf)
106
+ @total_number_of_entries_in_cdir_on_this_disk = Entry.read_zip_short(buf)
107
+ @size = Entry.read_zip_short(buf)
108
+ @size_in_bytes = Entry.read_zip_long(buf)
109
+ @cdir_offset = Entry.read_zip_long(buf)
110
+ comment_length = Entry.read_zip_short(buf)
111
+ @comment = if comment_length.to_i <= 0
112
+ buf.slice!(0, buf.size)
113
+ else
114
+ buf.read(comment_length)
115
+ end
116
+ raise Error, 'Zip consistency problem while reading eocd structure' unless buf.empty?
117
+ end
118
+
119
+ def read_central_directory_entries(io) #:nodoc:
120
+ begin
121
+ io.seek(@cdir_offset, IO::SEEK_SET)
122
+ rescue Errno::EINVAL
123
+ raise Error, 'Zip consistency problem while reading central directory entry'
124
+ end
125
+ @entry_set = EntrySet.new
126
+ @size.times do
127
+ @entry_set << Entry.read_c_dir_entry(io)
128
+ end
129
+ end
130
+
131
+ def read_from_stream(io) #:nodoc:
132
+ buf = start_buf(io)
133
+ if zip64_file?(buf)
134
+ read_64_e_o_c_d(buf)
135
+ else
136
+ read_e_o_c_d(buf)
137
+ end
138
+ read_central_directory_entries(io)
139
+ end
140
+
141
+ def get_e_o_c_d(buf) #:nodoc:
142
+ sig_index = buf.rindex([END_OF_CDS].pack('V'))
143
+ raise Error, 'Zip end of central directory signature not found' unless sig_index
144
+ buf = buf.slice!((sig_index + 4)..(buf.bytesize))
145
+
146
+ def buf.read(count)
147
+ slice!(0, count)
148
+ end
149
+
150
+ buf
151
+ end
152
+
153
+ def zip64_file?(buf)
154
+ buf.rindex([ZIP64_END_OF_CDS].pack('V')) && buf.rindex([ZIP64_EOCD_LOCATOR].pack('V'))
155
+ end
156
+
157
+ def start_buf(io)
158
+ begin
159
+ io.seek(-MAX_END_OF_CDS_SIZE, IO::SEEK_END)
160
+ rescue Errno::EINVAL
161
+ io.seek(0, IO::SEEK_SET)
162
+ end
163
+ io.read
164
+ end
165
+
166
+ def get_64_e_o_c_d(buf) #:nodoc:
167
+ zip_64_start = buf.rindex([ZIP64_END_OF_CDS].pack('V'))
168
+ raise Error, 'Zip64 end of central directory signature not found' unless zip_64_start
169
+ zip_64_locator = buf.rindex([ZIP64_EOCD_LOCATOR].pack('V'))
170
+ raise Error, 'Zip64 end of central directory signature locator not found' unless zip_64_locator
171
+ buf = buf.slice!((zip_64_start + 4)..zip_64_locator)
172
+
173
+ def buf.read(count)
174
+ slice!(0, count)
175
+ end
176
+
177
+ buf
178
+ end
179
+
180
+ # For iterating over the entries.
181
+ def each(&proc)
182
+ @entry_set.each(&proc)
183
+ end
184
+
185
+ # Returns the number of entries in the central directory (and
186
+ # consequently in the zip archive).
187
+ def size
188
+ @entry_set.size
189
+ end
190
+
191
+ def self.read_from_stream(io) #:nodoc:
192
+ cdir = new
193
+ cdir.read_from_stream(io)
194
+ return cdir
195
+ rescue Error
196
+ return nil
197
+ end
198
+
199
+ def ==(other) #:nodoc:
200
+ return false unless other.kind_of?(CentralDirectory)
201
+ @entry_set.entries.sort == other.entries.sort && comment == other.comment
202
+ end
203
+ end
204
+ end
205
+
206
+ # Copyright (C) 2002, 2003 Thomas Sondergaard
207
+ # rubyzip is free software; you can redistribute it and/or
208
+ # modify it under the terms of the ruby license.
@@ -0,0 +1,9 @@
1
+ module Zip
2
+ class Compressor #:nodoc:all
3
+ def finish; end
4
+ end
5
+ end
6
+
7
+ # Copyright (C) 2002, 2003 Thomas Sondergaard
8
+ # rubyzip is free software; you can redistribute it and/or
9
+ # modify it under the terms of the ruby license.
@@ -0,0 +1,63 @@
1
+ module Zip
2
+ RUNNING_ON_WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/i
3
+
4
+ CENTRAL_DIRECTORY_ENTRY_SIGNATURE = 0x02014b50
5
+ CDIR_ENTRY_STATIC_HEADER_LENGTH = 46
6
+
7
+ LOCAL_ENTRY_SIGNATURE = 0x04034b50
8
+ LOCAL_ENTRY_STATIC_HEADER_LENGTH = 30
9
+ LOCAL_ENTRY_TRAILING_DESCRIPTOR_LENGTH = 4 + 4 + 4
10
+ VERSION_MADE_BY = 52 # this library's version
11
+ VERSION_NEEDED_TO_EXTRACT = 20
12
+ VERSION_NEEDED_TO_EXTRACT_ZIP64 = 45
13
+
14
+ FILE_TYPE_FILE = 0o10
15
+ FILE_TYPE_DIR = 0o04
16
+ FILE_TYPE_SYMLINK = 0o12
17
+
18
+ FSTYPE_FAT = 0
19
+ FSTYPE_AMIGA = 1
20
+ FSTYPE_VMS = 2
21
+ FSTYPE_UNIX = 3
22
+ FSTYPE_VM_CMS = 4
23
+ FSTYPE_ATARI = 5
24
+ FSTYPE_HPFS = 6
25
+ FSTYPE_MAC = 7
26
+ FSTYPE_Z_SYSTEM = 8
27
+ FSTYPE_CPM = 9
28
+ FSTYPE_TOPS20 = 10
29
+ FSTYPE_NTFS = 11
30
+ FSTYPE_QDOS = 12
31
+ FSTYPE_ACORN = 13
32
+ FSTYPE_VFAT = 14
33
+ FSTYPE_MVS = 15
34
+ FSTYPE_BEOS = 16
35
+ FSTYPE_TANDEM = 17
36
+ FSTYPE_THEOS = 18
37
+ FSTYPE_MAC_OSX = 19
38
+ FSTYPE_ATHEOS = 30
39
+
40
+ FSTYPES = {
41
+ FSTYPE_FAT => 'FAT'.freeze,
42
+ FSTYPE_AMIGA => 'Amiga'.freeze,
43
+ FSTYPE_VMS => 'VMS (Vax or Alpha AXP)'.freeze,
44
+ FSTYPE_UNIX => 'Unix'.freeze,
45
+ FSTYPE_VM_CMS => 'VM/CMS'.freeze,
46
+ FSTYPE_ATARI => 'Atari ST'.freeze,
47
+ FSTYPE_HPFS => 'OS/2 or NT HPFS'.freeze,
48
+ FSTYPE_MAC => 'Macintosh'.freeze,
49
+ FSTYPE_Z_SYSTEM => 'Z-System'.freeze,
50
+ FSTYPE_CPM => 'CP/M'.freeze,
51
+ FSTYPE_TOPS20 => 'TOPS-20'.freeze,
52
+ FSTYPE_NTFS => 'NTFS'.freeze,
53
+ FSTYPE_QDOS => 'SMS/QDOS'.freeze,
54
+ FSTYPE_ACORN => 'Acorn RISC OS'.freeze,
55
+ FSTYPE_VFAT => 'Win32 VFAT'.freeze,
56
+ FSTYPE_MVS => 'MVS'.freeze,
57
+ FSTYPE_BEOS => 'BeOS'.freeze,
58
+ FSTYPE_TANDEM => 'Tandem NSK'.freeze,
59
+ FSTYPE_THEOS => 'Theos'.freeze,
60
+ FSTYPE_MAC_OSX => 'Mac OS/X (Darwin)'.freeze,
61
+ FSTYPE_ATHEOS => 'AtheOS'.freeze
62
+ }.freeze
63
+ end
@@ -0,0 +1,11 @@
1
+ module Zip
2
+ class Encrypter #:nodoc:all
3
+ end
4
+
5
+ class Decrypter
6
+ end
7
+ end
8
+
9
+ # Copyright (C) 2002, 2003 Thomas Sondergaard
10
+ # rubyzip is free software; you can redistribute it and/or
11
+ # modify it under the terms of the ruby license.