zipr 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zipr/archive.rb +11 -5
- data/lib/zipr/helper.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d81272a9a6533e52cc6e92c391aa1a36ec48443b8899bc17cb1f0570115c177
|
4
|
+
data.tar.gz: b3a559a665e86be77ebe99ae33b9bb8b1932be918bbd40bb9b486b1071b90358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf058b81ca99e1c7a1ea413fab134a4cff198ca92a0b5e99fd1c8903d452ca616bc2d3a530bf57a160b7c3a49a236f6101392297a49c58dd548a3eb71b228323
|
7
|
+
data.tar.gz: 39219668c4a9a9606d82cbcb614d3ef110488132f7e19e5494518efcb56d5fd3ac58edaec06fb512072a2d8cf56204bd9e3b513fdf73dad961b647920f36c4d8
|
data/lib/zipr/archive.rb
CHANGED
@@ -210,7 +210,7 @@ module Zipr
|
|
210
210
|
unless ::File.exist?(@path)
|
211
211
|
# If the archive doesn't exist but checksums were provided, check for files to extract based off of checksums
|
212
212
|
return @checksums.select { |entry_name, checksum| _extract_file?(entry_name, checksum == 'directory', destination_folder, files_to_check) }.keys unless @checksums.nil? || @checksums.empty?
|
213
|
-
# If the archive doesn't exist and no checksums were found, extract all files_to_check
|
213
|
+
# If the archive doesn't exist and no checksums were found, extract all files_to_check
|
214
214
|
return files_to_check
|
215
215
|
end
|
216
216
|
|
@@ -443,13 +443,19 @@ module Zipr
|
|
443
443
|
@options[:exclude_files] ||= []
|
444
444
|
@options[:exclude_unless_missing] ||= []
|
445
445
|
@options[:exclude_unless_archive_changed] ||= []
|
446
|
-
return true if @options[:exclude_files].any? { |e| file_path.tr('\\', '/') =~
|
447
|
-
return true if ::File.exist?(destination_path) && @options[:exclude_unless_missing].any? { |e| file_path.tr('\\', '/') =~
|
448
|
-
return true if exists_in_zip && @options[:exclude_unless_missing].any? { |e| file_path.tr('\\', '/') =~
|
449
|
-
return true if !@archive_changed && ::File.exist?(destination_path) && @options[:exclude_unless_archive_changed].any? { |e| file_path.tr('\\', '/') =~
|
446
|
+
return true if @options[:exclude_files].any? { |e| file_path.tr('\\', '/') =~ _convert_backslashes_and_cast_to_regexp(e) }
|
447
|
+
return true if ::File.exist?(destination_path) && @options[:exclude_unless_missing].any? { |e| file_path.tr('\\', '/') =~ _convert_backslashes_and_cast_to_regexp(e) }
|
448
|
+
return true if exists_in_zip && @options[:exclude_unless_missing].any? { |e| file_path.tr('\\', '/') =~ _convert_backslashes_and_cast_to_regexp(e) }
|
449
|
+
return true if !@archive_changed && ::File.exist?(destination_path) && @options[:exclude_unless_archive_changed].any? { |e| file_path.tr('\\', '/') =~ _convert_backslashes_and_cast_to_regexp(e) }
|
450
450
|
false
|
451
451
|
end
|
452
452
|
|
453
|
+
def _convert_backslashes_and_cast_to_regexp(path)
|
454
|
+
return path if path.is_a?(Regexp) # If it's already a regexp, leave it alone
|
455
|
+
path = path.tr('\\', '/')
|
456
|
+
/^#{Zipr.wildcard_to_regexp(path)}$/i
|
457
|
+
end
|
458
|
+
|
453
459
|
def _assign_common_accessors(options: nil, checksums: nil, mode: nil)
|
454
460
|
_assign_checksums(checksums)
|
455
461
|
@options = options || @options || {}
|
data/lib/zipr/helper.rb
CHANGED