relaton-index 0.1.9 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/relaton/index/file_io.rb +8 -9
- data/lib/relaton/index/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0eaf31518d3ecfb78041891165d24d8f0e9673d2aebcfa02608694ec9f562843
|
|
4
|
+
data.tar.gz: 206c0f5fcf0b5336ff186f35da3efc79fda86cf25c93f1c499dd525cccdd6128
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3426d0303d776d0c7ecaeb17bf957a20228858ae859f85aec02d52dc833d643ead02cd14c522d6fcecc72b9f920e2efbc3667f31c86e6dcd363ebc4ef9eae516
|
|
7
|
+
data.tar.gz: 0e8809f80cc34c92100a081917ce561ccaeb287e9002171f558d62e0c6148ac68a5b4b72f96e8720815f4d3be9390cda026fe39b08c3ba0895706c15a74e8865
|
|
@@ -34,17 +34,16 @@ module Relaton
|
|
|
34
34
|
def read
|
|
35
35
|
case url
|
|
36
36
|
when String
|
|
37
|
-
@file ||= path_to_local_file
|
|
38
37
|
check_file || fetch_and_save
|
|
39
|
-
when true
|
|
40
|
-
@file ||= path_to_local_file
|
|
41
|
-
read_file
|
|
42
38
|
else
|
|
43
|
-
@file ||= @filename
|
|
44
39
|
read_file
|
|
45
40
|
end
|
|
46
41
|
end
|
|
47
42
|
|
|
43
|
+
def file
|
|
44
|
+
@file ||= url ? path_to_local_file : @filename
|
|
45
|
+
end
|
|
46
|
+
|
|
48
47
|
#
|
|
49
48
|
# Create path to local file
|
|
50
49
|
#
|
|
@@ -60,7 +59,7 @@ module Relaton
|
|
|
60
59
|
# @return [Array<Hash>, nil] index or nil
|
|
61
60
|
#
|
|
62
61
|
def check_file
|
|
63
|
-
ctime = Index.config.storage.ctime(
|
|
62
|
+
ctime = Index.config.storage.ctime(file)
|
|
64
63
|
return unless ctime && ctime > Time.now - 86400
|
|
65
64
|
|
|
66
65
|
read_file
|
|
@@ -72,7 +71,7 @@ module Relaton
|
|
|
72
71
|
# @return [Array<Hash>] index
|
|
73
72
|
#
|
|
74
73
|
def read_file
|
|
75
|
-
yaml = Index.config.storage.read(
|
|
74
|
+
yaml = Index.config.storage.read(file)
|
|
76
75
|
return [] unless yaml
|
|
77
76
|
|
|
78
77
|
YAML.safe_load yaml, permitted_classes: [Symbol]
|
|
@@ -100,7 +99,7 @@ module Relaton
|
|
|
100
99
|
# @return [void]
|
|
101
100
|
#
|
|
102
101
|
def save(index)
|
|
103
|
-
Index.config.storage.write
|
|
102
|
+
Index.config.storage.write file, index.to_yaml
|
|
104
103
|
end
|
|
105
104
|
|
|
106
105
|
#
|
|
@@ -109,7 +108,7 @@ module Relaton
|
|
|
109
108
|
# @return [Array]
|
|
110
109
|
#
|
|
111
110
|
def remove
|
|
112
|
-
Index.config.storage.remove
|
|
111
|
+
Index.config.storage.remove file
|
|
113
112
|
[]
|
|
114
113
|
end
|
|
115
114
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-index
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-05-
|
|
11
|
+
date: 2023-05-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubyzip
|