poise-archive 1.1.1 → 1.1.2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/poise_archive/archive_providers/tar.rb +24 -17
- data/lib/poise_archive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfaafe9923ce43911a655e20b02ab6dd00cb7048
|
4
|
+
data.tar.gz: 80cc2672a626c92f4448b5936d5d10a51420c73c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f46fc0af69806f98c569071ffd083f377614eae6ef598be79691957b709506cda3e5f719523f27cc00b164c0b3d9cbf611e147ac76aaacf8fb633c07f1f9f3b
|
7
|
+
data.tar.gz: b482be77a33a595e75f4a9d6ce56126cee7c7e452132c0a3e127bf8ed8834439abe2e00970878a6cb7ed31e702b303f384e68089aade9f6b286370ae78c07100
|
data/CHANGELOG.md
CHANGED
@@ -47,23 +47,11 @@ module PoiseArchive
|
|
47
47
|
#
|
48
48
|
# @return [void]
|
49
49
|
def unpack_tar
|
50
|
-
|
51
|
-
|
52
|
-
if entry.full_name == TAR_LONGLINK
|
53
|
-
# Stash the longlink name so it will be used for the next entry.
|
54
|
-
entry_name = entry.read.strip
|
55
|
-
# And then skip forward because this isn't a real block.
|
56
|
-
next
|
57
|
-
end
|
58
|
-
# For entries not preceded by a longlink block, use the normal name.
|
59
|
-
entry_name ||= entry.full_name
|
60
|
-
# Process strip_components by mangling the name.
|
61
|
-
parsed_name = entry_name.split(/\//).drop(new_resource.strip_components).join('/')
|
62
|
-
# Reset entry_name for the next entry.
|
63
|
-
entry_name = nil
|
50
|
+
tar_each_with_longlink do |entry|
|
51
|
+
entry_name = entry.full_name.split(/\//).drop(new_resource.strip_components).join('/')
|
64
52
|
# If strip_components wiped out the name, don't process this entry.
|
65
|
-
next if
|
66
|
-
dest = ::File.join(new_resource.destination,
|
53
|
+
next if entry_name.empty?
|
54
|
+
dest = ::File.join(new_resource.destination, entry_name)
|
67
55
|
if entry.directory?
|
68
56
|
Dir.mkdir(dest, entry.header.mode)
|
69
57
|
elsif entry.file?
|
@@ -72,7 +60,7 @@ module PoiseArchive
|
|
72
60
|
dest_f.write(buf)
|
73
61
|
end
|
74
62
|
end
|
75
|
-
elsif entry.symlink?
|
63
|
+
elsif entry.header.typeflag == '2' # symlink? is new in Ruby 2.0, apparently.
|
76
64
|
::File.symlink(entry.header.linkname, dest)
|
77
65
|
else
|
78
66
|
raise RuntimeError.new("Unknown tar entry type #{entry.header.typeflag.inspect} in #{new_resource.path}")
|
@@ -81,6 +69,25 @@ module PoiseArchive
|
|
81
69
|
end
|
82
70
|
end
|
83
71
|
|
72
|
+
def tar_each_with_longlink(&block)
|
73
|
+
entry_name = nil
|
74
|
+
tar_each do |entry|
|
75
|
+
if entry.full_name == TAR_LONGLINK
|
76
|
+
# Stash the longlink name so it will be used for the next entry.
|
77
|
+
entry_name = entry.read.strip
|
78
|
+
# And then skip forward because this isn't a real block.
|
79
|
+
next
|
80
|
+
end
|
81
|
+
# For entries not preceded by a longlink block, use the normal name.
|
82
|
+
entry_name ||= entry.full_name
|
83
|
+
# Make the entry return the correct name.
|
84
|
+
entry.define_singleton_method(:full_name) { entry_name }
|
85
|
+
block.call(entry)
|
86
|
+
# Reset entry_name for the next entry.
|
87
|
+
entry_name = nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
84
91
|
# Sequence the opening, iteration, and closing.
|
85
92
|
#
|
86
93
|
# @param block [Proc] Block to process each tar entry.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|