Remove archive::tar::minitar from tests
This commit is contained in:
parent
d4cf03d6c5
commit
64af19c783
|
@ -2,11 +2,11 @@ require "fileutils"
|
||||||
require "pathname"
|
require "pathname"
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
|
|
||||||
require "archive/tar/minitar"
|
|
||||||
require "json"
|
require "json"
|
||||||
require "log4r"
|
require "log4r"
|
||||||
|
|
||||||
require "vagrant/util/platform"
|
require "vagrant/util/platform"
|
||||||
|
require "vagrant/util/subprocess"
|
||||||
|
|
||||||
require "support/isolated_environment"
|
require "support/isolated_environment"
|
||||||
require "support/tempdir"
|
require "support/tempdir"
|
||||||
|
@ -108,27 +108,17 @@ module Unit
|
||||||
# The destination file
|
# The destination file
|
||||||
result = Pathname.new(td_dest.path).join("temporary.box")
|
result = Pathname.new(td_dest.path).join("temporary.box")
|
||||||
|
|
||||||
File.open(result, Vagrant::Util::Platform.tar_file_options) do |tar|
|
# Put a "box.ovf" in there.
|
||||||
Archive::Tar::Minitar::Output.open(tar) do |output|
|
source.join("box.ovf").open("w") do |f|
|
||||||
begin
|
f.write("FOO!")
|
||||||
# Switch to the source directory so that Archive::Tar::Minitar
|
end
|
||||||
# can tar things up.
|
|
||||||
current_dir = FileUtils.pwd
|
|
||||||
FileUtils.cd(source)
|
|
||||||
|
|
||||||
# Put a "box.ovf" in there.
|
Dir.chdir(source) do
|
||||||
source.join("box.ovf").open("w") do |f|
|
# Find all the files in our current directory and tar it up!
|
||||||
f.write("FOO!")
|
files = Dir.glob(File.join(".", "**", "*"))
|
||||||
end
|
|
||||||
|
|
||||||
# Add all the files
|
# Package!
|
||||||
Dir.glob(File.join(".", "**", "*")).each do |entry|
|
Vagrant::Util::Subprocess.execute("bsdtar", "-czf", result.to_s, *files)
|
||||||
Archive::Tar::Minitar.pack_file(entry, output)
|
|
||||||
end
|
|
||||||
ensure
|
|
||||||
FileUtils.cd(current_dir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Resulting box
|
# Resulting box
|
||||||
|
@ -161,27 +151,17 @@ module Unit
|
||||||
# The destination file
|
# The destination file
|
||||||
result = Pathname.new(td_dest.path).join("temporary.box")
|
result = Pathname.new(td_dest.path).join("temporary.box")
|
||||||
|
|
||||||
File.open(result, Vagrant::Util::Platform.tar_file_options) do |tar|
|
# Put the metadata.json in here.
|
||||||
Archive::Tar::Minitar::Output.open(tar) do |output|
|
source.join("metadata.json").open("w") do |f|
|
||||||
begin
|
f.write(JSON.generate(metadata))
|
||||||
# Switch to the source directory so that Archive::Tar::Minitar
|
end
|
||||||
# can tar things up.
|
|
||||||
current_dir = FileUtils.pwd
|
|
||||||
FileUtils.cd(source)
|
|
||||||
|
|
||||||
# Put the metadata.json in here.
|
Dir.chdir(source) do
|
||||||
source.join("metadata.json").open("w") do |f|
|
# Find all the files in our current directory and tar it up!
|
||||||
f.write(JSON.generate(metadata))
|
files = Dir.glob(File.join(".", "**", "*"))
|
||||||
end
|
|
||||||
|
|
||||||
# Add all the files
|
# Package!
|
||||||
Dir.glob(File.join(".", "**", "*")).each do |entry|
|
Vagrant::Util::Subprocess.execute("bsdtar", "-czf", result.to_s, *files)
|
||||||
Archive::Tar::Minitar.pack_file(entry, output)
|
|
||||||
end
|
|
||||||
ensure
|
|
||||||
FileUtils.cd(current_dir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Resulting box
|
# Resulting box
|
||||||
|
|
Loading…
Reference in New Issue