gzipped_tar 0.1.2 → 0.2.0
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 +6 -0
- data/README.md +3 -3
- data/lib/gzipped_tar/tar/entry.rb +6 -5
- data/lib/gzipped_tar/tar/header.rb +3 -3
- data/lib/gzipped_tar/tar/reader.rb +5 -2
- data/lib/gzipped_tar/tar/split_name.rb +1 -1
- data/lib/gzipped_tar/tar.rb +16 -6
- data/lib/gzipped_tar/writer.rb +1 -1
- data/lib/gzipped_tar.rb +0 -1
- metadata +12 -47
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -26
- data/.travis.yml +0 -15
- data/Gemfile +0 -7
- data/Rakefile +0 -15
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/gzipped_tar.gemspec +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9725e1be993e0d60d29c12cca14f459e896120e1d0ba26a6b1813041f66c47f
|
|
4
|
+
data.tar.gz: 9c8258673a8ca2be4ecd4a05d239bbb2ba75141a2134efb500ea28a1cf7ccdb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0470877e42c476aee66f2d17ad906c4c3d56335c85395eb4f379e448ea8546cbbb3b2b714afaca03b477527a082b70f4d99b7a38a8ad41dca4a44637ae4b4952'
|
|
7
|
+
data.tar.gz: 294c8875e163b62e340b9fc01cbcbf5a6b5042f263e3b395b7346aca51a1b289ef55d0a3dc799fc3047accaa5eab9dbeac33a7c31b446f29c544cdc4614a0eba
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A simple interface for reading and writing gzipped tar files (.tar.gz) in memory
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```ruby
|
|
8
|
-
gem "gzipped_tar", "~> 0.
|
|
8
|
+
gem "gzipped_tar", "~> 0.2.0"
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -31,7 +31,7 @@ reader.read "file.txt" #=> "hello world"
|
|
|
31
31
|
|
|
32
32
|
## Contributing
|
|
33
33
|
|
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://
|
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://codeberg.org/patallan/gzipped_tar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
35
35
|
|
|
36
36
|
## License
|
|
37
37
|
|
|
@@ -39,4 +39,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
39
39
|
|
|
40
40
|
## Code of Conduct
|
|
41
41
|
|
|
42
|
-
Everyone interacting in the GZipped Tar project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
|
42
|
+
Everyone interacting in the GZipped Tar project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://codeberg.org/patallan/gzipped_tar/src/branch/main/CODE_OF_CONDUCT.md).
|
|
@@ -47,13 +47,14 @@ class GZippedTar::Tar::Entry
|
|
|
47
47
|
|
|
48
48
|
# Full name of the tar entry
|
|
49
49
|
def full_name
|
|
50
|
-
if @header.prefix
|
|
51
|
-
File.join @header.prefix, @header.name
|
|
52
|
-
else
|
|
50
|
+
if @header.prefix == ""
|
|
53
51
|
@header.name
|
|
52
|
+
else
|
|
53
|
+
File.join @header.prefix, @header.name
|
|
54
54
|
end
|
|
55
|
-
rescue ArgumentError =>
|
|
56
|
-
raise unless
|
|
55
|
+
rescue ArgumentError => error
|
|
56
|
+
raise unless error.message == "string contains null byte"
|
|
57
|
+
|
|
57
58
|
raise GZippedTar::Tar::TarInvalidError,
|
|
58
59
|
"tar is corrupt, name contains null byte"
|
|
59
60
|
end
|
|
@@ -57,8 +57,8 @@ class GZippedTar::Tar::Header
|
|
|
57
57
|
].freeze
|
|
58
58
|
# rubocop:enable Layout/ExtraSpacing
|
|
59
59
|
|
|
60
|
-
PACK_FORMAT = FIELDS.collect(&:pack).join
|
|
61
|
-
UNPACK_FORMAT = FIELDS.collect(&:unpack).join
|
|
60
|
+
PACK_FORMAT = FIELDS.collect(&:pack).join
|
|
61
|
+
UNPACK_FORMAT = FIELDS.collect(&:unpack).join
|
|
62
62
|
HEADER_LENGTH = 512
|
|
63
63
|
BLANK = {
|
|
64
64
|
:name => "",
|
|
@@ -133,7 +133,7 @@ class GZippedTar::Tar::Header
|
|
|
133
133
|
private
|
|
134
134
|
|
|
135
135
|
def calculate_checksum(header)
|
|
136
|
-
header.unpack("C*").
|
|
136
|
+
header.unpack("C*").sum
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def build_header
|
|
@@ -44,6 +44,7 @@ class GZippedTar::Tar::Reader
|
|
|
44
44
|
until @io.eof?
|
|
45
45
|
header = GZippedTar::Tar::Header.from @io
|
|
46
46
|
return if header.empty?
|
|
47
|
+
|
|
47
48
|
entry = GZippedTar::Tar::Entry.new header, @io
|
|
48
49
|
|
|
49
50
|
yield entry
|
|
@@ -62,9 +63,11 @@ class GZippedTar::Tar::Reader
|
|
|
62
63
|
def rewind
|
|
63
64
|
if @init_pos.zero?
|
|
64
65
|
raise GZippedTar::Tar::NonSeekableIO unless @io.respond_to? :rewind
|
|
66
|
+
|
|
65
67
|
@io.rewind
|
|
66
68
|
else
|
|
67
69
|
raise GZippedTar::Tar::NonSeekableIO unless @io.respond_to? :pos=
|
|
70
|
+
|
|
68
71
|
@io.pos = @init_pos
|
|
69
72
|
end
|
|
70
73
|
end
|
|
@@ -79,7 +82,7 @@ class GZippedTar::Tar::Reader
|
|
|
79
82
|
|
|
80
83
|
return unless found
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
yield found
|
|
83
86
|
ensure
|
|
84
87
|
rewind
|
|
85
88
|
end
|
|
@@ -98,7 +101,7 @@ class GZippedTar::Tar::Reader
|
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
def skip_by_read(pending)
|
|
101
|
-
while pending
|
|
104
|
+
while pending.positive?
|
|
102
105
|
bytes_read = io.read([pending, 4096].min).size
|
|
103
106
|
pending -= bytes_read
|
|
104
107
|
raise GZippedTar::Tar::UnexpectedEOF if io.eof? && !pending.zero?
|
data/lib/gzipped_tar/tar.rb
CHANGED
|
@@ -5,13 +5,23 @@ module GZippedTar
|
|
|
5
5
|
ROW_WIDTH = 512
|
|
6
6
|
EMPTY_ROW = "\0" * ROW_WIDTH
|
|
7
7
|
|
|
8
|
-
Error
|
|
8
|
+
class Error < StandardError
|
|
9
|
+
end
|
|
9
10
|
|
|
10
|
-
FileOverflow
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
class FileOverflow < Error
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class NonSeekableIO < Error
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class TarInvalidError < Error
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class TooLongFileName < Error
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class UnexpectedEOF < Error
|
|
24
|
+
end
|
|
15
25
|
end
|
|
16
26
|
end
|
|
17
27
|
|
data/lib/gzipped_tar/writer.rb
CHANGED
data/lib/gzipped_tar.rb
CHANGED
metadata
CHANGED
|
@@ -1,61 +1,24 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gzipped_tar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pat Allan
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: rake
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rspec
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3.7'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3.7'
|
|
41
|
-
description:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
42
12
|
email:
|
|
43
13
|
- pat@freelancing-gods.com
|
|
44
14
|
executables: []
|
|
45
15
|
extensions: []
|
|
46
16
|
extra_rdoc_files: []
|
|
47
17
|
files:
|
|
48
|
-
-
|
|
49
|
-
- ".rubocop.yml"
|
|
50
|
-
- ".travis.yml"
|
|
18
|
+
- CHANGELOG.md
|
|
51
19
|
- CODE_OF_CONDUCT.md
|
|
52
|
-
- Gemfile
|
|
53
20
|
- LICENSE.txt
|
|
54
21
|
- README.md
|
|
55
|
-
- Rakefile
|
|
56
|
-
- bin/console
|
|
57
|
-
- bin/setup
|
|
58
|
-
- gzipped_tar.gemspec
|
|
59
22
|
- lib/gzipped_tar.rb
|
|
60
23
|
- lib/gzipped_tar/reader.rb
|
|
61
24
|
- lib/gzipped_tar/tar.rb
|
|
@@ -72,11 +35,14 @@ files:
|
|
|
72
35
|
- lib/gzipped_tar/tar/write_signed_file.rb
|
|
73
36
|
- lib/gzipped_tar/tar/writer.rb
|
|
74
37
|
- lib/gzipped_tar/writer.rb
|
|
75
|
-
homepage: https://
|
|
38
|
+
homepage: https://codeberg.org/patallan/gzipped_tar
|
|
76
39
|
licenses:
|
|
77
40
|
- MIT
|
|
78
|
-
metadata:
|
|
79
|
-
|
|
41
|
+
metadata:
|
|
42
|
+
homepage_uri: https://codeberg.org/patallan/gzipped_tar
|
|
43
|
+
source_code_uri: https://codeberg.org/patallan/gzipped_tar
|
|
44
|
+
changelog_uri: https://codeberg.org/patallan/gzipped_tar/src/branch/main/CHANGELOG.md
|
|
45
|
+
rubygems_mfa_required: 'true'
|
|
80
46
|
rdoc_options: []
|
|
81
47
|
require_paths:
|
|
82
48
|
- lib
|
|
@@ -84,15 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
84
50
|
requirements:
|
|
85
51
|
- - ">="
|
|
86
52
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '
|
|
53
|
+
version: '2.7'
|
|
88
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
55
|
requirements:
|
|
90
56
|
- - ">="
|
|
91
57
|
- !ruby/object:Gem::Version
|
|
92
58
|
version: '0'
|
|
93
59
|
requirements: []
|
|
94
|
-
rubygems_version: 3.
|
|
95
|
-
signing_key:
|
|
60
|
+
rubygems_version: 3.7.2
|
|
96
61
|
specification_version: 4
|
|
97
62
|
summary: In-memory reading/writing of .tar.gz files
|
|
98
63
|
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
inherit_from:
|
|
2
|
-
- https://gist.githubusercontent.com/pat/ba3b8ffb1901bfe5439b460943b6b019/raw/.rubocop.yml
|
|
3
|
-
|
|
4
|
-
AllCops:
|
|
5
|
-
TargetRubyVersion: 2.1
|
|
6
|
-
|
|
7
|
-
Layout/AlignParameters:
|
|
8
|
-
EnforcedStyle: with_fixed_indentation
|
|
9
|
-
|
|
10
|
-
Performance/RedundantBlockCall:
|
|
11
|
-
Enabled: false
|
|
12
|
-
|
|
13
|
-
Style/AsciiComments:
|
|
14
|
-
Enabled: false
|
|
15
|
-
|
|
16
|
-
Style/Documentation:
|
|
17
|
-
Enabled: false
|
|
18
|
-
|
|
19
|
-
Style/RedundantFreeze:
|
|
20
|
-
Enabled: false
|
|
21
|
-
|
|
22
|
-
Style/SafeNavigation:
|
|
23
|
-
Enabled: false
|
|
24
|
-
|
|
25
|
-
Style/SymbolArray:
|
|
26
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler/gem_tasks"
|
|
4
|
-
require "rspec/core/rake_task"
|
|
5
|
-
|
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
-
task :default => :spec
|
|
8
|
-
|
|
9
|
-
if RUBY_VERSION.to_f >= 2.1
|
|
10
|
-
require "rubocop/rake_task"
|
|
11
|
-
RuboCop::RakeTask.new(:rubocop)
|
|
12
|
-
|
|
13
|
-
Rake::Task["default"].clear if Rake::Task.task_defined?("default")
|
|
14
|
-
task :default => [:rubocop, :spec]
|
|
15
|
-
end
|
data/bin/console
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "bundler/setup"
|
|
5
|
-
require "gzipped_tar"
|
|
6
|
-
|
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
-
|
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
-
# require "pry"
|
|
12
|
-
# Pry.start
|
|
13
|
-
|
|
14
|
-
require "irb"
|
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/gzipped_tar.gemspec
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name = "gzipped_tar"
|
|
5
|
-
spec.version = "0.1.2"
|
|
6
|
-
spec.authors = ["Pat Allan"]
|
|
7
|
-
spec.email = ["pat@freelancing-gods.com"]
|
|
8
|
-
|
|
9
|
-
spec.summary = "In-memory reading/writing of .tar.gz files"
|
|
10
|
-
spec.homepage = "https://github.com/pat/gzipped_tar"
|
|
11
|
-
spec.license = "MIT"
|
|
12
|
-
|
|
13
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |file|
|
|
14
|
-
file.match(%r{^(test|spec|features)/})
|
|
15
|
-
end
|
|
16
|
-
spec.bindir = "exe"
|
|
17
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
|
|
18
|
-
spec.require_paths = ["lib"]
|
|
19
|
-
|
|
20
|
-
spec.add_development_dependency "rake"
|
|
21
|
-
spec.add_development_dependency "rspec", "~> 3.7"
|
|
22
|
-
end
|