js_dependency 0.3.11 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +12 -12
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -1
- data/lib/js_dependency/extractor/extract_script_tag.rb +4 -0
- data/lib/js_dependency/mermaid/nodes_link.rb +22 -0
- data/lib/js_dependency/mermaid/root.rb +6 -9
- data/lib/js_dependency/version.rb +1 -1
- data/lib/js_dependency.rb +1 -1
- 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: 8a4e8c31528eb944e9acf98aaf37710cffb27728f6e5c9b7337f85dcf5a3ca13
|
4
|
+
data.tar.gz: fb428fe8a8eca603ebef72f19771d8b8d94235d782ccb301e2de7bb11da0a004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7531ac4e27d5ec92a7efeea5e13051baed6471d7b059c622bd2aa21885a9d09bfcf9767c99bc59812adf1de6b333e60374518a888a7f3ef704d64a0d827ac812
|
7
|
+
data.tar.gz: 818a5e4210088a3f3d240a18d437909842c46619636e0c38cac1ffd3444659812e2b3a13dfe10b98f39bc4561fb8f52594696374159215f8d4bd29214f436cd1
|
data/.rubocop_todo.yml
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-08-13 05:
|
3
|
+
# on 2022-08-13 15:05:03 UTC using RuboCop version 1.35.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 2
|
10
|
+
Lint/UselessAssignment:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/js_dependency_spec.rb'
|
13
|
+
|
14
|
+
# Offense count: 2
|
10
15
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
11
16
|
Metrics/AbcSize:
|
12
17
|
Max: 29
|
13
18
|
|
14
|
-
# Offense count:
|
19
|
+
# Offense count: 2
|
15
20
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
16
21
|
Metrics/CyclomaticComplexity:
|
17
22
|
Max: 15
|
18
23
|
|
19
|
-
# Offense count:
|
24
|
+
# Offense count: 7
|
20
25
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
21
26
|
Metrics/MethodLength:
|
22
27
|
Max: 19
|
@@ -26,19 +31,14 @@ Metrics/MethodLength:
|
|
26
31
|
Metrics/ParameterLists:
|
27
32
|
Max: 9
|
28
33
|
|
29
|
-
# Offense count:
|
34
|
+
# Offense count: 2
|
30
35
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
31
36
|
Metrics/PerceivedComplexity:
|
32
37
|
Max: 15
|
33
38
|
|
34
|
-
# Offense count:
|
35
|
-
Style/MultilineBlockChain:
|
36
|
-
Exclude:
|
37
|
-
- 'lib/js_dependency/mermaid/root.rb'
|
38
|
-
|
39
|
-
# Offense count: 8
|
39
|
+
# Offense count: 18
|
40
40
|
# This cop supports safe autocorrection (--autocorrect).
|
41
41
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
42
42
|
# URISchemes: http, https
|
43
43
|
Layout/LineLength:
|
44
|
-
Max:
|
44
|
+
Max: 187
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
js_dependency (0.3.
|
4
|
+
js_dependency (0.3.12)
|
5
5
|
pathname
|
6
6
|
thor
|
7
7
|
yaml
|
@@ -14,8 +14,14 @@ GEM
|
|
14
14
|
codecov (0.6.0)
|
15
15
|
simplecov (>= 0.15, < 0.22)
|
16
16
|
coderay (1.1.3)
|
17
|
+
debug (1.5.0)
|
18
|
+
irb (>= 1.3.6)
|
19
|
+
reline (>= 0.2.7)
|
17
20
|
diff-lcs (1.5.0)
|
18
21
|
docile (1.4.0)
|
22
|
+
io-console (0.5.11)
|
23
|
+
irb (1.4.1)
|
24
|
+
reline (>= 0.3.0)
|
19
25
|
json (2.6.2)
|
20
26
|
parallel (1.22.1)
|
21
27
|
parser (3.1.2.1)
|
@@ -30,6 +36,8 @@ GEM
|
|
30
36
|
rainbow (3.1.1)
|
31
37
|
rake (13.0.6)
|
32
38
|
regexp_parser (2.5.0)
|
39
|
+
reline (0.3.1)
|
40
|
+
io-console (~> 0.5)
|
33
41
|
rexml (3.2.5)
|
34
42
|
rspec (3.11.0)
|
35
43
|
rspec-core (~> 3.11.0)
|
@@ -94,6 +102,7 @@ PLATFORMS
|
|
94
102
|
|
95
103
|
DEPENDENCIES
|
96
104
|
codecov
|
105
|
+
debug (>= 1.0.0)
|
97
106
|
js_dependency!
|
98
107
|
rake (~> 13.0)
|
99
108
|
rspec (~> 3.0)
|
@@ -26,10 +26,32 @@ module JsDependency
|
|
26
26
|
mermaid_str(@child, level)
|
27
27
|
end
|
28
28
|
|
29
|
+
# @param [String] src_path
|
30
|
+
# @return [JsDependency::Mermaid::NodesLink]
|
31
|
+
def relative_path_from(src_path)
|
32
|
+
NodesLink.new(
|
33
|
+
relative_parent_path(src_path),
|
34
|
+
relative_child_path(src_path)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
29
38
|
private
|
30
39
|
|
40
|
+
# @param [String] src_path
|
41
|
+
# @return [String]
|
42
|
+
def relative_parent_path(src_path)
|
43
|
+
parent.exist? ? parent.realpath.relative_path_from(Pathname.new(src_path).realpath.to_s).to_s : parent.to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [String] src_path
|
47
|
+
# @return [String]
|
48
|
+
def relative_child_path(src_path)
|
49
|
+
child.exist? ? child.realpath.relative_path_from(Pathname.new(src_path).realpath.to_s).to_s : child.to_s
|
50
|
+
end
|
51
|
+
|
31
52
|
# @param [Pathname] pathname
|
32
53
|
# @param [Integer] level
|
54
|
+
# @return [String]
|
33
55
|
def mermaid_str(pathname, level = 0)
|
34
56
|
"#{parse(pathname).join("_")}[\"#{parse(pathname, level).join("/")}\"]"
|
35
57
|
end
|
@@ -5,6 +5,7 @@ module JsDependency
|
|
5
5
|
module Mermaid
|
6
6
|
class Root
|
7
7
|
attr_accessor :orientation
|
8
|
+
attr_reader :list
|
8
9
|
|
9
10
|
# @param [String] orientation
|
10
11
|
def initialize(orientation = "LR")
|
@@ -35,18 +36,14 @@ module JsDependency
|
|
35
36
|
# @return [Array<String>]
|
36
37
|
def export_nodes(name_level: 1, src_path: nil)
|
37
38
|
nodes_links = if src_path
|
38
|
-
|
39
|
-
@list.map do |nodes_link|
|
40
|
-
NodesLink.new(nodes_link.parent.exist? ? nodes_link.parent.relative_path_from(src_pathname.to_s) : nodes_link.parent.to_s,
|
41
|
-
nodes_link.child.exist? ? nodes_link.child.relative_path_from(src_pathname.to_s) : nodes_link.child.to_s)
|
42
|
-
end
|
39
|
+
@list.map { |nodes_link| nodes_link.relative_path_from(src_path) }
|
43
40
|
else
|
44
41
|
@list
|
45
42
|
end
|
46
|
-
nodes_links.uniq
|
47
|
-
|
48
|
-
|
49
|
-
"#{
|
43
|
+
nodes_links = nodes_links.uniq { |nodes_link| "#{nodes_link.parent}__#{nodes_link.child}" }
|
44
|
+
nodes_links = nodes_links.sort_by { |nodes_link| "#{nodes_link.parent}__#{nodes_link.child}" }
|
45
|
+
nodes_links.map do |nodes_link|
|
46
|
+
"#{nodes_link.parent_module_name(name_level)} --> #{nodes_link.child_module_name(name_level)}"
|
50
47
|
end
|
51
48
|
end
|
52
49
|
end
|
data/lib/js_dependency.rb
CHANGED
@@ -71,7 +71,7 @@ module JsDependency
|
|
71
71
|
nodes += mermaid_root.export_nodes(name_level: name_level, src_path: src_path)
|
72
72
|
end
|
73
73
|
|
74
|
-
output = (["flowchart LR"] + nodes.uniq + styles.uniq).join("\n")
|
74
|
+
output = "#{(["flowchart LR"] + nodes.uniq + styles.uniq).join("\n")}\n"
|
75
75
|
output_pathname&.write(output)
|
76
76
|
output
|
77
77
|
end
|