excavate 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa5e513f27e2996c18e3b006569540ec1c06c8b178460e2241a891e42fddcfda
4
- data.tar.gz: 3a0c7b6f1829f2a1d2ff4645d8b40d677a54b693351a883b53b2feb47d29b9b3
3
+ metadata.gz: ae1e2f6707705a5247f26db5c29f7ffb3618ccdf890277ca664cc91361e9ab7c
4
+ data.tar.gz: 5ea58834d2bcbb1005a36c9f239d32f34a7e61a2bff4a4a0548cdc5e4ae38688
5
5
  SHA512:
6
- metadata.gz: 7176e3bb221ef27aa16bb666f278d2081030c28778380fa40b5cdd44737fef9b5a76e9f7b7475dfaceaf33583b7caea80590f39e3a2a5f614f9a957baf082af8
7
- data.tar.gz: '0359c8ea5ac50e2ad79c8c453b81a5dea7c2a11c1c1e9accf0844aa5f6ea110a3cfe692819c8c786c45a1191cce2d26259135832238fb268a31e913696cac951'
6
+ metadata.gz: 38d73443fa50e9d4af01d9adcde21e45cee4c201f7bb586ce9097d37e092153d18acd5109183ba3bec3c9ecbd4a017d4f4882a44f3f1caf9e83ad98b769b8997
7
+ data.tar.gz: 0c6b9f6673b571ca5f582b4b0080180b89d091cfbaa85932b642f3c9ee690433e9e0afbac4b7ad1536307c09f54f2d614dc9df1a1690cdde0e0f736ac9f3151b
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
+ /.vscode
3
4
  /_yardoc/
4
5
  /coverage/
5
6
  /doc/
data/excavate.gemspec CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require_relative "lib/excavate/version"
4
4
 
5
+ # rubocop:disable Metrics/BlockLength
6
+
5
7
  Gem::Specification.new do |spec|
6
8
  spec.name = "excavate"
7
9
  spec.version = Excavate::VERSION
@@ -35,11 +37,13 @@ Gem::Specification.new do |spec|
35
37
  spec.add_runtime_dependency "libmspack", "~> 0.1"
36
38
  spec.add_runtime_dependency "ruby-ole", "~> 1.0"
37
39
  spec.add_runtime_dependency "rubyzip", "~> 2.3"
40
+ spec.add_runtime_dependency "seven-zip", "~> 1.4"
38
41
  spec.add_runtime_dependency "thor", "~> 1.0"
39
42
 
40
43
  spec.add_development_dependency "rspec", "~> 3.0"
41
44
  spec.add_development_dependency "rubocop", "~> 1.7"
42
45
  spec.add_development_dependency "rubocop-performance", "~> 1.15"
43
-
44
46
  spec.metadata["rubygems_mfa_required"] = "false"
45
47
  end
48
+
49
+ # rubocop:enable Metrics/BlockLength
@@ -184,6 +184,12 @@ module Excavate
184
184
  FileUtils.cp(archive, target)
185
185
  end
186
186
 
187
+ def may_be_nested_cab?(extension, message)
188
+ extension == "exe" &&
189
+ message.start_with?("Invalid file format",
190
+ "Unrecognized archive format")
191
+ end
192
+
187
193
  def extract_once(archive, target)
188
194
  extension = normalized_extension(archive)
189
195
  extractor_class = TYPES[extension]
@@ -193,8 +199,7 @@ module Excavate
193
199
 
194
200
  extractor_class.new(archive).extract(target)
195
201
  rescue StandardError => e
196
- raise unless extension == "exe" &&
197
- e.message.start_with?("Invalid file format")
202
+ raise unless may_be_nested_cab?(extension, e.message)
198
203
 
199
204
  Extractors::CabExtractor.new(archive).extract(target)
200
205
  end
@@ -1,24 +1,15 @@
1
- require "ffi-libarchive-binary"
1
+ require "seven_zip_ruby"
2
2
 
3
3
  module Excavate
4
4
  module Extractors
5
5
  class SevenZipExtractor < Extractor
6
6
  def extract(target)
7
7
  Dir.chdir(target) do
8
- extract_with_libarchive
8
+ File.open(@archive, "rb") do |file|
9
+ SevenZipRuby::Reader.extract_all(file, target)
10
+ end
9
11
  end
10
12
  end
11
-
12
- def extract_with_libarchive
13
- flags = ::Archive::EXTRACT_PERM
14
- reader = ::Archive::Reader.open_filename(@archive)
15
-
16
- reader.each_entry do |entry|
17
- reader.extract(entry, flags.to_i)
18
- end
19
-
20
- reader.close
21
- end
22
13
  end
23
14
  end
24
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Excavate
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excavate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arr-pm
@@ -100,6 +100,20 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '2.3'
103
+ - !ruby/object:Gem::Dependency
104
+ name: seven-zip
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.4'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.4'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: thor
105
119
  requirement: !ruby/object:Gem::Requirement