zipr 0.3.2 → 0.4.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zipr/archive.rb +3 -2
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29d17a3bd1b8b10a97dca34e9bb8c7b7dd27ac3a9ccdb63a79a4b3e6bc71138f
4
- data.tar.gz: 408ed3fd53d0537b559ca1ead8b2aa2e87e47abfefc9848ab2bb0df59f5f9492
3
+ metadata.gz: a62bdef06b58c837858d72e7f3e6fa1a16a62888783f014b96cdce25acaa4255
4
+ data.tar.gz: d304d5bcf9876d6e3a1852b3137246530f8881ef19fbd33890e9a0c082307b7e
5
5
  SHA512:
6
- metadata.gz: a8b6f6ab632bdf5dd884fd1cf4d5cf1a650c068ae86c0f3dfcc3649cba993f9ee01df70bcc2fb4e30dc3f57ae39c7404fe15266271267676bfe30c03e6ecf3dd
7
- data.tar.gz: 9833cb57b68c4af55aefd5c25c9c2be2e7eb5f4b90ed9629388b3533b6b6683f9570007afa56318fd44bc1264281fe223832596c69c512e40fa202f2499a4a68
6
+ metadata.gz: 84b0029024a874635ffeb55bed38daeed54d178cecc74e523e4abd776e21df3a4b39c5cb7b19d156ea65c0077ae073b924eff8a3ecdf056005bd9516df6fbc16
7
+ data.tar.gz: 2591e17d3cd2e121901c4deef767d70a8b84740bbb47363fa4e524d4e8e81a4142772b5ecf44677cad95f1a86f54228a0e3d8255eaf4704e23b2200b11fddfca
data/lib/zipr/archive.rb CHANGED
@@ -357,7 +357,7 @@ module Zipr
357
357
  ::Zip::File.open(@path, ::Zip::File::CREATE) do |zip_archive|
358
358
  EasyIO.logger.info "Adding to #{@path}..." unless @options[:silent]
359
359
  files_to_add.each do |source_file|
360
- add_directory_lambda = ->(relative_path) { zip_archive.mkdir(relative_path) }
360
+ add_directory_lambda = ->(relative_path) { zip_archive.mkdir(relative_path) unless zip_archive.find_entry(relative_path) }
361
361
  add_file_lambda = ->(relative_path) { zip_archive.add(relative_path, source_file) { :overwrite } }
362
362
  _add_item(source_file, add_directory_lambda, add_file_lambda, source_folder)
363
363
  end
@@ -441,6 +441,7 @@ module Zipr
441
441
  def _extract_file?(archive_entry_name, is_a_directory, destination_folder, files_to_check)
442
442
  destination_path = "#{destination_folder}/#{archive_entry_name}"
443
443
  return false unless files_to_check == :all || files_to_check.include?(archive_entry_name) # Make sure the file is in the whitelist if it was provided
444
+ return false if archive_entry_name == 'archive_checksum'
444
445
  return false if ::File.directory?(destination_path) && is_a_directory # Archive item is a directory and the destination directory exists
445
446
  return false if @mode == :if_missing && ::File.exist?(destination_path) # File exists and we're not overwriting existing files due to the mode
446
447
  return false if _excluded_file?(archive_entry_name, destination_path: destination_path) # File is excluded in :options
@@ -469,7 +470,7 @@ module Zipr
469
470
  _assign_checksums(checksums)
470
471
  @options = options || @options || {}
471
472
  @mode = mode || @mode || :idempotent
472
- @archive_changed = ::File.exist?(@path) && @checksums['archive_checksum'] != Digest::SHA256.file(@path).hexdigest
473
+ @archive_changed = (::File.exist?(@path) && @checksums['archive_checksum'] != Digest::SHA256.file(@path).hexdigest) || !::File.exist?(@checksum_path)
473
474
  end
474
475
 
475
476
  def _assign_checksums(checksums)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Munoz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-24 00:00:00.000000000 Z
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_io
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.0.3
131
+ rubygems_version: 3.0.3.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Ruby library for easily extracting and creating 7zip and zip archives idempotently.