excavate 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe53a363bd11b14249732d9c553b9efc00a4a9ab0ac156d90ea48afac366607e
|
|
4
|
+
data.tar.gz: af6bac0b0faace666c557fa4c66f32ef31a659110629916ac82a74172ad2c448
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 974a4e58890cc0d2b4a472d5a8d3a580ffb1a6bdc47f7e41c1e212692d636936921718be201c320069eefd7e6677b91266fafedbfcf393bfafbb714dede984cf
|
|
7
|
+
data.tar.gz: 0634316b5893c0a58bba0f1d0e756ccedbadd5061acd344b2c3d0c93810f5363a9cfe5cf4220454884a07c1a81f537b74e0abca2f86aa04d619bebb72021c686
|
|
@@ -21,6 +21,7 @@ module Excavate
|
|
|
21
21
|
if entry.directory?
|
|
22
22
|
FileUtils.mkdir_p(path)
|
|
23
23
|
else
|
|
24
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
24
25
|
File.write(path, file.read, mode: "wb")
|
|
25
26
|
end
|
|
26
27
|
end
|
|
@@ -34,6 +35,7 @@ module Excavate
|
|
|
34
35
|
if entry.directory?
|
|
35
36
|
FileUtils.mkdir_p(path)
|
|
36
37
|
else
|
|
38
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
37
39
|
File.write(path, entry.data, mode: "wb")
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -5,15 +5,29 @@ module Excavate
|
|
|
5
5
|
class XarExtractor < Extractor
|
|
6
6
|
def extract(target)
|
|
7
7
|
Dir.chdir(target) do
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
extract_with_libarchive
|
|
9
|
+
rename_payload(target)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
reader.extract(entry, flags.to_i)
|
|
13
|
-
end
|
|
13
|
+
private
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def extract_with_libarchive
|
|
16
|
+
flags = ::Archive::EXTRACT_PERM
|
|
17
|
+
reader = ::Archive::Reader.open_filename(@archive)
|
|
18
|
+
|
|
19
|
+
reader.each_entry do |entry|
|
|
20
|
+
reader.extract(entry, flags.to_i)
|
|
16
21
|
end
|
|
22
|
+
|
|
23
|
+
reader.close
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def rename_payload(target)
|
|
27
|
+
payload_path = File.join(target, "Payload")
|
|
28
|
+
return unless File.exist?(payload_path)
|
|
29
|
+
|
|
30
|
+
FileUtils.mv(payload_path, "#{payload_path}.cpio.gz")
|
|
17
31
|
end
|
|
18
32
|
end
|
|
19
33
|
end
|
data/lib/excavate/version.rb
CHANGED