deps_grapher 1.0.0 → 1.0.1
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/CHANGELOG.md +5 -1
- data/lib/deps_grapher/configuration.rb +3 -4
- data/lib/deps_grapher/input.rb +19 -17
- data/lib/deps_grapher/layer.rb +0 -2
- data/lib/deps_grapher/source_cache/registry.rb +10 -15
- data/lib/deps_grapher/source_cache.rb +0 -2
- data/lib/deps_grapher/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: 48a2d2dd4c46e98e2283e13a37b9f692691ebab1cd8a95eba9ad4a590471c2be
|
4
|
+
data.tar.gz: 9d783c9c65c71ebbd7c49f88f09b30e8e107b9690c5c82bd01160d800cf3a700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16aab351cbb8a09355b69c6cd5b010011a7f06b1f0327867f75042d302a704f94cb0ba0fffd9ed34871eadcf0ba41bcb62a6620752c7ae3614214e9f0cdb1a0e
|
7
|
+
data.tar.gz: 4cb34be594f84381ee1882ad0d7cf611a0f200ed9089d67ae6b242fab65e9d3da2a9f5df0db3131bbc41095d5e45512477eee320e93da6e41d2cb62ae7eb8bda
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,7 @@ module DepsGrapher
|
|
12
12
|
class_attribute :target_path # target class name on graph
|
13
13
|
class_attribute :clean, default: false
|
14
14
|
class_attribute :logger
|
15
|
+
class_attribute :cache_key
|
15
16
|
class_attribute :cache_dir, default: File.expand_path(File.join("..", "..", "tmp", "deps_grapher", "cache"), __dir__)
|
16
17
|
class_attribute :cache_ttl, default: 60 * 5 # 5 minutes
|
17
18
|
class_attribute :output_dir, default: File.expand_path(File.join("..", "..", "tmp", "deps_grapher", "graph"), __dir__)
|
@@ -75,11 +76,9 @@ module DepsGrapher
|
|
75
76
|
|
76
77
|
content = File.read file
|
77
78
|
|
78
|
-
cache_key = Digest::MD5.hexdigest
|
79
|
+
self.cache_key = Digest::MD5.hexdigest content
|
79
80
|
|
80
|
-
|
81
|
-
DSL.new(self).instance_eval content
|
82
|
-
end
|
81
|
+
DSL.new(self).instance_eval content, file
|
83
82
|
|
84
83
|
return unless dump
|
85
84
|
|
data/lib/deps_grapher/input.rb
CHANGED
@@ -9,32 +9,34 @@ module DepsGrapher
|
|
9
9
|
def files
|
10
10
|
FileUtils.rm_rf File.dirname(config.cache_dir) if config.clean
|
11
11
|
|
12
|
-
|
13
|
-
extract_files_from_layers
|
14
|
-
end
|
12
|
+
layer_visibilities = config.visualizer_options[:layers]
|
15
13
|
|
16
|
-
|
14
|
+
files = []
|
17
15
|
|
18
|
-
|
16
|
+
SourceCache::Registry.with_cache config.cache_key do |restored|
|
17
|
+
config.layers.each_value do |layer|
|
18
|
+
name = layer.name
|
19
|
+
source = layer.source
|
19
20
|
|
20
|
-
|
21
|
-
layer_visibility = config.visualizer_options[:layers]
|
21
|
+
layer.visible = layer_visibilities.include? name
|
22
22
|
|
23
|
-
|
24
|
-
layer.visible = layer_visibility.include? layer.name
|
25
|
-
end
|
26
|
-
end
|
23
|
+
SourceCache.register! name, source unless restored
|
27
24
|
|
28
|
-
|
29
|
-
config.layers.values.select(&:visible).each_with_object([]) do |layer, files|
|
30
|
-
source = layer.source
|
25
|
+
next unless layer.visible
|
31
26
|
|
32
|
-
|
33
|
-
|
27
|
+
source.files.each do |file|
|
28
|
+
next if file == config.path
|
34
29
|
|
35
|
-
|
30
|
+
files << file
|
31
|
+
end
|
36
32
|
end
|
37
33
|
end
|
34
|
+
|
35
|
+
files
|
38
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :config
|
39
41
|
end
|
40
42
|
end
|
data/lib/deps_grapher/layer.rb
CHANGED
@@ -26,35 +26,30 @@ module DepsGrapher
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def with_cache(key)
|
29
|
-
restore_cache! key
|
30
|
-
yield
|
31
|
-
persist_cache! key
|
32
|
-
end
|
33
|
-
|
34
|
-
def persist_cache!(key)
|
35
29
|
cache_file = DepsGrapher.cache_file key
|
36
|
-
cache_file
|
30
|
+
restore_cache! cache_file
|
31
|
+
yield @cache_restoration
|
32
|
+
persist_cache! cache_file
|
37
33
|
end
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
private
|
36
|
+
|
37
|
+
def restore_cache!(cache_file)
|
41
38
|
loaded = cache_file.read
|
42
39
|
|
43
40
|
unless loaded
|
44
|
-
@
|
41
|
+
@cache_restoration = false
|
45
42
|
return
|
46
43
|
end
|
47
44
|
|
48
45
|
@registry = loaded
|
49
|
-
@
|
46
|
+
@cache_restoration = true
|
50
47
|
end
|
51
48
|
|
52
|
-
def
|
53
|
-
@
|
49
|
+
def persist_cache!(cache_file)
|
50
|
+
cache_file.write @registry
|
54
51
|
end
|
55
52
|
|
56
|
-
private
|
57
|
-
|
58
53
|
def registry
|
59
54
|
@registry ||= {}
|
60
55
|
end
|
data/lib/deps_grapher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deps_grapher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jk-es335
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|