vagrant and chef install everything

This commit is contained in:
2019-09-02 16:48:23 -04:00
parent 4fb554add5
commit f1809bef83
268 changed files with 16021 additions and 7 deletions

View File

@ -0,0 +1,48 @@
module Ark
class UnzipCommandBuilder
def unpack
if resource.strip_components > 0
unzip_with_strip_components
else
"unzip -q -o #{resource.release_file} -d #{resource.path}"
end
end
def dump
"unzip -j -q -o \"#{resource.release_file}\" -d \"#{resource.path}\""
end
def cherry_pick
cmd = "unzip -t #{resource.release_file} \"*/#{resource.creates}\" ; stat=$? ;"
cmd += 'if [ $stat -eq 11 ] ; then '
cmd += "unzip -j -o #{resource.release_file} \"#{resource.creates}\" -d #{resource.path} ;"
cmd += 'elif [ $stat -ne 0 ] ; then false ;'
cmd += 'else '
cmd += "unzip -j -o #{resource.release_file} \"*/#{resource.creates}\" -d #{resource.path} ;"
cmd += 'fi'
cmd
end
def initialize(resource)
@resource = resource
end
private
attr_reader :resource
def unzip_with_strip_components
tmpdir = make_temp_directory
strip_dir = '*/' * resource.strip_components
cmd = "unzip -q -o #{resource.release_file} -d #{tmpdir}"
cmd += " && rsync -a #{tmpdir}/#{strip_dir} #{resource.path}"
cmd += " && rm -rf #{tmpdir}"
cmd
end
def make_temp_directory
require 'tmpdir'
Dir.mktmpdir
end
end
end