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.
- checksums.yaml +4 -4
- data/lib/file-digests.rb +17 -5
- 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: cab5bc80dc7949984501c3068bf99f44f82564774733e84b1cd6810fd0cb6a05
|
4
|
+
data.tar.gz: 97a4220b83a08408345b21a60256e55bbbe0a5fb30e6c97efa05a4faac42d356
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eaae0823ccb95bb3db6245e0863ff37aaa6f14f599bd92d040c8085e753aaa8d3be7903d1039a433bded9011bdc73c6a0d42e3e10d1e2c52eb81b6b791a5bc1
|
7
|
+
data.tar.gz: 97f7fa2ac8605fc1775570accf44a93c73e67a11699b7e98bfa9687f9e2c0219ad1890c1a293f52ca901079e602f6cf6863b5f57de174dd39e36ec338d6597f7
|
data/lib/file-digests.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
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"
|