Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constrain minitar gem version and fix require #30

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion berkshelf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ Gem::Specification.new do |s|
"changelog_uri" => "https://github.com/chef/berkshelf/blob/main/CHANGELOG.md",
}

ruby_version = Gem::Version.new(RUBY_VERSION)

s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"

s.add_dependency "chef-cleanroom", "~> 1.0"
s.add_dependency "minitar", ">= 0.6"

if ruby_version >= "3.1"
s.add_dependency "minitar", "~> 1.0"
else
s.add_dependency "minitar", "~> 0.12"
end

s.add_dependency "retryable", ">= 2.0", "< 4.0"
s.add_dependency "solve", "~> 4.0"
s.add_dependency "thor", ">= 0.20"
Expand Down
8 changes: 4 additions & 4 deletions lib/berkshelf/packager.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "archive/tar/minitar"
require "minitar"
require "find" unless defined?(Find)
require "zlib" unless defined?(Zlib)

Expand Down Expand Up @@ -47,7 +47,7 @@ def run(source)
Find.find(source) do |entry|
next if source == entry

Archive::Tar::Minitar.pack_file(entry, tar)
Minitar.pack_file(entry, tar)
end
ensure
tar.close
Expand Down Expand Up @@ -79,12 +79,12 @@ def validate!
# @return [String]
attr_reader :filename

# A private decorator for Archive::Tar::Minitar::Writer that
# A private decorator for Minitar::Writer that
# turns absolute paths into relative ones.
class RelativeTarWriter < SimpleDelegator # :nodoc:
def initialize(io, base_path)
@base_path = Pathname.new(base_path)
super(Archive::Tar::Minitar::Writer.new(io))
super(Minitar::Writer.new(io))
end

%w{add_file add_file_simple mkdir}.each do |method|
Expand Down
Loading