lib/java_buildpack/versioned_dependency_component.rb
# Downloads a given ZIP file and expands it to a given destination.
#
# @param [String] target_directory the path of the directory into which to expand the item
# @param [Boolean] strip_top_level_directory Whether to strip the top-level directory when expanding. Defaults to +true+.
# @param [String] description an optional description for the download and expansion.  Defaults to +@component_name+.
Downloads a given ZIP file and expands it to a given destination.
Downloads a given ZIP file and expands it to a given destination .
def download_zip(target_directory, strip_top_level_directory = true, description = @component_name, wipe_target_directory = true)
      download(description) do |file|
        expand_start_time = Time.now
        print "       Expanding #{description} to #{target_directory} "
        if wipe_target_directory
          FileUtils.rm_rf target_directory
          FileUtils.mkdir_p File.dirname(target_directory)
        end
        if strip_top_level_directory
          Dir.mktmpdir do |root|
            shell "unzip -qq #{file.path} -d #{root} 2>&1"
            shell "mv #{root}/$(ls #{root}) #{target_directory}"
          end
        else
          shell "unzip -qq #{file.path} -d #{target_directory} 2>&1"
        end
        puts "(#{(Time.now - expand_start_time).duration})"
      end
    end
def download_zip ( target_directory , strip_top_level_directory = true , description = @component_name , wipe_target_directory = true ) download ( description ) do | file | expand_start_time = Time . now print "       Expanding #{description} to #{target_directory} " if wipe_target_directory FileUtils . rm_rf target_directory FileUtils . mkdir_p File . dirname ( target_directory ) end if strip_top_level_directory Dir . mktmpdir do | root | shell "unzip -qq #{file.path} -d #{root} 2>&1" shell "mv #{root}/$(ls #{root}) #{target_directory}" end else shell "unzip -qq #{file.path} -d #{target_directory} 2>&1" end puts "(#{(Time.now - expand_start_time).duration})" end end
Downloads a given ZIP file and expands it to a given destination.
Downloads a given ZIP file and expands it to a given destination .
target_directory
strip_top_level_directory
description
wipe_target_directory
description an optional description for the download and expansion. Defaults to +@component_name+.
description an optional description for the download and expansion . Defaults to + @component_name + .