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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 150b59609ddd7cc25d201add8a4017dbfd9c62ad12894488f4d2f6581bb1d9a1
4
- data.tar.gz: b2a22f491adeb41dc2b7edea330f7b85ee0a675d86e37e86d32906119c6b44f5
3
+ metadata.gz: a9725e1be993e0d60d29c12cca14f459e896120e1d0ba26a6b1813041f66c47f
4
+ data.tar.gz: 9c8258673a8ca2be4ecd4a05d239bbb2ba75141a2134efb500ea28a1cf7ccdb4
5
5
  SHA512:
6
- metadata.gz: a7324848cc585610590c50ead1f9c235cb859ce8290bd7357db8687e3a65192ed91e9d7d701c51ccab1e37f2420914c5736a9f5124155190e786b3473ca0bb9c
7
- data.tar.gz: a6f243605187313296b9470fcf1994345d903c60bc2f43826ff8e8312a5eda1ff185bb4a729f093ee267528eea7986a408ffcd3b5f01ea0dc723d99d516b6007
6
+ metadata.gz: '0470877e42c476aee66f2d17ad906c4c3d56335c85395eb4f379e448ea8546cbbb3b2b714afaca03b477527a082b70f4d99b7a38a8ad41dca4a44637ae4b4952'
7
+ data.tar.gz: 294c8875e163b62e340b9fc01cbcbf5a6b5042f263e3b395b7346aca51a1b289ef55d0a3dc799fc3047accaa5eab9dbeac33a7c31b446f29c544cdc4614a0eba
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.2.0] - 2026-02-22
4
+
5
+ - **Breaking**: Requires Ruby 2.7 or newer.
6
+ - Otherwise, no functional changes.
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.1.2"
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://github.com/pat/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.
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://github.com/pat/gzipped_tar/blob/master/CODE_OF_CONDUCT.md).
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 => e
56
- raise unless e.message == "string contains null byte"
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*").inject { |a, b| a + b }
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
- return yield found
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 > 0
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?
@@ -36,7 +36,7 @@ class GZippedTar::Tar::SplitName
36
36
  end
37
37
 
38
38
  def name
39
- parts[(last_prefix_index + 1)..-1].join("/")
39
+ parts[(last_prefix_index + 1)..].join("/")
40
40
  end
41
41
 
42
42
  def parts
@@ -5,13 +5,23 @@ module GZippedTar
5
5
  ROW_WIDTH = 512
6
6
  EMPTY_ROW = "\0" * ROW_WIDTH
7
7
 
8
- Error = Class.new StandardError
8
+ class Error < StandardError
9
+ end
9
10
 
10
- FileOverflow = Class.new Error
11
- NonSeekableIO = Class.new Error
12
- TarInvalidError = Class.new Error
13
- TooLongFileName = Class.new Error
14
- UnexpectedEOF = Class.new Error
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
 
@@ -22,7 +22,7 @@ module GZippedTar
22
22
  private
23
23
 
24
24
  def binary_io
25
- io = StringIO.new "".dup, "r+b"
25
+ io = StringIO.new (+""), "r+b"
26
26
  io.set_encoding "BINARY"
27
27
  io
28
28
  end
data/lib/gzipped_tar.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require "digest"
4
4
 
5
5
  module GZippedTar
6
- #
7
6
  end
8
7
 
9
8
  require "gzipped_tar/tar"
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.1.2
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: 2020-04-08 00:00:00.000000000 Z
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
- - ".gitignore"
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://github.com/pat/gzipped_tar
38
+ homepage: https://codeberg.org/patallan/gzipped_tar
76
39
  licenses:
77
40
  - MIT
78
- metadata: {}
79
- post_install_message:
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: '0'
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.0.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
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
10
- .rubocop-*-yml
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
@@ -1,15 +0,0 @@
1
- language: ruby
2
- script: bundle exec rake
3
- cache: bundler
4
- rvm:
5
- - 1.9.3
6
- - 2.0
7
- - 2.1.10
8
- - 2.2.10
9
- - 2.3.8
10
- - 2.4.10
11
- - 2.5.8
12
- - 2.6.6
13
- - 2.7.1
14
- - jruby-9.1.17.0
15
- - jruby-9.2.11.1
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- gem "rubocop", "0.51.0" if RUBY_VERSION.to_f >= 2.1
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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
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