lib/zipper.rb
def get_dir_entries_recursively(dir, entry_path, ignore_entries, replace_path = nil)
            replace_path = dir.clone if replace_path.nil?
            (Dir.entries(dir) - %w(. ..)).map { |v| File.join(dir, v) }.select { |path| filter_entries path, FileEntryType::FILE, ignore_entries }.map { |path|
                if File.directory? path
                    get_dir_entries_recursively(path, entry_path, ignore_entries, replace_path)
                else
                    entry_path_in_zip = (entry_path.nil? ? path : path.sub(replace_path, entry_path)).gsub(/^[\/\\]+/, "")
                    FileEntry.new(path, false, entry_path_in_zip)
                end
            }
        end
def get_dir_entries_recursively(dir, entry_path, ignore_entries, replace_path = nil)
            replace_path = dir.clone if replace_path.nil?
            (Dir.entries(dir) - %w(. ..)).map { |v| File.join(dir, v) }.select { |path| filter_entries path, FileEntryType::FILE, ignore_entries }.map { |path|
                if File.directory? path
                    get_dir_entries_recursively(path, entry_path, ignore_entries, replace_path)
                else
                    entry_path_in_zip = (entry_path.nil? ? path : path.sub(replace_path, entry_path)).gsub(/^[\/\\]+/, "")
                    FileEntry.new(path, false, entry_path_in_zip)
                end
            }
        end
def get_dir_entries_recursively ( dir , entry_path , ignore_entries , replace_path = nil ) replace_path = dir . clone if replace_path . nil? ( Dir . entries ( dir ) - %w( . .. ) ) . map { | v | File . join ( dir , v ) } . select { | path | filter_entries path , FileEntryType :: FILE , ignore_entries } . map { | path | if File . directory? path get_dir_entries_recursively ( path , entry_path , ignore_entries , replace_path ) else entry_path_in_zip = ( entry_path . nil? ? path : path . sub ( replace_path , entry_path ) ) . gsub ( / \/ \\ / , "" ) FileEntry . new ( path , false , entry_path_in_zip ) end } end
Collects all files from directory recursively
 Params:
 +dir+:: start directory
 +entry_path+:: path with which file should be placed into zip
 +replace_path+:: part of path which is being replaced by +entry_path+
Collects all files from directory recursively Params : + dir + :: start directory + entry_path + :: path with which file should be placed into zip + replace_path + :: part of path which is being replaced by + entry_path +