lib/zipr/archive.rb
#
# Description:
#   Determines what files should be extracted based on the options and mode provided.
# Returns:
#   An array of files to be extracted (or the :all symbol).
# Parameters:
#   destination_folder: Where the files would be extracted to.
#   files_to_check: Array of files intended to be extracted from an archive. Should be relative names/paths with or without asterisk wildcards or a regular expression.
#     default: All files and folders in the archive.
Determines what files should be extracted based on the options and mode provided.
Returns:
An array of files to be extracted (or the :all symbol).
Parameters:
destination_folder: Where the files would be extracted to.
files_to_check: Array of files intended to be extracted from an archive. Should be relative names/paths with or without asterisk wildcards or a regular expression.
default: All files and folders in the archive.
Determines what files should be extracted based on the options and mode provided . Returns : An array of files to be extracted ( or the : all symbol ) . Parameters : destination_folder : Where the files would be extracted to . files_to_check : Array of files intended to be extracted from an archive . Should be relative names / paths with or without asterisk wildcards or a regular expression . default : All files and folders in the archive .
def determine_files_to_extract(destination_folder, files_to_check: nil)
      files_to_check ||= :all 
      unless ::File.exist?(@path)
        return @checksums.select { |entry_name, checksum| _extract_file?(entry_name, checksum == 'directory', destination_folder, files_to_check) }.keys unless @checksums.nil? || @checksums.empty?
        return files_to_check
      end
      files_to_extract = case @options[:archive_type]
                         when :zip
                           _determine_zip_files_to_extract(destination_folder, files_to_check)
                         when :seven_zip
                           _determine_seven_zip_files_to_extract(destination_folder, files_to_check)
                         else
                           raise "':#{@options[:archive_type]}' is not a supported archive type!"
                         end
      EasyIO.logger.debug "Files to extract: #{files_to_extract.empty? ? 'none' : JSON.pretty_generate(files_to_extract)}"
      files_to_extract
    end
def determine_files_to_extract ( destination_folder , files_to_check : nil ) files_to_check ||= :all unless :: File . exist? ( @path ) return @checksums . select { | entry_name , checksum | _extract_file? ( entry_name , checksum == 'directory' , destination_folder , files_to_check ) } . keys unless @checksums . nil? || @checksums . empty? return files_to_check end files_to_extract = case @options [ :archive_type ] when :zip _determine_zip_files_to_extract ( destination_folder , files_to_check ) when :seven_zip _determine_seven_zip_files_to_extract ( destination_folder , files_to_check ) else raise "':#{@options[:archive_type]}' is not a supported archive type!" end EasyIO . logger . debug "Files to extract: #{files_to_extract.empty? ? 'none' : JSON.pretty_generate(files_to_extract)}" files_to_extract end
Description:
Determines what files should be extracted based on the options and mode provided.
Description : Determines what files should be extracted based on the options and mode provided .
# defaults to :all files # If the archive doesn't exist but checksums were provided, check for files to extract based off of checksums # If the archive doesn't exist and no checksums were found, extract all files_to_check
destination_folder
files_to_check