bin/appbundle-updater in appbundle-updater-0.2.4 vs bin/appbundle-updater in appbundle-updater-0.2.5
- old
+ new
@@ -58,26 +58,13 @@
ENV_KEYS.each { |key| ENV[key] = ENV.delete("_YOLO_#{key}") }
end
TAR_LONGLINK = '././@LongLink'
-def extract_tgz(file, destination = '.')
- if windows?
- extract_tgz_windows(file, destination)
- else
- extract_tgz_unix(file, destination)
- end
-end
-
-# our windows omnibus packages all are guaranteed to have tar
-def extract_tgz_windows(file, destination = '.')
- run("tar xf #{file} --directory #{destination}")
-end
-
# pure ruby `tar xzf`, handles longlinks and directories ending in '/'
# (http://stackoverflow.com/a/31310593/506908)
-def extract_tgz_unix(file, destination = '.')
+def extract_tgz(file, destination = '.')
# NOTE: THIS IS DELIBERATELY PURE RUBY USING NO NATIVE GEMS AND ONLY
# THE RUBY STDLIB BY DESIGN
Gem::Package::TarReader.new( Zlib::GzipReader.open file ) do |tar|
dest = nil
tar.each do |entry|
@@ -179,9 +166,10 @@
# THE RUBY STDLIB BY DESIGN
git_url = "https://github.com/#{repo}/archive/#{ref}.tar.gz"
banner("Extracting #{app} from #{git_url}")
Dir.chdir(chefdk.join("embedded/apps")) do
Tempfile.open('appbundle-updater') do |tempfile|
+ tempfile.binmode
open(git_url) do |uri|
tempfile.write(uri.read)
end
tempfile.close
extract_tgz(tempfile.path)