minitar 0.6 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +10 -0
- data/README.rdoc +3 -3
- data/lib/archive/tar/minitar.rb +1 -1
- data/lib/archive/tar/minitar/input.rb +13 -3
- data/lib/archive/tar/minitar/output.rb +13 -3
- data/lib/archive/tar/minitar/reader.rb +19 -3
- data/lib/archive/tar/minitar/writer.rb +13 -3
- data/test/test_tar_input.rb +9 -0
- data/test/test_tar_output.rb +8 -0
- data/test/test_tar_reader.rb +13 -0
- data/test/test_tar_writer.rb +9 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f701b9b323414ca305fd29f288088f7b6656342
|
4
|
+
data.tar.gz: f0875b48ec987190fdd2a8c6e6d5785b87958af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51ac6a3c8c9494f6d17392e6e7969836d2fae501e47f6083cbf0b3646dea93eb4838a25986b3723c071c791ac0ac770e8229276a77a5c06021398d82cbc4a0c
|
7
|
+
data.tar.gz: 9423c08b9f8426d415b3f77647c53cf744180dbdc328f4f40e15a9632171696810902a341fa654133f3e4c8ca6b84277dd93892426bb553ed309785f47114228
|
data/History.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.6.1 / 2017-02-07
|
2
|
+
|
3
|
+
* Fixed issue [#24][] where streams were being improperly closed immediately
|
4
|
+
on open unless there was a block provided.
|
5
|
+
|
6
|
+
* Hopefully fixes issue [#23][] by releasing archive-tar-minitar after
|
7
|
+
minitar-cli is available.
|
8
|
+
|
1
9
|
## 0.6 / 2017-02-07
|
2
10
|
|
3
11
|
* Breaking Changes:
|
@@ -105,3 +113,5 @@
|
|
105
113
|
[#13]: https://github.com/halostatue/minitar/issues/13
|
106
114
|
[#14]: https://github.com/halostatue/minitar/issues/14
|
107
115
|
[#16]: https://github.com/halostatue/minitar/issues/16
|
116
|
+
[#23]: https://github.com/halostatue/minitar/issues/23
|
117
|
+
[#24]: https://github.com/halostatue/minitar/issues/24
|
data/README.rdoc
CHANGED
@@ -5,9 +5,9 @@ code :: https://github.com/halostatue/minitar/
|
|
5
5
|
bugs :: https://github.com/halostatue/minitar/issues
|
6
6
|
rdoc :: http://rdoc.info/gems/minitar/
|
7
7
|
cli :: https://github.com/halostatue/minitar-cli
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
travis :: {<img src="https://travis-ci.org/halostatue/minitar.svg" />}[https://travis-ci.org/halostatue/minitar]
|
9
|
+
appveyor :: {<img src="https://ci.appveyor.com/api/projects/status/bj4gqn3gp3gu45sa?svg=true" />}[https://ci.appveyor.com/project/halostatue/minitar]
|
10
|
+
coveralls :: {<img src="https://coveralls.io/repos/halostatue/minitar/badge.svg" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/minitar]
|
11
11
|
|
12
12
|
== Description
|
13
13
|
|
data/lib/archive/tar/minitar.rb
CHANGED
@@ -20,9 +20,14 @@ module Archive::Tar::Minitar
|
|
20
20
|
def self.open(input)
|
21
21
|
stream = new(input)
|
22
22
|
return stream unless block_given?
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
|
24
|
+
# This exception context must remain, otherwise the stream closes on open
|
25
|
+
# even if a block is not given.
|
26
|
+
begin
|
27
|
+
yield stream
|
28
|
+
ensure
|
29
|
+
stream.close
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
# Iterates over each entry in the provided input. This wraps the common
|
@@ -188,6 +193,11 @@ module Archive::Tar::Minitar
|
|
188
193
|
end
|
189
194
|
end
|
190
195
|
|
196
|
+
# Returns false if the wrapped data stream is open.
|
197
|
+
def closed?
|
198
|
+
@io.closed?
|
199
|
+
end
|
200
|
+
|
191
201
|
# Returns the Reader object for direct access.
|
192
202
|
attr_reader :tar
|
193
203
|
|
@@ -20,9 +20,14 @@ module Archive::Tar::Minitar
|
|
20
20
|
def self.open(output)
|
21
21
|
stream = new(output)
|
22
22
|
return stream unless block_given?
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
|
24
|
+
# This exception context must remain, otherwise the stream closes on open
|
25
|
+
# even if a block is not given.
|
26
|
+
begin
|
27
|
+
yield stream
|
28
|
+
ensure
|
29
|
+
stream.close
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
# Output.tar is a wrapper for Output.open that yields the owned tar object
|
@@ -60,6 +65,11 @@ module Archive::Tar::Minitar
|
|
60
65
|
# Returns the Writer object for direct access.
|
61
66
|
attr_reader :tar
|
62
67
|
|
68
|
+
# Returns false if the wrapped data stream is open.
|
69
|
+
def closed?
|
70
|
+
@io.closed?
|
71
|
+
end
|
72
|
+
|
63
73
|
# Closes the Writer object and the wrapped data stream.
|
64
74
|
def close
|
65
75
|
@tar.close
|
@@ -13,6 +13,7 @@ module Archive::Tar::Minitar
|
|
13
13
|
def read(*); raise ClosedStream; end
|
14
14
|
def getc; raise ClosedStream; end
|
15
15
|
def rewind; raise ClosedStream; end
|
16
|
+
def closed?; true; end
|
16
17
|
# rubocop:enable Style/EmptyLineBetweenDefs
|
17
18
|
# rubocop:enable Style/SingleLineMethods Style/EmptyLineBetweenDefs
|
18
19
|
end
|
@@ -115,6 +116,11 @@ module Archive::Tar::Minitar
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
119
|
+
# Returns false if the entry stream is valid.
|
120
|
+
def closed?
|
121
|
+
false
|
122
|
+
end
|
123
|
+
|
118
124
|
# Closes the entry.
|
119
125
|
def close
|
120
126
|
invalidate
|
@@ -135,9 +141,14 @@ module Archive::Tar::Minitar
|
|
135
141
|
def self.open(io)
|
136
142
|
reader = new(io)
|
137
143
|
return reader unless block_given?
|
138
|
-
|
139
|
-
|
140
|
-
|
144
|
+
|
145
|
+
# This exception context must remain, otherwise the stream closes on open
|
146
|
+
# even if a block is not given.
|
147
|
+
begin
|
148
|
+
yield reader
|
149
|
+
ensure
|
150
|
+
reader.close
|
151
|
+
end
|
141
152
|
end
|
142
153
|
|
143
154
|
# Iterates over each entry in the provided input. This wraps the common
|
@@ -231,6 +242,11 @@ module Archive::Tar::Minitar
|
|
231
242
|
end
|
232
243
|
alias each each_entry
|
233
244
|
|
245
|
+
# Returns false if the reader is open (it never closes).
|
246
|
+
def closed?
|
247
|
+
false
|
248
|
+
end
|
249
|
+
|
234
250
|
def close
|
235
251
|
end
|
236
252
|
end
|
@@ -84,9 +84,14 @@ module Archive::Tar::Minitar
|
|
84
84
|
def self.open(io) # :yields Writer:
|
85
85
|
writer = new(io)
|
86
86
|
return writer unless block_given?
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
|
88
|
+
# This exception context must remain, otherwise the stream closes on open
|
89
|
+
# even if a block is not given.
|
90
|
+
begin
|
91
|
+
yield writer
|
92
|
+
ensure
|
93
|
+
writer.close
|
94
|
+
end
|
90
95
|
end
|
91
96
|
|
92
97
|
# Creates and returns a new Writer object.
|
@@ -255,6 +260,11 @@ module Archive::Tar::Minitar
|
|
255
260
|
@io.flush if @io.respond_to?(:flush)
|
256
261
|
end
|
257
262
|
|
263
|
+
# Returns false if the writer is open.
|
264
|
+
def closed?
|
265
|
+
@closed
|
266
|
+
end
|
267
|
+
|
258
268
|
# Closes the Writer. This does not close the underlying wrapped output
|
259
269
|
# stream.
|
260
270
|
def close
|
data/test/test_tar_input.rb
CHANGED
@@ -38,6 +38,15 @@ UTAKRsEoGAWjYBSMglEwCkbBKBgFo2AUjIJRMApGwSgYBaNgFIwCUgAAGnyo6wAoAAA=
|
|
38
38
|
FileUtils.rm_rf('data__')
|
39
39
|
end
|
40
40
|
|
41
|
+
def test_open_no_block
|
42
|
+
reader = Zlib::GzipReader.new(StringIO.new(TEST_TGZ))
|
43
|
+
input = Minitar::Input.open(reader)
|
44
|
+
refute input.closed?
|
45
|
+
ensure
|
46
|
+
input.close
|
47
|
+
assert input.closed?
|
48
|
+
end
|
49
|
+
|
41
50
|
def test_each_works
|
42
51
|
reader = Zlib::GzipReader.new(StringIO.new(TEST_TGZ))
|
43
52
|
Minitar::Input.open(reader) do |stream|
|
data/test/test_tar_output.rb
CHANGED
@@ -19,6 +19,14 @@ class TestTarOutput < Minitest::Test
|
|
19
19
|
FileUtils.rm_rf('data__')
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_open_no_block
|
23
|
+
output = Minitar::Output.open(@tarfile)
|
24
|
+
refute output.closed?
|
25
|
+
ensure
|
26
|
+
output.close
|
27
|
+
assert output.closed?
|
28
|
+
end
|
29
|
+
|
22
30
|
def test_file_looks_good
|
23
31
|
Minitar::Output.open(@tarfile) do |os|
|
24
32
|
Dir.chdir('data__') do
|
data/test/test_tar_reader.rb
CHANGED
@@ -4,6 +4,19 @@ require 'minitar'
|
|
4
4
|
require 'minitest_helper'
|
5
5
|
|
6
6
|
class TestTarReader < Minitest::Test
|
7
|
+
def test_open_no_block
|
8
|
+
str = tar_file_header('lib/foo', '', 0o10644, 10) + "\0" * 512
|
9
|
+
str += tar_file_header('bar', 'baz', 0o644, 0)
|
10
|
+
str += tar_dir_header('foo', 'bar', 0o12345)
|
11
|
+
str += "\0" * 1024
|
12
|
+
|
13
|
+
reader = Minitar::Reader.open(StringIO.new(str))
|
14
|
+
refute reader.closed?
|
15
|
+
ensure
|
16
|
+
reader.close
|
17
|
+
refute reader.closed? # Reader doesn't actually close anything
|
18
|
+
end
|
19
|
+
|
7
20
|
def test_multiple_entries
|
8
21
|
str = tar_file_header('lib/foo', '', 0o10644, 10) + "\0" * 512
|
9
22
|
str += tar_file_header('bar', 'baz', 0o644, 0)
|
data/test/test_tar_writer.rb
CHANGED
@@ -31,6 +31,15 @@ class TestTarWriter < Minitest::Test
|
|
31
31
|
@os.close
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_open_no_block
|
35
|
+
writer = Minitar::Writer.open(@dummyos)
|
36
|
+
refute writer.closed?
|
37
|
+
ensure
|
38
|
+
writer.close
|
39
|
+
assert writer.closed?
|
40
|
+
end
|
41
|
+
|
42
|
+
|
34
43
|
def test_add_file_simple
|
35
44
|
@dummyos.reset
|
36
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hoe-doofus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|