lex-knowledge 0.6.7 → 0.6.9
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29631e6f2778ceedf74b69197379edc4c215d9b7ff4b2e088790dedc227fd90f
|
|
4
|
+
data.tar.gz: d96dd08d5a1450e5e1f3db0936729d3a40c834edc166126d6c9dd73a1839518f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 971edc3c4347a949a89b690cccda16150e5644be27eb201d22daeaab0e293cc03ebf530e509712a514eb2f40e3e86c201ce96475c2cbf398252fcae73bc0af64
|
|
7
|
+
data.tar.gz: 980eb54c45d386db31c1ed817f41f2f12d6a7993e07db910c016398ddb5229274622c720e78eb1aabcb0920d01772de63627ecbff6653bb051b893b7e230d766
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'digest'
|
|
4
|
-
require 'find'
|
|
5
4
|
|
|
6
5
|
module Legion
|
|
7
6
|
module Extensions
|
|
@@ -12,19 +11,28 @@ module Legion
|
|
|
12
11
|
|
|
13
12
|
def scan(path:, extensions: %w[.md .txt .docx .pdf])
|
|
14
13
|
results = []
|
|
14
|
+
walk(path, extensions, results)
|
|
15
|
+
results
|
|
16
|
+
end
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
next unless ::File.file?(entry)
|
|
21
|
-
next unless extensions.include?(::File.extname(entry).downcase)
|
|
18
|
+
def walk(entry, extensions, results)
|
|
19
|
+
basename = ::File.basename(entry)
|
|
20
|
+
return if basename.start_with?('.')
|
|
22
21
|
|
|
22
|
+
if ::File.directory?(entry)
|
|
23
|
+
::Dir.children(entry).each { |c| walk(::File.join(entry, c), extensions, results) }
|
|
24
|
+
elsif ::File.file?(entry) && extensions.include?(::File.extname(entry).downcase)
|
|
23
25
|
results << build_entry(entry)
|
|
24
26
|
end
|
|
27
|
+
rescue Errno::EPERM, Errno::EACCES, Errno::ELOOP, Errno::ENOENT => e
|
|
28
|
+
log.debug("[manifest] skipping unreadable #{entry}: #{e.class}: #{e.message}")
|
|
29
|
+
end
|
|
30
|
+
private_class_method :walk
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
def log
|
|
33
|
+
Legion::Logging
|
|
27
34
|
end
|
|
35
|
+
private_class_method :log
|
|
28
36
|
|
|
29
37
|
def diff(current:, previous:)
|
|
30
38
|
current_map = current.to_h { |e| [e[:path], e[:sha256]] }
|