file-digests 0.0.28 → 0.0.29

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/file-digests.rb +17 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 406b02c22923ae98c45dc92f2836a99dffa6dc8b2343ff62b5b5957a4a154bdc
4
- data.tar.gz: 5898cbc3826818da8c3fa5cf16a334bcb4627f95dc2635a297cc9c7d81d25dfe
3
+ metadata.gz: cab5bc80dc7949984501c3068bf99f44f82564774733e84b1cd6810fd0cb6a05
4
+ data.tar.gz: 97a4220b83a08408345b21a60256e55bbbe0a5fb30e6c97efa05a4faac42d356
5
5
  SHA512:
6
- metadata.gz: '021494ba0a65daada30e55c63e489c60c018ae3b189409be200635948132f0ed5118d217388e81d8097bc991cf10fea2ce09c4a3a7c148c1fdaa8f66e6b8e074'
7
- data.tar.gz: 3a28808aa979157a2597b5ea56ad006576d28f35678cbaa6e13d62be20aa37066a9d4684d48f5ed2990b24c42acb2ee8cd2d0f14f4f9b12f893c5b3946d5b76e
6
+ metadata.gz: 5eaae0823ccb95bb3db6245e0863ff37aaa6f14f599bd92d040c8085e753aaa8d3be7903d1039a433bded9011bdc73c6a0d42e3e10d1e2c52eb81b6b791a5bc1
7
+ data.tar.gz: 97f7fa2ac8605fc1775570accf44a93c73e67a11699b7e98bfa9687f9e2c0219ad1890c1a293f52ca901079e602f6cf6863b5f57de174dd39e36ec338d6597f7
@@ -124,7 +124,9 @@ class FileDigests
124
124
 
125
125
  @digest_database_path = digest_database_path ? cleanup_path(digest_database_path) : @files_path
126
126
  @digest_database_path += ".file-digests.sqlite" if File.directory?(@digest_database_path)
127
- ensure_dir_exists @digest_database_path.dirname
127
+ ensure_dir_exist @digest_database_path.dirname
128
+
129
+ @digest_database_files = ["#{@digest_database_path}", "#{@digest_database_path}-wal", "#{@digest_database_path}-shm"]
128
130
 
129
131
  if @options[:verbose]
130
132
  puts "Target directory: #{@files_path}"
@@ -265,6 +267,8 @@ class FileDigests
265
267
  execute "VACUUM"
266
268
  execute "PRAGMA wal_checkpoint(TRUNCATE)"
267
269
 
270
+ hide_database_files
271
+
268
272
  print_counters
269
273
  end
270
274
  end
@@ -296,9 +300,7 @@ class FileDigests
296
300
 
297
301
  raise "File is not readable" unless stat.readable?
298
302
 
299
- if filename == "#{@digest_database_path}" ||
300
- filename == "#{@digest_database_path}-wal" ||
301
- filename == "#{@digest_database_path}-shm"
303
+ if @digest_database_files.include?(filename)
302
304
  puts "SKIPPING DATABASE FILE: #{filename}" if @options[:verbose]
303
305
  return
304
306
  end
@@ -460,6 +462,16 @@ class FileDigests
460
462
  time.utc.strftime("%Y-%m-%d %H:%M:%S")
461
463
  end
462
464
 
465
+ def hide_database_files
466
+ if Gem.win_platform?
467
+ @digest_database_files.each do |file|
468
+ if File.exist?(file)
469
+ system "attrib", "+H", file, exception: true
470
+ end
471
+ end
472
+ end
473
+ end
474
+
463
475
 
464
476
  # Filesystem-related helpers
465
477
 
@@ -471,7 +483,7 @@ class FileDigests
471
483
  Pathname.new(patch_path_string(path)).cleanpath
472
484
  end
473
485
 
474
- def ensure_dir_exists path
486
+ def ensure_dir_exist path
475
487
  if File.exist?(path)
476
488
  unless File.directory?(path)
477
489
  raise "#{path} is not a directory"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file-digests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav Senotrusov