Skip to content

Commit 8bd1af2

Browse files
committed
fixup! chore: Prepare for release of 1.1.0
1 parent 5459178 commit 8bd1af2

File tree

4 files changed

+49
-18
lines changed

4 files changed

+49
-18
lines changed

Rakefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ hoe = Hoe.spec "minitar" do
2929
val["rubygems_mfa_required"] = "true"
3030
}
3131

32-
extra_dev_deps << ["base64", "~> 0.2"]
3332
extra_dev_deps << ["hoe", "~> 4.0"]
3433
extra_dev_deps << ["hoe-halostatue", "~> 2.1", ">= 2.1.1"]
3534
extra_dev_deps << ["irb", "~> 1.0"]
@@ -89,8 +88,8 @@ task docs: :rerdoc
8988

9089
task :console do
9190
arguments = %w[irb]
92-
arguments.push(*spec.spec.require_paths.map { |dir| "-I#{dir}" })
93-
arguments.push("-r#{spec.spec.name.gsub("-", File::SEPARATOR)}")
91+
arguments.push(*hoe.spec.require_paths.map { |dir| "-I#{dir}" })
92+
arguments.push("-r#{hoe.spec.name.gsub("-", File::SEPARATOR)}")
9493
unless system(*arguments)
9594
error "Command failed: #{show_command}"
9695
abort

minitar.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
2323

2424
s.specification_version = 4
2525

26-
s.add_development_dependency(%q<base64>.freeze, ["~> 0.2".freeze])
2726
s.add_development_dependency(%q<hoe>.freeze, ["~> 4.0".freeze])
2827
s.add_development_dependency(%q<hoe-halostatue>.freeze, ["~> 2.1".freeze, ">= 2.1.1".freeze])
2928
s.add_development_dependency(%q<irb>.freeze, ["~> 1.0".freeze])

test/minitest_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "base64"
43
require "fileutils"
54
require "minitar"
65
require "pathname"

test/support/minitar_test_helpers/tarball.rb

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require "open3"
4+
35
# Test assertions and helpers for working with tarballs.
46
#
57
# Includes Minitar in-memory and on-disk operations and GNU tar helpers.
@@ -143,14 +145,7 @@ def prepare_workspace(with_files:)
143145
def gnu_tar_create_in_workspace
144146
missing_workspace!
145147

146-
if Minitar.windows?
147-
p @workspace.tarball.to_s, @workspace.source.to_s
148-
end
149-
150-
system(
151-
GNU_TAR, "-cf", @workspace.tarball.to_s, "-C", @workspace.source.to_s, ".",
152-
exception: true
153-
)
148+
__gnu_tar(:create)
154149

155150
assert @workspace.tarball.file?, "Workspace tarball not created by GNU tar"
156151
assert @workspace.tarball.size > 0, "Workspace tarball should not be empty"
@@ -162,10 +157,7 @@ def gnu_tar_extract_in_workspace
162157
assert @workspace.tarball.file?, "Workspace tarball not present for extraction"
163158
assert @workspace.tarball.size > 0, "Workspace tarball should not be empty"
164159

165-
system(
166-
GNU_TAR, "-xf", @workspace.tarball.to_s, "-C", @workspace.target.to_s,
167-
exception: true
168-
)
160+
__gnu_tar(:extract)
169161
end
170162

171163
def gnu_tar_list_in_workspace
@@ -174,7 +166,7 @@ def gnu_tar_list_in_workspace
174166
assert @workspace.tarball.file?, "Workspace tarball not present for extraction"
175167
assert @workspace.tarball.size > 0, "Workspace tarball should not be empty"
176168

177-
`#{GNU_TAR} -tf "#{@workspace.tarball}" 2>/dev/null`.strip.split($/)
169+
__gnu_tar(:list).strip.split($/)
178170
end
179171

180172
def minitar_pack_in_workspace
@@ -285,5 +277,47 @@ def missing_workspace!
285277
raise "Missing workspace" unless defined?(@workspace)
286278
end
287279

280+
def __gnu_tar(action)
281+
missing_workspace!
282+
283+
cmd = [GNU_TAR]
284+
cmd.push("--force-local") if Minitar.windows?
285+
286+
case action
287+
when :create
288+
cmd.push("-cf", @workspace.tarball.to_s, "-C", @workspace.source.to_s, ".")
289+
when :extract
290+
cmd.push("-xf", @workspace.tarball.to_s, "-C", @workspace.target.to_s)
291+
when :list
292+
cmd.push("-tf", @workspace.tarball.to_s)
293+
end
294+
295+
stdout_str = ""
296+
stderr_str = ""
297+
status = nil
298+
299+
Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr|
300+
stdin.close
301+
out_t = Thread.new { stdout.read }
302+
err_t = Thread.new { stderr.read }
303+
stdout_str = out_t.value.to_s
304+
stderr_str = err_t.value.to_s
305+
status = wait_thr.value
306+
end
307+
308+
unless status.success?
309+
warn stdout_str unless stdout_str.empty?
310+
warn stderr_str unless stderr_str.empty?
311+
312+
if status.exited?
313+
raise "command #{cmd.join(" ")} failed (exit status: #{status.exitstatus})"
314+
else
315+
raise "command #{cmd.join(" ")} failed (status: #{status.inspect})"
316+
end
317+
end
318+
319+
stdout_str
320+
end
321+
288322
Minitest::Test.send(:include, self)
289323
end

0 commit comments

Comments
 (0)